Package org.antlr.works.ate.syntax.misc

Examples of org.antlr.works.ate.syntax.misc.ATEToken


            currentTemplateRule = null;
        }
    }

    private boolean tryMapDefinition() {
        ATEToken start = T(0);
        if(start == null) return false;

        String name = start.getAttribute();
        if(!matchID(0)) return false;

        // should be '::=' right after id
        if(isDEFINED_TO_BE(0)) {
            // When a defineToBe is matched, we are at the beginning of the content of the template map
            nextToken();
        } else {
            // Invalid template map matching
            return false;
        }

        final ATEToken definedToBeToken = T(-1);
        currentTemplateMap = new ElementTemplateMapDefinition(name, start, definedToBeToken, null);

        // loop through all new lines
        while (matchNewline(0));
View Full Code Here


    private boolean tryMatchKey() {
        if (matchID(0, "default")) return true;

        if (!isDOUBLE_QUOTE(0)) return false;

        ATEToken start = T(0);
        start.type = ATESyntaxLexer.TOKEN_DOUBLE_QUOTE_STRING;
        nextToken();

        while (true) {
            ATEToken t = T(0);
            if (isDOUBLE_QUOTE(0) || isNewline(0)) {
                t.type = ATESyntaxLexer.TOKEN_DOUBLE_QUOTE_STRING;
                nextToken();
                return true;
            }
View Full Code Here

        return getEndIndex()-getStartIndex();
    }

    public int getInternalTokensStartIndex() {
        for(Iterator<ATEToken> iter = getTokens().iterator(); iter.hasNext(); ) {
            ATEToken token = iter.next();
            if(token.type == ATEStringTemplateSyntaxLexer.TOKEN_DEFINED_TO_BE) {
                token = iter.next();
                return token.getStartIndex();
            }
        }
        return -1;
    }
View Full Code Here

        }
        return -1;
    }

    public int getInternalTokensEndIndex() {
        ATEToken token = parser.getTokens().get(end.index-1);
        return token.getEndIndex();
    }
View Full Code Here

        tokenize();
    }

    protected void tokenize() {
        while(nextCharacter()) {
            ATEToken token = customMatch();

            if(token != null) {
                // custom match matched something
            } else if(c0 == '\'')
                token = matchSingleQuoteString();
View Full Code Here

    }

    public ATEToken createNewToken(int type, int start, int end,
                                   int startLineNumber, int endLineNumber,
                                   int startLineIndex, int endLineIndex) {
        return new ATEToken(type, start, end, startLineNumber, endLineNumber, startLineIndex, endLineIndex, text);
    }
View Full Code Here

        int position = window.getTextPane().viewToModel(relativePoint);

        Point p = null;
        try {
            ATEToken token = window.getTokenAtPosition(position, false);
            if(token != null) {
                // Make sure the mouse is over the token because
                // Swing will return a valid position even if the mouse
                // is on the remaining blank part of the line
                Rectangle r1 = window.getTextPane().modelToView(token.getStartIndex());
                Rectangle r2 = window.getTextPane().modelToView(token.getEndIndex());
                if(r1.union(r2).contains(relativePoint)) {
                    p = SwingUtilities.convertPoint(window.getTextPane(), new Point(relativePoint.x+2, r2.y-5), window.getJavaContainer());
                }
            }
        } catch (BadLocationException e) {
View Full Code Here

    protected void discoverInvalidGrammarName(List<EditorInspectorItem> items) {
        ElementGrammarName n = getGrammarName();
        String grammarFileName = getGrammarNameFromFile();
        if(n != null && grammarFileName != null && !grammarFileName.equals(n.getName())) {
            ATEToken t = n.name;
            EditorInspectorItem item = new ItemInvalidGrammarName();
            item.setAttributes(t, t.getStartIndex(), t.getEndIndex(),
                    t.startLineNumber, Color.red,
                    "Invalid grammar name '"+t.getAttribute()+"'");
            items.add(item);
        }
    }
View Full Code Here

        public void ideaActionFire(IdeaAction action, int actionID) {
            switch(actionID) {
                case IDEA_FIX_GRAMMAR_NAME:
                    ElementGrammarName n = getGrammarName();
                    ATEToken name = n.name;
                    delegate.replaceText(name.start, name.end, getGrammarNameFromFile());
                    break;
            }
        }
View Full Code Here

                continue;

            for (ElementAction action : actions) {
                List<ATEToken> tokens = action.getTokens();
                for (int t = 0; t < tokens.size(); t++) {
                    ATEToken token = tokens.get(t);
                    /* the 'channel' token can be either an ID or a reference if a rule in the grammar has the name
                   'channel' */
                    if ((token.type == ATESyntaxLexer.TOKEN_ID || token.type == GrammarSyntaxLexer.TOKEN_REFERENCE)
                            && token.getAttribute().equals("channel") && t + 3 < tokens.size())
                    {
                        ATEToken t1 = tokens.get(t + 1);
                        ATEToken t2 = tokens.get(t + 2);
                        if (t1.type != ATESyntaxLexer.TOKEN_CHAR || !t1.getAttribute().equals("="))
                            continue;

                        if (t2.type != ATESyntaxLexer.TOKEN_ID || !t2.getAttribute().equals("HIDDEN"))
                            continue;

                        rule.ignored = true;
                        break;
                    }
View Full Code Here

TOP

Related Classes of org.antlr.works.ate.syntax.misc.ATEToken

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.