Examples of ElementRule


Examples of org.antlr.works.grammar.element.ElementRule

        return true;
    }

    @Override
    public String getDOTString() throws Exception {
        ElementRule rule = window.getCurrentRule();

        visitedRules.clear();
        visitedRefs.clear();

        dependency = new StringBuilder();
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

        Usages usage = new Usages(delegate, token);
        delegate.addUsagesTab(usage);

        for (ATEToken ateToken : delegate.getTokens()) {
            if (ateToken.getAttribute().equals(token.getAttribute())) {
                ElementRule matchedRule = delegate.getEditorRules().getEnclosingRuleAtPosition(ateToken.getStartIndex());
                if (matchedRule != null)
                    usage.addMatch(matchedRule, ateToken);
            }
        }
    }
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

        this.window = window;
    }

    public void showTokensSD() {
        StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_SHOW_TOKENS_SD);
        window.syntaxDiagramTab.setRule(new ElementRule(Grammar.ARTIFICIAL_TOKENS_RULENAME), true);
    }
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

        if(s != null && s.length() > 0) {
            List<ElementRule> rules = window.editorRules.getSelectedRules();
            if(!rules.isEmpty()) {
                window.beginGroupChange("Group");

                ElementRule firstRule = rules.get(0);
                ElementRule lastRule = rules.get(rules.size()-1);

                int end = lastRule.getEndIndex();
                window.getTextEditor().insertText(end+1, "\n"+ GrammarSyntaxParser.END_GROUP+"\n");

                int start = firstRule.getStartIndex();
                window.getTextEditor().insertText(start-1, "\n"+ GrammarSyntaxParser.BEGIN_GROUP+s+"\n");
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

    protected boolean willLaunch() {
        return true;
    }

    protected boolean checkForCurrentRule() {
        ElementRule rule = window.getCurrentRule();
        if(rule == null) {
            XJAlert.display(window.getJavaContainer(), "Error", "The cursor must be inside a rule");
            return false;
        }
        return true;
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

    public void setCaretPosition(int position) {
        setCaretPosition(position, AWPrefs.getSmoothScrolling());
    }

    private void setCaretPosition(int position, boolean animate) {
        ElementRule rule = editorRules.getEnclosingRuleAtPosition(position);
        if(rule != null && !rule.isExpanded()) {
            foldingManager.toggleFolding(rule);
        }
        textEditor.setCaretPosition(position, true, animate);
    }
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

        return textEditor.getCaretPosition();
    }

    public void updateVisualization(boolean immediate) {
        if(syntaxDiagramTab.isEnabled()) {
            ElementRule r = editorRules.getEnclosingRuleAtPosition(getCaretPosition());
            if(r == null) {
                syntaxDiagramTab.setPlaceholder("Select a rule to display its syntax diagram");
            } else {
                if(r.hasErrors() && r.needsToBuildErrors()) {
                    grammarEngine.computeRuleErrors(r);
                    try {
                        syntaxDiagramTab.createGraphsForRule(r);
                    } catch (Exception e) {
                        // ignore
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

    public GoToRule getGoToRule() {
        return goToRule;
    }

    public boolean goToRule(String ruleName) {
        ElementRule rule = editorRules.selectRuleNameInTree(ruleName);
        if(rule != null) {
            goToHistoryRememberCurrentPosition();
            editorRules.goToRule(rule);
            return true;
        }
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

        // Only display ideas using the mouse because otherwise when a rule
        // is deleted (for example), the idea might be displayed before
        // the parser was able to complete
        // display(e.getDot());
        ElementRule rule = editorRules.selectRuleInTreeAtPosition(index);
        if(rule == null || rule.name == null) {
            updateVisualization(false);
            lastSelectedRule = null;
            return;
        }
View Full Code Here

Examples of org.antlr.works.grammar.element.ElementRule

    }

    public void removeLeftRecursion() {
        StatisticsAW.shared().recordEvent(StatisticsAW.EVENT_REMOVE_LEFT_RECURSION);

        ElementRule rule = window.editorRules.getEnclosingRuleAtPosition(window.getCaretPosition());
        if(rule == null) {
            XJAlert.display(window.getJavaContainer(), "Remove Left Recursion", "There is no rule at cursor position.");
            return;
        }

        if(!rule.hasLeftRecursion()) {
            XJAlert.display(window.getJavaContainer(), "Remove Left Recursion", "The rule doesn't have a left recursion.");
            return;
        }

        beginRefactor("Remove Left Recursion");
        String ruleText = rule.getTextRuleAfterRemovingLeftRecursion();
        mutator.replace(rule.getInternalTokensStartIndex(), rule.getInternalTokensEndIndex(), ruleText);
        endRefactor();
    }
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.