Examples of VisualBasicMethod


Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

            modifiers = VisualBasicClass.PUBLIC;
        } else {
            modifiers = VisualBasicClass.FRIEND;
        }
        this.cls = new VisualBasicClass(modifiers, name, "Tokenizer");
        this.initMethod = new VisualBasicMethod(VisualBasicMethod.PRIVATE,
                                                "CreatePatterns",
                                                "",
                                                "");
        initializeCode();
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

        this.cls = new VisualBasicClass(modifiers,
                                        name,
                                        "RecursiveDescentParser");
        this.enm = new VisualBasicEnumeration(VisualBasicEnumeration.PRIVATE,
                                              "SynteticPatterns");
        this.initMethod = new VisualBasicMethod(VisualBasicMethod.PRIVATE,
                                                "CreatePatterns",
                                                "",
                                                "");
        initializeCode(tokenizer, analyzer);
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

     * @param analyzer       the analyzer file generator
     */
    private void initializeCode(VisualBasicTokenizerFile tokenizer,
                                VisualBasicAnalyzerFile analyzer) {
        VisualBasicConstructor  constr;
        VisualBasicMethod       method;
        VisualBasicNamespace    n;
        String                  str;

        // Add using
        file.addImports(new VisualBasicImports("System.IO"));
        file.addImports(new VisualBasicImports("PerCederberg.Grammatica.Runtime"));

        // Add namespace
        if (gen.getNamespace() == null) {
            file.addClass(cls);
        } else {
            n = new VisualBasicNamespace(gen.getNamespace());
            n.addClass(cls);
            file.addNamespace(n);
        }

        // Add file comment
        str = file.toString() + "\n\n" + gen.getFileComment();
        file.addComment(new VisualBasicComment(VisualBasicComment.SINGLELINE,
                                               str));

        // Add type comment
        cls.addComment(new VisualBasicComment(TYPE_COMMENT));

        // Add enumeration
        cls.addEnumeration(enm);
        enm.addComment(new VisualBasicComment(ENUM_COMMENT));

        // Add constructor
        constr = new VisualBasicConstructor("ByVal input As TextReader");
        cls.addConstructor(constr);
        constr.addComment(new VisualBasicComment(CONSTRUCTOR1_COMMENT));
        constr.addCode("MyBase.New(input)");
        constr.addCode("CreatePatterns()");

        // Add constructor
        constr = new VisualBasicConstructor("ByVal input As TextReader, " +
                                            "ByVal analyzer As " +
                                            analyzer.getClassName());
        cls.addConstructor(constr);
        constr.addComment(new VisualBasicComment(CONSTRUCTOR2_COMMENT));
        constr.addCode("MyBase.New(input, analyzer)");
        constr.addCode("CreatePatterns()");

        // Add tokenizer factory method
        method = new VisualBasicMethod(VisualBasicMethod.PROTECTED + VisualBasicMethod.OVERRIDES,
                                      "NewTokenizer",
                                      "ByVal input As TextReader",
                                      "Tokenizer");
        method.addComment(new VisualBasicComment(FACTORY_COMMENT));
        method.addCode("Return New " + tokenizer.getClassName() + "(input);");
        cls.addMethod(method);

        // Add init method
        cls.addMethod(initMethod);
        initMethod.addComment(new VisualBasicComment(INIT_METHOD_COMMENT));
View Full Code Here

Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

        } else {
            modifiers += VisualBasicClass.FRIEND;
        }
        this.cls = new VisualBasicClass(modifiers, name, "Analyzer");
        modifiers = VisualBasicMethod.PUBLIC + VisualBasicMethod.OVERRIDES;
        this.enter = new VisualBasicMethod(modifiers,
                                           "Enter",
                                           "ByVal node As Node",
                                           "");
        this.exit = new VisualBasicMethod(modifiers,
                                          "[Exit]",
                                          "ByVal node As Node",
                                          "Node");
        this.child = new VisualBasicMethod(modifiers,
                                           "Child",
                                           "ByVal node As Production, " +
                                           "ByVal child As Node",
                                           "");
        initializeCode();
View Full Code Here

Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

     *
     * @param name           the node name
     * @param type           the node type
     */
    private void addEnterMethod(String name, String type) {
        VisualBasicMethod  m;

        m = new VisualBasicMethod(VisualBasicMethod.PUBLIC +
                                  VisualBasicMethod.OVERRIDABLE,
                                  "Enter" + name,
                                  "ByVal node As " + type,
                                  "");
        m.addComment(new VisualBasicComment(ENTER_COMMENT));
        cls.addMethod(m);
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

     *
     * @param name           the node name
     * @param type           the node type
     */
    private void addExitMethod(String name, String type) {
        VisualBasicMethod  m;

        m = new VisualBasicMethod(VisualBasicMethod.PUBLIC +
                                  VisualBasicMethod.OVERRIDABLE,
                                  "Exit" + name,
                                  "ByVal node As " + type,
                                  "Node");
        m.addComment(new VisualBasicComment(EXIT_COMMENT));
        m.addCode("Return node");
        cls.addMethod(m);
    }
View Full Code Here

Examples of net.percederberg.grammatica.code.visualbasic.VisualBasicMethod

     * Adds an add child method to this file.
     *
     * @param name           the node name
     */
    private void addChildMethod(String name) {
        VisualBasicMethod  m;

        m = new VisualBasicMethod(VisualBasicMethod.PUBLIC +
                                  VisualBasicMethod.OVERRIDABLE,
                                  "Child" + name,
                                  "ByVal node As Production, " +
                                  "ByVal child As Node",
                                  "");
        m.addComment(new VisualBasicComment(CHILD_COMMENT));
        m.addCode("node.AddChild(child)");
        cls.addMethod(m);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.