private static Object inlineComment(LexerlessGrammarBuilder b) { return b.regexp("//[^\\n\\r]*+"); }
private static Object whitespace(LexerlessGrammarBuilder b) { return b.regexp("\\s*+"); }
private static Object javaIdentifier(LexerlessGrammarBuilder b) { return b.regexp("\\p{javaJavaIdentifierStart}++\\p{javaJavaIdentifierPart}*+"); }
private static Object javaIdentifierPart(LexerlessGrammarBuilder b) { return b.regexp("\\p{javaJavaIdentifierPart}"); }
private static Object multilineComment(LexerlessGrammarBuilder b) { return b.regexp("/\\*[\\s\\S]*?\\*\\/"); }
private static Object inlineComment(LexerlessGrammarBuilder b) { return b.regexp("//[^\\n\\r]*+"); }
private static Object javaIdentifierPart(LexerlessGrammarBuilder b) { return b.regexp("\\p{javaJavaIdentifierPart}"); }
private static Object matchCaseInsensitive(LexerlessGrammarBuilder b, String value) { return b.regexp("(?i)" + value); }
private static Object multilineComment(LexerlessGrammarBuilder b) { return b.regexp("/\\*[\\s\\S]*?\\*\\/"); }
private static Object javaIdentifierPart(LexerlessGrammarBuilder b) { return b.regexp("\\p{javaJavaIdentifierPart}"); }
private static Object whitespace(LexerlessGrammarBuilder b) { return b.regexp("\\s*+"); }
private static Object characterLiteral(LexerlessGrammarBuilder b) { return b.sequence(b.next("'"), b.regexp("'([^'\\\\]*+(\\\\[\\s\\S])?+)*+'")); }
private static Object stringLiteral(LexerlessGrammarBuilder b) { return b.sequence(b.next("\""), b.regexp("\"([^\"\\\\]*+(\\\\[\\s\\S])?+)*+\"")); }
private static Object stringLiteral(LexerlessGrammarBuilder b) { return b.sequence(b.next("\""), b.regexp("\"([^\"\\\\]*+(\\\\[\\s\\S])?+)*+\"")); }
private static Object characterLiteral(LexerlessGrammarBuilder b) { return b.sequence(b.next("'"), b.regexp("'([^'\\\\]*+(\\\\[\\s\\S])?+)*+'")); }
public static Grammar incorrectRegularExpression() { LexerlessGrammarBuilder b = LexerlessGrammarBuilder.create(); b.rule(A).is(b.regexp("*")); return b.build(); }
public static LexerlessGrammarBuilder createGrammarBuilder() { LexerlessGrammarBuilder b = LexerlessGrammarBuilder.create(); b.rule(IDENTIFIER_NAME).is( SPACING, b.regexp(EcmaScriptLexer.IDENTIFIER)); lexical(b); b.setRootRule(SCRIPT); return b; }
private static void functions(LexerlessGrammarBuilder b) { b.rule(spec).is(minus, b.firstOf(semiKeyword("spec", b), semiKeyword("callback", b)), b.zeroOrMore(b.firstOf(b.regexp("\\.(\\.+|.)"), b.regexp("[^\\.]")), spacing), dot); b.rule(typeSpec).is(minus, b.firstOf(semiKeyword("type", b), semiKeyword("opaque", b)), b.zeroOrMore(b.firstOf(b.regexp("\\.(\\.+|.)"), b.regexp("[^\\.]")), spacing), dot); b.rule(functionDeclaration).is(functionClause, b.zeroOrMore(semi, functionClause), dot); b.rule(functionClause).is(clauseHead, arrow, clauseBody); b.rule(clauseHead).is(funcDecl, b.optional(guardSequenceStart)); b.rule(clauseBody).is(statements); b.rule(funcArity).is(b.optional(literal, colon), literal, div, literal); b.rule(funcDecl).is(literal, arguments); }