Examples of GrammarEngine


Examples of org.antlr.works.grammar.engine.GrammarEngine

    public void goToDeclaration(final Jumpable ref) {
        goToHistoryRememberCurrentPosition();
        if(ref instanceof ElementImport) {
        //    getContainer().selectEditor(ref.getName());
        } else if(ref != null) {
            GrammarEngine engine = getGrammarEngine();
            int index = engine.getFirstDeclarationPosition(ref.getName());
            if(index == -1) {
                // This grammar does not contain the declaration. Search in the other children
                // starting from the root grammarEngine
                engine = engine.getRootEngine();
                List<String> grammars = engine.getGrammarsOverriddenByRule(ref.getName());
                if(!grammars.isEmpty()) {
                    //getContainer().selectEditor(grammars.get(0));

                    // set the caret position
                    SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            GrammarEngine engine = getGrammarEngine();
                            int index = engine.getFirstDeclarationPosition(ref.getName());
                            if(index != -1) {
                                setCaretPosition(index);
                            }
                        }
                    });
View Full Code Here

Examples of org.antlr.works.grammar.engine.GrammarEngine

    private void serializeSyntaxDiagrams() throws Exception {
        processSyntaxDiagram(new SerializePSDDelegate());
    }

    private void processSyntaxDiagram(ProcessSyntaxDiagramDelegate delegate) throws Exception {
        GrammarEngine engine = new GrammarEngineImpl(new EngineDelegate());
        GrammarSyntaxEngine syntaxEngine = engine.getSyntaxEngine();

        syntaxEngine.setDelegate(new SyntaxDelegate());
        syntaxEngine.processSyntax();

        engine.parserCompleted();
       
        SDGenerator gen = new SDGenerator(engine);

        delegate.beginProcess();
        for(String name : engine.getRuleNames()) {
            delegate.processRule(name, gen);
        }
        delegate.endProcess();
    }
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.