Package net.percederberg.grammatica.code.java

Examples of net.percederberg.grammatica.code.java.JavaVariable


     *
     * @param pattern        the production pattern
     */
    public void addProductionConstant(ProductionPattern pattern) {
        String        constant;
        JavaVariable  var;
        int           modifiers;

        if (pattern.isSynthetic()) {
            constant = "SUBPRODUCTION_" + constantId;
            modifiers = JavaVariable.PRIVATE + JavaVariable.STATIC +
                        JavaVariable.FINAL;
            var = new JavaVariable(modifiers,
                                   "int",
                                   constant,
                                   String.valueOf(constantId + 3000));
            var.addComment(new JavaComment(PRODUCTION_COMMENT));
            cls.addVariable(var);
            constantNames.put(new Integer(pattern.getId()), constant);
            constantId++;
        }
    }
View Full Code Here


     *
     * @param pattern        the token pattern
     */
    public void addToken(TokenPattern pattern) {
        String        constant;
        JavaVariable  var;
        int           modifiers;

        constant = gen.getCodeStyle().getUpperCase(pattern.getName());
        modifiers = JavaVariable.PUBLIC + JavaVariable.STATIC +
                    JavaVariable.FINAL;
        var = new JavaVariable(modifiers,
                               "int",
                               constant,
                               "" + pattern.getId());
        var.addComment(new JavaComment(TOKEN_COMMENT));
        ifc.addVariable(var);
        constantNames.put(new Integer(pattern.getId()), constant);
    }
View Full Code Here

     *
     * @param pattern        the production pattern
     */
    public void addProduction(ProductionPattern pattern) {
        String        constant;
        JavaVariable  var;
        int           modifiers;

        if (!pattern.isSynthetic()) {
            constant = gen.getCodeStyle().getUpperCase(pattern.getName());
            modifiers = JavaVariable.PUBLIC + JavaVariable.STATIC +
                        JavaVariable.FINAL;
            var = new JavaVariable(modifiers,
                                   "int",
                                   constant,
                                   "" + pattern.getId());
            var.addComment(new JavaComment(PRODUCTION_COMMENT));
            ifc.addVariable(var);
            constantNames.put(new Integer(pattern.getId()), constant);
        }
    }
View Full Code Here

TOP

Related Classes of net.percederberg.grammatica.code.java.JavaVariable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.