Search in sources :

Example 1 with ATESyntaxParser

use of org.antlr.works.ate.syntax.generic.ATESyntaxParser in project antlrworks by antlr.

the class GrammarPropertiesImpl method parsePropertiesString.

private static List<ATEToken> parsePropertiesString(final String content) {
    class ParseProperties extends ATESyntaxParser {

        public List<ATEToken> propertiesTokens;

        public void parseTokens() {
            propertiesTokens = new ArrayList<ATEToken>();
            while (nextToken()) {
                if (T(0).type == ATESyntaxLexer.TOKEN_ID) {
                    if (isChar(1, "=") || isChar(1, "\n"))
                        propertiesTokens.add(T(0));
                }
            }
        }
    }
    GrammarSyntaxLexer lexer = new GrammarSyntaxLexer();
    lexer.tokenize(content);
    ParseProperties parser = new ParseProperties();
    parser.parse(lexer.getTokens());
    return parser.propertiesTokens;
}
Also used : ATESyntaxParser(org.antlr.works.ate.syntax.generic.ATESyntaxParser) GrammarSyntaxLexer(org.antlr.works.grammar.syntax.GrammarSyntaxLexer) ATEToken(org.antlr.works.ate.syntax.misc.ATEToken)

Aggregations

ATESyntaxParser (org.antlr.works.ate.syntax.generic.ATESyntaxParser)1 ATEToken (org.antlr.works.ate.syntax.misc.ATEToken)1 GrammarSyntaxLexer (org.antlr.works.grammar.syntax.GrammarSyntaxLexer)1