/** * Eats up any whitespace and comments at the current position, * but only matches if there is at least one comment or whitespace character to gobble up. */ public Rule mandatoryWS() { return OneOrMore(FirstOf(comment(), whitespaceChar())).label("ws"); }
public Rule testLexBreak() { return TestNot(identifierPart()); }
/** * @see <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.4">JLS section 3.4</a> */ @SuppressSubnodes Rule whitespaceChar() { return FirstOf(Ch(' '), Ch('\t'), Ch('\f'), lineTerminator()); }
/** * Any comment (block, line, or javadoc) * * @see <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.7">JLS section 3.7</a> */ public Rule comment() { return Sequence( FirstOf(lineComment(), blockComment()), actions.logComment(lastText())); }
/** * Eats up any whitespace and comments at the current position. */ public Rule optWS() { return ZeroOrMore(FirstOf(comment(), whitespaceChar())).label("ws"); }
@SuppressSubnodes Rule blockComment() { return Sequence("/*", ZeroOrMore(Sequence(TestNot("*/"), Any())), "*/"); }
@SuppressSubnodes public Rule identifierRaw() { return Sequence(new JavaIdentifierStartMatcher(), ZeroOrMore(new JavaIdentifierPartMatcher())); }
/** * Any comment (block, line, or javadoc) * * @see <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.7">JLS section 3.7</a> */ public Rule comment() { return Sequence( FirstOf(lineComment(), blockComment()), actions.logComment(lastText())); }
/** * Eats up any whitespace and comments at the current position. */ public Rule optWS() { return ZeroOrMore(FirstOf(comment(), whitespaceChar())).label("ws"); }
@SuppressSubnodes Rule blockComment() { return Sequence("/*", ZeroOrMore(Sequence(TestNot("*/"), Any())), "*/"); }
/** * @see <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.4">JLS section 3.4</a> */ @SuppressSubnodes Rule whitespaceChar() { return FirstOf(Ch(' '), Ch('\t'), Ch('\f'), lineTerminator()); }
@SuppressSubnodes public Rule identifierRaw() { return Sequence(new JavaIdentifierStartMatcher(), ZeroOrMore(new JavaIdentifierPartMatcher())); }
public Rule testLexBreak() { return TestNot(identifierPart()); }