java-parser
Advanced tools
Comparing version 2.3.0 to 2.3.1
{ | ||
"name": "java-parser", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "Java Parser in JavaScript", | ||
"type": "module", | ||
"exports": "./src/index.js", | ||
"exports": { | ||
".": { | ||
"types": "./api.d.ts", | ||
"default": "./src/index.js" | ||
} | ||
}, | ||
"repository": "https://github.com/jhipster/prettier-java/tree/main/packages/java-parser", | ||
@@ -20,3 +25,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "30e1cad12e8936df43c25eeb9dad5aef20d9af6c" | ||
"gitHead": "8ee70accfbc3eecd5fb1c5da430701ca4765c994" | ||
} |
import { tokenMatcher } from "chevrotain"; | ||
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-10.html#jls-ArrayInitializer | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-10.html#jls-ArrayInitializer | ||
$.RULE("arrayInitializer", () => { | ||
@@ -16,3 +16,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-10.html#jls-VariableInitializerList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-10.html#jls-VariableInitializerList | ||
$.RULE("variableInitializerList", () => { | ||
@@ -19,0 +19,0 @@ $.SUBRULE($.variableInitializer); |
@@ -7,3 +7,3 @@ import { tokenMatcher } from "chevrotain"; | ||
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Block | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Block | ||
$.RULE("block", () => { | ||
@@ -17,3 +17,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BlockStatements | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-BlockStatements | ||
$.RULE("blockStatements", () => { | ||
@@ -26,3 +26,3 @@ $.SUBRULE($.blockStatement); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BlockStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-BlockStatement | ||
$.RULE("blockStatement", () => { | ||
@@ -40,3 +40,3 @@ $.OR({ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LocalVariableDeclarationStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-LocalVariableDeclarationStatement | ||
$.RULE("localVariableDeclarationStatement", () => { | ||
@@ -47,3 +47,3 @@ $.SUBRULE($.localVariableDeclaration); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LocalVariableDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-LocalVariableDeclaration | ||
$.RULE("localVariableDeclaration", () => { | ||
@@ -57,3 +57,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LocalVariableType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-LocalVariableType | ||
$.RULE("localVariableType", () => { | ||
@@ -69,3 +69,3 @@ $.OR({ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Statement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Statement | ||
$.RULE("statement", () => { | ||
@@ -82,3 +82,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-StatementWithoutTrailingSubstatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-StatementWithoutTrailingSubstatement | ||
$.RULE("statementWithoutTrailingSubstatement", () => { | ||
@@ -108,3 +108,3 @@ $.OR({ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-EmptyStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-EmptyStatement | ||
$.RULE("emptyStatement", () => { | ||
@@ -114,3 +114,3 @@ $.CONSUME(t.Semicolon); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LabeledStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-LabeledStatement | ||
$.RULE("labeledStatement", () => { | ||
@@ -122,3 +122,3 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ExpressionStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ExpressionStatement | ||
$.RULE("expressionStatement", () => { | ||
@@ -129,3 +129,3 @@ $.SUBRULE($.statementExpression); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-StatementExpression | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-StatementExpression | ||
$.RULE("statementExpression", () => { | ||
@@ -141,4 +141,4 @@ // Spec deviation: The many alternatives here were replaced with | ||
// Spec deviation: combined "IfThenStatement" and "IfThenElseStatement" | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-IfThenStatement | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-IfThenElseStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-IfThenStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-IfThenElseStatement | ||
$.RULE("ifStatement", () => { | ||
@@ -156,3 +156,3 @@ $.CONSUME(t.If); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-AssertStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-AssertStatement | ||
$.RULE("assertStatement", () => { | ||
@@ -168,3 +168,3 @@ $.CONSUME(t.Assert); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-SwitchStatement | ||
$.RULE("switchStatement", () => { | ||
@@ -178,8 +178,13 @@ $.CONSUME(t.Switch); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchBlock | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-SwitchBlock | ||
$.RULE("switchBlock", () => { | ||
$.CONSUME(t.LCurly); | ||
$.OR([ | ||
{ ALT: () => $.MANY(() => $.SUBRULE($.switchBlockStatementGroup)) }, | ||
{ ALT: () => $.MANY2(() => $.SUBRULE($.switchRule)) } | ||
{ | ||
ALT: () => { | ||
$.SUBRULE($.switchRule); | ||
$.MANY(() => $.SUBRULE2($.switchRule)); | ||
} | ||
}, | ||
{ ALT: () => $.MANY2(() => $.SUBRULE($.switchBlockStatementGroup)) } | ||
]); | ||
@@ -189,2 +194,3 @@ $.CONSUME(t.RCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-SwitchBlockStatementGroup | ||
$.RULE("switchBlockStatementGroup", () => { | ||
@@ -198,3 +204,3 @@ $.SUBRULE($.switchLabel); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-SwitchLabel | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-SwitchLabel | ||
$.RULE("switchLabel", () => { | ||
@@ -217,6 +223,6 @@ $.OR([ | ||
ALT: () => { | ||
$.SUBRULE($.pattern); | ||
$.SUBRULE($.casePattern); | ||
$.MANY(() => { | ||
$.CONSUME(t.Comma); | ||
$.SUBRULE2($.pattern); | ||
$.SUBRULE2($.casePattern); | ||
}); | ||
@@ -245,3 +251,3 @@ $.OPTION(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchRule | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-SwitchRule | ||
$.RULE("switchRule", () => { | ||
@@ -262,8 +268,13 @@ $.SUBRULE($.switchLabel); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-EnumConstantName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-CaseConstant | ||
$.RULE("caseConstant", () => { | ||
$.SUBRULE($.ternaryExpression); | ||
$.SUBRULE($.conditionalExpression); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-WhileStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-CasePattern | ||
$.RULE("casePattern", () => { | ||
$.SUBRULE($.pattern); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-WhileStatement | ||
$.RULE("whileStatement", () => { | ||
@@ -277,3 +288,3 @@ $.CONSUME(t.While); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-DoStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-DoStatement | ||
$.RULE("doStatement", () => { | ||
@@ -288,3 +299,4 @@ $.CONSUME(t.Do); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ForStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ForStatement | ||
$.RULE("forStatement", () => { | ||
@@ -297,3 +309,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BasicForStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-BasicForStatement | ||
$.RULE("basicForStatement", () => { | ||
@@ -317,3 +329,3 @@ $.CONSUME(t.For); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ForInit | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ForInit | ||
$.RULE("forInit", () => { | ||
@@ -326,3 +338,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ForUpdate | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ForUpdate | ||
$.RULE("forUpdate", () => { | ||
@@ -332,3 +344,3 @@ $.SUBRULE($.statementExpressionList); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-StatementExpressionList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-StatementExpressionList | ||
$.RULE("statementExpressionList", () => { | ||
@@ -342,11 +354,7 @@ $.SUBRULE($.statementExpression); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-EnhancedForStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-EnhancedForStatement | ||
$.RULE("enhancedForStatement", () => { | ||
$.CONSUME(t.For); | ||
$.CONSUME(t.LBrace); | ||
$.MANY(() => { | ||
$.SUBRULE($.variableModifier); | ||
}); | ||
$.SUBRULE($.localVariableType); | ||
$.SUBRULE($.variableDeclaratorId); | ||
$.SUBRULE($.localVariableDeclaration); | ||
$.CONSUME(t.Colon); | ||
@@ -358,3 +366,3 @@ $.SUBRULE($.expression); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BreakStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-BreakStatement | ||
$.RULE("breakStatement", () => { | ||
@@ -368,3 +376,3 @@ $.CONSUME(t.Break); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ContinueStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ContinueStatement | ||
$.RULE("continueStatement", () => { | ||
@@ -378,3 +386,3 @@ $.CONSUME(t.Continue); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ReturnStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ReturnStatement | ||
$.RULE("returnStatement", () => { | ||
@@ -388,3 +396,3 @@ $.CONSUME(t.Return); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ThrowStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ThrowStatement | ||
$.RULE("throwStatement", () => { | ||
@@ -396,3 +404,3 @@ $.CONSUME(t.Throw); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SynchronizedStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-SynchronizedStatement | ||
$.RULE("synchronizedStatement", () => { | ||
@@ -406,3 +414,3 @@ $.CONSUME(t.Synchronized); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-TryStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-TryStatement | ||
$.RULE("tryStatement", () => { | ||
@@ -431,3 +439,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Catches | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Catches | ||
$.RULE("catches", () => { | ||
@@ -440,3 +448,3 @@ $.SUBRULE($.catchClause); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-CatchClause | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-CatchClause | ||
$.RULE("catchClause", () => { | ||
@@ -450,3 +458,3 @@ $.CONSUME(t.Catch); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-CatchFormalParameter | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-CatchFormalParameter | ||
$.RULE("catchFormalParameter", () => { | ||
@@ -460,3 +468,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-CatchType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-CatchType | ||
$.RULE("catchType", () => { | ||
@@ -470,3 +478,3 @@ $.SUBRULE($.unannClassType); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Finally | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Finally | ||
$.RULE("finally", () => { | ||
@@ -477,3 +485,3 @@ $.CONSUME(t.Finally); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-TryWithResourcesStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-TryWithResourcesStatement | ||
$.RULE("tryWithResourcesStatement", () => { | ||
@@ -491,3 +499,3 @@ $.CONSUME(t.Try); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ResourceSpecification | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ResourceSpecification | ||
$.RULE("resourceSpecification", () => { | ||
@@ -502,3 +510,3 @@ $.CONSUME(t.LBrace); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ResourceList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ResourceList | ||
$.RULE("resourceList", () => { | ||
@@ -515,3 +523,3 @@ $.SUBRULE($.resource); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-Resource | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Resource | ||
$.RULE("resource", () => { | ||
@@ -524,3 +532,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-YieldStatement | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-YieldStatement | ||
$.RULE("yieldStatement", () => { | ||
@@ -532,3 +540,3 @@ $.CONSUME(t.Yield); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-VariableAccess | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-VariableAccess | ||
$.RULE("variableAccess", () => { | ||
@@ -535,0 +543,0 @@ // Spec Deviation: both "expressionName" and "fieldAccess" can be parsed |
import { tokenMatcher } from "chevrotain"; | ||
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassDeclaration | ||
$.RULE("classDeclaration", () => { | ||
@@ -19,3 +19,3 @@ // Spec Deviation: extracted common "{classModifier}" prefix | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-NormalClassDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-NormalClassDeclaration | ||
$.RULE("normalClassDeclaration", () => { | ||
@@ -29,6 +29,6 @@ // Spec Deviation: extracted common "{classModifier}" to "classDeclaration" | ||
$.OPTION2(() => { | ||
$.SUBRULE($.superclass); | ||
$.SUBRULE($.classExtends); | ||
}); | ||
$.OPTION3(() => { | ||
$.SUBRULE($.superinterfaces); | ||
$.SUBRULE($.classImplements); | ||
}); | ||
@@ -41,3 +41,3 @@ $.OPTION4(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassModifier | ||
$.RULE("classModifier", () => { | ||
@@ -58,3 +58,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-TypeParameters | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-TypeParameters | ||
$.RULE("typeParameters", () => { | ||
@@ -66,3 +66,3 @@ $.CONSUME(t.Less); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-TypeParameterList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-TypeParameterList | ||
$.RULE("typeParameterList", () => { | ||
@@ -76,4 +76,4 @@ $.SUBRULE($.typeParameter); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassExtends | ||
$.RULE("superclass", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassExtends | ||
$.RULE("classExtends", () => { | ||
$.CONSUME(t.Extends); | ||
@@ -83,4 +83,4 @@ $.SUBRULE($.classType); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassImplements | ||
$.RULE("superinterfaces", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassImplements | ||
$.RULE("classImplements", () => { | ||
$.CONSUME(t.Implements); | ||
@@ -90,3 +90,3 @@ $.SUBRULE($.interfaceTypeList); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-InterfaceTypeList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-InterfaceTypeList | ||
$.RULE("interfaceTypeList", () => { | ||
@@ -100,3 +100,3 @@ $.SUBRULE($.interfaceType); | ||
// https://docs.oracle.com/javase/specs/jls/se16/preview/specs/sealed-classes-jls.html | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassPermits | ||
$.RULE("classPermits", () => { | ||
@@ -111,3 +111,3 @@ $.CONSUME(t.Permits); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassBody | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassBody | ||
$.RULE("classBody", () => { | ||
@@ -121,3 +121,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassBodyDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassBodyDeclaration | ||
$.RULE("classBodyDeclaration", () => { | ||
@@ -132,3 +132,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ClassMemberDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ClassMemberDeclaration | ||
$.RULE("classMemberDeclaration", () => { | ||
@@ -144,3 +144,3 @@ $.OR([ | ||
// // https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-FieldDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-FieldDeclaration | ||
$.RULE("fieldDeclaration", () => { | ||
@@ -155,3 +155,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-FieldModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-FieldModifier | ||
$.RULE("fieldModifier", () => { | ||
@@ -170,3 +170,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-VariableDeclaratorList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableDeclaratorList | ||
$.RULE("variableDeclaratorList", () => { | ||
@@ -176,3 +176,5 @@ $.SUBRULE($.variableDeclarator); | ||
// required to distinguish from patternList | ||
GATE: () => !tokenMatcher(this.LA(3).tokenType, t.Identifier), | ||
GATE: () => | ||
!tokenMatcher(this.LA(3), t.Identifier) && | ||
!tokenMatcher(this.LA(3), t.Underscore), | ||
DEF: () => { | ||
@@ -185,3 +187,3 @@ $.CONSUME(t.Comma); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-VariableDeclarator | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableDeclarator | ||
$.RULE("variableDeclarator", () => { | ||
@@ -195,3 +197,3 @@ $.SUBRULE($.variableDeclaratorId); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-VariableDeclaratorId | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableDeclaratorId | ||
$.RULE("variableDeclaratorId", () => { | ||
@@ -211,3 +213,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-VariableInitializer | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableInitializer | ||
$.RULE("variableInitializer", () => { | ||
@@ -220,3 +222,3 @@ $.OR([ | ||
// // https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-UnannType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-UnannType | ||
$.RULE("unannType", () => { | ||
@@ -239,3 +241,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-UnannPrimitiveType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-UnannPrimitiveType | ||
$.RULE("unannPrimitiveType", () => { | ||
@@ -248,3 +250,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-UnannReferenceType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-UnannReferenceType | ||
$.RULE("unannReferenceType", () => { | ||
@@ -258,3 +260,2 @@ $.SUBRULE($.unannClassOrInterfaceType); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-UnannClassType | ||
$.RULE("unannClassOrInterfaceType", () => { | ||
@@ -267,2 +268,3 @@ // Spec Deviation: The spec says: "UnannClassType | UnannInterfaceType" but "UnannInterfaceType" | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-UnannClassType | ||
$.RULE("unannClassType", () => { | ||
@@ -287,3 +289,3 @@ // Spec Deviation: Refactored left recursion and alternation to iterations | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-UnannInterfaceType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-UnannInterfaceType | ||
$.RULE("unannInterfaceType", () => { | ||
@@ -293,2 +295,3 @@ $.SUBRULE($.unannClassType); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-UnannTypeVariable | ||
$.RULE("unannTypeVariable", () => { | ||
@@ -300,3 +303,3 @@ // TODO: Semantic Check: This Identifier cannot be "var" | ||
// // https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-MethodDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-MethodDeclaration | ||
$.RULE("methodDeclaration", () => { | ||
@@ -310,3 +313,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-MethodModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-MethodModifier | ||
$.RULE("methodModifier", () => { | ||
@@ -327,3 +330,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-MethodHeader | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-MethodHeader | ||
$.RULE("methodHeader", () => { | ||
@@ -344,3 +347,3 @@ // Spec Deviation: extracted common prefix from both alternatives | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-Result | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-Result | ||
$.RULE("result", () => { | ||
@@ -353,3 +356,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-8.html#jls-MethodDeclarator | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-MethodDeclarator | ||
$.RULE("methodDeclarator", () => { | ||
@@ -376,3 +379,3 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ReceiverParameter | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ReceiverParameter | ||
$.RULE("receiverParameter", () => { | ||
@@ -390,3 +393,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-FormalParameterList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-FormalParameterList | ||
$.RULE("formalParameterList", () => { | ||
@@ -400,3 +403,3 @@ $.SUBRULE($.formalParameter); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-FormalParameter | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-FormalParameter | ||
$.RULE("formalParameter", () => { | ||
@@ -419,3 +422,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-VariableArityParameter | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableArityParameter | ||
$.RULE("variableArityParameter", () => { | ||
@@ -433,3 +436,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-VariableModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableModifier | ||
$.RULE("variableModifier", () => { | ||
@@ -442,3 +445,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-Throws | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-Throws | ||
$.RULE("throws", () => { | ||
@@ -449,3 +452,3 @@ $.CONSUME(t.Throws); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ExceptionTypeList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ExceptionTypeList | ||
$.RULE("exceptionTypeList", () => { | ||
@@ -459,3 +462,3 @@ $.SUBRULE($.exceptionType); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ExceptionType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ExceptionType | ||
$.RULE("exceptionType", () => { | ||
@@ -467,3 +470,3 @@ // Spec Deviation: "typeVariable" alternative is missing because | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-MethodBody | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-MethodBody | ||
$.RULE("methodBody", () => { | ||
@@ -476,3 +479,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-InstanceInitializer | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-InstanceInitializer | ||
$.RULE("instanceInitializer", () => { | ||
@@ -482,3 +485,3 @@ $.SUBRULE($.block); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-StaticInitializer | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-StaticInitializer | ||
$.RULE("staticInitializer", () => { | ||
@@ -489,3 +492,3 @@ $.CONSUME(t.Static); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ConstructorDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ConstructorDeclaration | ||
$.RULE("constructorDeclaration", () => { | ||
@@ -502,3 +505,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ConstructorModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ConstructorModifier | ||
$.RULE("constructorModifier", () => { | ||
@@ -513,3 +516,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ConstructorDeclarator | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ConstructorDeclarator | ||
$.RULE("constructorDeclarator", () => { | ||
@@ -536,9 +539,9 @@ $.OPTION(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-SimpleTypeName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-SimpleTypeName | ||
$.RULE("simpleTypeName", () => { | ||
// TODO: implement: Identifier but not var | ||
$.CONSUME(t.Identifier); | ||
$.SUBRULE($.typeIdentifier); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ConstructorBody | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ConstructorBody | ||
$.RULE("constructorBody", () => { | ||
@@ -555,9 +558,7 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-ExplicitConstructorInvocation | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-ExplicitConstructorInvocation | ||
$.RULE("explicitConstructorInvocation", () => { | ||
// Spec Deviation: split into two separate sub rules. | ||
$.OR([ | ||
{ | ||
ALT: () => $.SUBRULE($.unqualifiedExplicitConstructorInvocation) | ||
}, | ||
{ ALT: () => $.SUBRULE($.unqualifiedExplicitConstructorInvocation) }, | ||
{ ALT: () => $.SUBRULE($.qualifiedExplicitConstructorInvocation) } | ||
@@ -610,3 +611,3 @@ ]); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-EnumDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-EnumDeclaration | ||
$.RULE("enumDeclaration", () => { | ||
@@ -619,3 +620,3 @@ $.MANY(() => { | ||
$.OPTION(() => { | ||
$.SUBRULE($.superinterfaces); | ||
$.SUBRULE($.classImplements); | ||
}); | ||
@@ -625,3 +626,3 @@ $.SUBRULE($.enumBody); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-EnumBody | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-EnumBody | ||
$.RULE("enumBody", () => { | ||
@@ -641,3 +642,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-EnumConstantList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-EnumConstantList | ||
$.RULE("enumConstantList", () => { | ||
@@ -659,3 +660,3 @@ $.SUBRULE($.enumConstant); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-EnumConstant | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-EnumConstant | ||
$.RULE("enumConstant", () => { | ||
@@ -678,3 +679,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-EnumConstantModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-EnumConstantModifier | ||
$.RULE("enumConstantModifier", () => { | ||
@@ -684,3 +685,3 @@ $.SUBRULE($.annotation); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-EnumBodyDeclarations | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-EnumBodyDeclarations | ||
$.RULE("enumBodyDeclarations", () => { | ||
@@ -693,3 +694,3 @@ $.CONSUME(t.Semicolon); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-RecordHeader | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordHeader | ||
$.RULE("recordDeclaration", () => { | ||
@@ -703,3 +704,3 @@ $.CONSUME(t.Record); | ||
$.OPTION2(() => { | ||
$.SUBRULE($.superinterfaces); | ||
$.SUBRULE($.classImplements); | ||
}); | ||
@@ -709,2 +710,3 @@ $.SUBRULE($.recordBody); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordHeader | ||
$.RULE("recordHeader", () => { | ||
@@ -718,3 +720,3 @@ $.CONSUME(t.LBrace); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-RecordComponentList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordComponentList | ||
$.RULE("recordComponentList", () => { | ||
@@ -728,3 +730,3 @@ $.SUBRULE($.recordComponent); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-RecordComponent | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordComponent | ||
$.RULE("recordComponent", () => { | ||
@@ -744,3 +746,3 @@ // Spec Deviation: extracted common "{recordComponentModifier} unannType" prefix | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-VariableArityRecordComponent | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-VariableArityRecordComponent | ||
// Spec Deviation: common "{recordComponentModifier} unannType" prefix was extracted in "recordComponent" | ||
@@ -755,3 +757,3 @@ $.RULE("variableArityRecordComponent", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-RecordComponentModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordComponentModifier | ||
$.RULE("recordComponentModifier", () => { | ||
@@ -761,3 +763,3 @@ $.SUBRULE($.annotation); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-RecordBody | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordBody | ||
$.RULE("recordBody", () => { | ||
@@ -771,3 +773,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-RecordBodyDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-RecordBodyDeclaration | ||
$.RULE("recordBodyDeclaration", () => { | ||
@@ -780,3 +782,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-8.html#jls-CompactConstructorDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-8.html#jls-CompactConstructorDeclaration | ||
$.RULE("compactConstructorDeclaration", () => { | ||
@@ -783,0 +785,0 @@ $.MANY(() => { |
import { tokenMatcher } from "chevrotain"; | ||
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-Expression | ||
$.RULE("expression", () => { | ||
$.OR([ | ||
{ ALT: () => $.SUBRULE($.lambdaExpression) }, | ||
{ ALT: () => $.SUBRULE($.ternaryExpression) } | ||
{ ALT: () => $.SUBRULE($.conditionalExpression) } | ||
]); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-LambdaExpression | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-LambdaExpression | ||
$.RULE("lambdaExpression", () => { | ||
@@ -17,2 +18,3 @@ $.SUBRULE($.lambdaParameters); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-LambdaParameters | ||
$.RULE("lambdaParameters", () => { | ||
@@ -34,2 +36,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-LambdaParameterList | ||
$.RULE("lambdaParameterList", () => { | ||
@@ -42,3 +45,4 @@ $.OR([ | ||
return ( | ||
tokenMatcher(nextTokType, t.Identifier) && | ||
(tokenMatcher(nextTokType, t.Identifier) || | ||
tokenMatcher(nextTokType, t.Underscore)) && | ||
(tokenMatcher(nextNextTokType, t.RBrace) || | ||
@@ -48,25 +52,26 @@ tokenMatcher(nextNextTokType, t.Comma)) | ||
}, | ||
ALT: () => $.SUBRULE($.inferredLambdaParameterList) | ||
ALT: () => $.SUBRULE($.conciseLambdaParameterList) | ||
}, | ||
{ ALT: () => $.SUBRULE($.explicitLambdaParameterList) } | ||
{ ALT: () => $.SUBRULE($.normalLambdaParameterList) } | ||
]); | ||
}); | ||
$.RULE("inferredLambdaParameterList", () => { | ||
$.CONSUME(t.Identifier); | ||
$.RULE("conciseLambdaParameterList", () => { | ||
$.SUBRULE($.conciseLambdaParameter); | ||
$.MANY(() => { | ||
$.CONSUME(t.Comma); | ||
$.CONSUME2(t.Identifier); | ||
$.SUBRULE2($.conciseLambdaParameter); | ||
}); | ||
}); | ||
$.RULE("explicitLambdaParameterList", () => { | ||
$.SUBRULE($.lambdaParameter); | ||
$.RULE("normalLambdaParameterList", () => { | ||
$.SUBRULE($.normalLambdaParameter); | ||
$.MANY(() => { | ||
$.CONSUME(t.Comma); | ||
$.SUBRULE2($.lambdaParameter); | ||
$.SUBRULE2($.normalLambdaParameter); | ||
}); | ||
}); | ||
$.RULE("lambdaParameter", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-NormalLambdaParameter | ||
$.RULE("normalLambdaParameter", () => { | ||
$.OR([ | ||
@@ -86,2 +91,3 @@ { ALT: () => $.SUBRULE($.regularLambdaParameter) }, | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-LambdaParameterType | ||
$.RULE("lambdaParameterType", () => { | ||
@@ -97,2 +103,11 @@ $.OR({ | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ConciseLambdaParameter | ||
$.RULE("conciseLambdaParameter", () => { | ||
$.OR([ | ||
{ ALT: () => $.CONSUME(t.Identifier) }, | ||
{ ALT: () => $.CONSUME(t.Underscore) } | ||
]); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-LambdaBody | ||
$.RULE("lambdaBody", () => { | ||
@@ -105,3 +120,4 @@ $.OR([ | ||
$.RULE("ternaryExpression", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ConditionalExpression | ||
$.RULE("conditionalExpression", () => { | ||
$.SUBRULE($.binaryExpression); | ||
@@ -183,2 +199,3 @@ $.OPTION(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-UnaryExpression | ||
$.RULE("unaryExpression", () => { | ||
@@ -194,2 +211,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-UnaryExpressionNotPlusMinus | ||
$.RULE("unaryExpressionNotPlusMinus", () => { | ||
@@ -205,2 +223,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-Primary | ||
$.RULE("primary", () => { | ||
@@ -351,2 +370,3 @@ $.SUBRULE($.primaryPrefix); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-CastExpression | ||
$.RULE("castExpression", () => { | ||
@@ -386,3 +406,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-UnqualifiedClassInstanceCreationExpression | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-UnqualifiedClassInstanceCreationExpression | ||
$.RULE("unqualifiedClassInstanceCreationExpression", () => { | ||
@@ -404,2 +424,3 @@ $.CONSUME(t.New); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ClassOrInterfaceTypeToInstantiate | ||
$.RULE("classOrInterfaceTypeToInstantiate", () => { | ||
@@ -422,2 +443,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-TypeArgumentsOrDiamond | ||
$.RULE("typeArgumentsOrDiamond", () => { | ||
@@ -435,2 +457,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-MethodInvocation | ||
$.RULE("methodInvocationSuffix", () => { | ||
@@ -444,2 +467,3 @@ $.CONSUME(t.LBrace); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ArgumentList | ||
$.RULE("argumentList", () => { | ||
@@ -453,3 +477,3 @@ $.SUBRULE($.expression); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-15.10.1 | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ArrayCreationExpression | ||
$.RULE("arrayCreationExpression", () => { | ||
@@ -463,8 +487,11 @@ $.CONSUME(t.New); | ||
$.OR2([ | ||
{ ALT: () => $.SUBRULE($.arrayCreationDefaultInitSuffix) }, | ||
{ ALT: () => $.SUBRULE($.arrayCreationExplicitInitSuffix) } | ||
{ | ||
ALT: () => $.SUBRULE($.arrayCreationExpressionWithoutInitializerSuffix) | ||
}, | ||
{ ALT: () => $.SUBRULE($.arrayCreationWithInitializerSuffix) } | ||
]); | ||
}); | ||
$.RULE("arrayCreationDefaultInitSuffix", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ArrayCreationExpressionWithoutInitializer | ||
$.RULE("arrayCreationExpressionWithoutInitializerSuffix", () => { | ||
$.SUBRULE($.dimExprs); | ||
@@ -476,3 +503,4 @@ $.OPTION(() => { | ||
$.RULE("arrayCreationExplicitInitSuffix", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ArrayCreationExpressionWithInitializer | ||
$.RULE("arrayCreationWithInitializerSuffix", () => { | ||
$.SUBRULE($.dims); | ||
@@ -482,3 +510,3 @@ $.SUBRULE($.arrayInitializer); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-DimExprs | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-DimExprs | ||
$.RULE("dimExprs", () => { | ||
@@ -496,3 +524,3 @@ $.SUBRULE($.dimExpr); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-15.html#jls-DimExpr | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-DimExpr | ||
$.RULE("dimExpr", () => { | ||
@@ -507,2 +535,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ClassLiteral | ||
$.RULE("classLiteralSuffix", () => { | ||
@@ -517,2 +546,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-ArrayAccess | ||
$.RULE("arrayAccessSuffix", () => { | ||
@@ -524,2 +554,3 @@ $.CONSUME(t.LSquare); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-15.html#jls-MethodReference | ||
$.RULE("methodReferenceSuffix", () => { | ||
@@ -581,3 +612,3 @@ $.CONSUME(t.ColonColon); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-Pattern | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Pattern | ||
$.RULE("pattern", () => { | ||
@@ -590,3 +621,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-TypePattern | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-TypePattern | ||
$.RULE("typePattern", () => { | ||
@@ -596,3 +627,3 @@ $.SUBRULE($.localVariableDeclaration); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-RecordPattern | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-RecordPattern | ||
$.RULE("recordPattern", () => { | ||
@@ -607,3 +638,3 @@ $.SUBRULE($.referenceType); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-PatternList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ComponentPatternList | ||
$.RULE("componentPatternList", () => { | ||
@@ -617,14 +648,16 @@ $.SUBRULE($.componentPattern); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-ComponentPattern | ||
$.RULE("componentPattern", () => { | ||
$.OR([ | ||
{ ALT: () => $.SUBRULE($.pattern) }, | ||
{ ALT: () => $.SUBRULE($.unnamedPattern) } | ||
{ ALT: () => $.SUBRULE($.matchAllPattern) } | ||
]); | ||
}); | ||
$.RULE("unnamedPattern", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-MatchAllPattern | ||
$.RULE("matchAllPattern", () => { | ||
$.CONSUME(t.Underscore); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se21/html/jls-14.html#jls-Guard | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-14.html#jls-Guard | ||
$.RULE("guard", () => { | ||
@@ -631,0 +664,0 @@ $.CONSUME(t.When); |
import { tokenMatcher } from "chevrotain"; | ||
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceDeclaration | ||
$.RULE("interfaceDeclaration", () => { | ||
@@ -13,7 +13,7 @@ // Spec Deviation: extracted the common "interfaceModifier" prefix to avoid backtracking. | ||
{ ALT: () => $.SUBRULE($.normalInterfaceDeclaration) }, | ||
{ ALT: () => $.SUBRULE($.annotationTypeDeclaration) } | ||
{ ALT: () => $.SUBRULE($.annotationInterfaceDeclaration) } | ||
]); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-NormalInterfaceDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-NormalInterfaceDeclaration | ||
$.RULE("normalInterfaceDeclaration", () => { | ||
@@ -27,3 +27,3 @@ // Spec Deviation: The "interfaceModifier" prefix was extracted to the "interfaceDeclaration" | ||
$.OPTION2(() => { | ||
$.SUBRULE($.extendsInterfaces); | ||
$.SUBRULE($.interfaceExtends); | ||
}); | ||
@@ -36,3 +36,3 @@ $.OPTION3(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceModifier | ||
$.RULE("interfaceModifier", () => { | ||
@@ -52,4 +52,4 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceExtends | ||
$.RULE("extendsInterfaces", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceExtends | ||
$.RULE("interfaceExtends", () => { | ||
$.CONSUME(t.Extends); | ||
@@ -59,3 +59,3 @@ $.SUBRULE($.interfaceTypeList); | ||
// https://docs.oracle.com/javase/specs/jls/se16/preview/specs/sealed-classes-jls.html | ||
// https://docs.oracle.com/javase/specs/jls/se22/preview/specs/sealed-classes-jls.html | ||
$.RULE("interfacePermits", () => { | ||
@@ -70,3 +70,3 @@ $.CONSUME(t.Permits); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceBody | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceBody | ||
$.RULE("interfaceBody", () => { | ||
@@ -80,3 +80,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceMemberDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceMemberDeclaration | ||
$.RULE("interfaceMemberDeclaration", () => { | ||
@@ -92,3 +92,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-ConstantDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ConstantDeclaration | ||
$.RULE("constantDeclaration", () => { | ||
@@ -103,3 +103,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-ConstantModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ConstantModifier | ||
$.RULE("constantModifier", () => { | ||
@@ -114,3 +114,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceMethodDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceMethodDeclaration | ||
$.RULE("interfaceMethodDeclaration", () => { | ||
@@ -124,3 +124,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceMethodModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-InterfaceMethodModifier | ||
$.RULE("interfaceMethodModifier", () => { | ||
@@ -138,4 +138,4 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-AnnotationTypeDeclaration | ||
$.RULE("annotationTypeDeclaration", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-AnnotationInterfaceDeclaration | ||
$.RULE("annotationInterfaceDeclaration", () => { | ||
// Spec Deviation: The "interfaceModifier" prefix was extracted to the "interfaceDeclaration" | ||
@@ -145,10 +145,10 @@ $.CONSUME(t.At); | ||
$.SUBRULE($.typeIdentifier); | ||
$.SUBRULE($.annotationTypeBody); | ||
$.SUBRULE($.annotationInterfaceBody); | ||
}); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-AnnotationTypeBody | ||
$.RULE("annotationTypeBody", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-AnnotationInterfaceBody | ||
$.RULE("annotationInterfaceBody", () => { | ||
$.CONSUME(t.LCurly); | ||
$.MANY(() => { | ||
$.SUBRULE($.annotationTypeMemberDeclaration); | ||
$.SUBRULE($.annotationInterfaceMemberDeclaration); | ||
}); | ||
@@ -158,6 +158,6 @@ $.CONSUME(t.RCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-InterfaceMemberDeclaration | ||
$.RULE("annotationTypeMemberDeclaration", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-AnnotationInterfaceMemberDeclaration | ||
$.RULE("annotationInterfaceMemberDeclaration", () => { | ||
$.OR([ | ||
{ ALT: () => $.SUBRULE($.annotationTypeElementDeclaration) }, | ||
{ ALT: () => $.SUBRULE($.annotationInterfaceElementDeclaration) }, | ||
{ ALT: () => $.SUBRULE($.constantDeclaration) }, | ||
@@ -170,6 +170,6 @@ { ALT: () => $.SUBRULE($.classDeclaration) }, | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-AnnotationTypeElementDeclaration | ||
$.RULE("annotationTypeElementDeclaration", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-AnnotationInterfaceElementDeclaration | ||
$.RULE("annotationInterfaceElementDeclaration", () => { | ||
$.MANY(() => { | ||
$.SUBRULE($.annotationTypeElementModifier); | ||
$.SUBRULE($.annotationInterfaceElementModifier); | ||
}); | ||
@@ -189,4 +189,4 @@ $.SUBRULE($.unannType); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-AnnotationTypeElementModifier | ||
$.RULE("annotationTypeElementModifier", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-AnnotationInterfaceElementModifier | ||
$.RULE("annotationInterfaceElementModifier", () => { | ||
$.OR([ | ||
@@ -199,3 +199,3 @@ { ALT: () => $.SUBRULE($.annotation) }, | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-DefaultValue | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-DefaultValue | ||
$.RULE("defaultValue", () => { | ||
@@ -206,3 +206,3 @@ $.CONSUME(t.Default); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-Annotation | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-Annotation | ||
$.RULE("annotation", () => { | ||
@@ -215,3 +215,3 @@ // Spec Deviation: The common prefix for all three annotation types was extracted to this rule. | ||
// If this optional grammar was not invoked we have a markerAnnotation | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-MarkerAnnotation | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-MarkerAnnotation | ||
$.OPTION(() => { | ||
@@ -221,9 +221,7 @@ $.CONSUME(t.LBrace); | ||
DEF: [ | ||
// normal annotation - https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-NormalAnnotation | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-NormalAnnotation | ||
{ ALT: () => $.SUBRULE($.elementValuePairList) }, | ||
// Single Element Annotation - https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-SingleElementAnnotation | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-SingleElementAnnotation | ||
{ ALT: () => $.SUBRULE($.elementValue) }, | ||
{ | ||
ALT: () => $.SUBRULE($.elementValue) | ||
}, | ||
{ | ||
ALT: () => { | ||
@@ -240,3 +238,3 @@ /* empty normal annotation contents */ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-ElementValuePairList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ElementValuePairList | ||
$.RULE("elementValuePairList", () => { | ||
@@ -250,2 +248,3 @@ $.SUBRULE($.elementValuePair); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ElementValuePair | ||
$.RULE("elementValuePair", () => { | ||
@@ -257,8 +256,6 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-ElementValue | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ElementValue | ||
$.RULE("elementValue", () => { | ||
$.OR([ | ||
// Spec Deviation: "conditionalExpression" replaced with "expression" | ||
// Because we cannot differentiate between the two using fixed lookahead. | ||
{ ALT: () => $.SUBRULE($.expression) }, | ||
{ ALT: () => $.SUBRULE($.conditionalExpression) }, | ||
{ ALT: () => $.SUBRULE($.elementValueArrayInitializer) }, | ||
@@ -269,3 +266,3 @@ { ALT: () => $.SUBRULE($.annotation) } | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-ElementValueArrayInitializer | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ElementValueArrayInitializer | ||
$.RULE("elementValueArrayInitializer", () => { | ||
@@ -282,3 +279,3 @@ $.CONSUME(t.LCurly); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-9.html#jls-ElementValueList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-9.html#jls-ElementValueList | ||
$.RULE("elementValueList", () => { | ||
@@ -285,0 +282,0 @@ $.SUBRULE($.elementValue); |
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-Literal | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-3.html#jls-Literal | ||
$.RULE("literal", () => { | ||
@@ -15,3 +15,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-IntegerLiteral | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-3.html#jls-IntegerLiteral | ||
$.RULE("integerLiteral", () => { | ||
@@ -26,3 +26,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-FloatingPointLiteral | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-3.html#jls-FloatingPointLiteral | ||
$.RULE("floatingPointLiteral", () => { | ||
@@ -35,3 +35,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-BooleanLiteral | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-3.html#jls-BooleanLiteral | ||
$.RULE("booleanLiteral", () => { | ||
@@ -38,0 +38,0 @@ $.OR([{ ALT: () => $.CONSUME(t.True) }, { ALT: () => $.CONSUME(t.False) }]); |
import { tokenMatcher } from "chevrotain"; | ||
export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-ModuleName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-ModuleName | ||
$.RULE("moduleName", () => { | ||
@@ -12,3 +12,3 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-PackageName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-PackageName | ||
$.RULE("packageName", () => { | ||
@@ -22,3 +22,3 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-TypeName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-TypeName | ||
$.RULE("typeName", () => { | ||
@@ -37,3 +37,3 @@ // Spec Deviation: The last Identifier in a "typeName" may not be be "var" | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-ExpressionName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-ExpressionName | ||
$.RULE("expressionName", () => { | ||
@@ -54,3 +54,3 @@ // Spec Deviation: in-lined "ambiguousName" to be LL(K) | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-MethodName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-MethodName | ||
$.RULE("methodName", () => { | ||
@@ -60,3 +60,3 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-PackageOrTypeName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-PackageOrTypeName | ||
$.RULE("packageOrTypeName", () => { | ||
@@ -78,3 +78,3 @@ $.CONSUME(t.Identifier); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-6.html#jls-AmbiguousName | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-6.html#jls-AmbiguousName | ||
$.RULE("ambiguousName", () => { | ||
@@ -81,0 +81,0 @@ $.CONSUME(t.Identifier); |
@@ -9,4 +9,4 @@ import { tokenMatcher, EOF } from "chevrotain"; | ||
* | ||
* https://docs.oracle.com/javase/specs/jls/se21/html/jls-7.html#jls-7.3 | ||
* https://docs.oracle.com/javase/specs/jls/se21/preview/specs/unnamed-classes-instance-main-methods-jls.html | ||
* https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-CompilationUnit | ||
* https://docs.oracle.com/javase/specs/jls/se22/preview/specs/implicitly-declared-classes-instance-main-methods-jls.html | ||
*/ | ||
@@ -22,3 +22,3 @@ $.RULE("compilationUnit", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-OrdinaryCompilationUnit | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-OrdinaryCompilationUnit | ||
$.RULE("ordinaryCompilationUnit", () => { | ||
@@ -34,3 +34,3 @@ $.OPTION(() => $.SUBRULE($.packageDeclaration)); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-ModularCompilationUnit | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-ModularCompilationUnit | ||
$.RULE("modularCompilationUnit", () => { | ||
@@ -43,3 +43,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-PackageDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-PackageDeclaration | ||
$.RULE("packageDeclaration", () => { | ||
@@ -58,3 +58,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-PackageModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-PackageModifier | ||
$.RULE("packageModifier", () => { | ||
@@ -64,3 +64,3 @@ $.SUBRULE($.annotation); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-ImportDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-ImportDeclaration | ||
$.RULE("importDeclaration", () => { | ||
@@ -105,4 +105,4 @@ // Spec Deviation: The spec defines four different kinds of import declarations. | ||
* | ||
* https://docs.oracle.com/javase/specs/jls/se21/html/jls-7.html#jls-TopLevelClassOrInterfaceDeclaration | ||
* https://docs.oracle.com/javase/specs/jls/se21/preview/specs/unnamed-classes-instance-main-methods-jls.html | ||
* https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-TopLevelClassOrInterfaceDeclaration | ||
* https://docs.oracle.com/javase/specs/jls/se22/preview/specs/implicitly-declared-classes-instance-main-methods-jls.html | ||
*/ | ||
@@ -119,3 +119,3 @@ $.RULE("typeDeclaration", () => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-ModuleDeclaration | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-ModuleDeclaration | ||
$.RULE("moduleDeclaration", () => { | ||
@@ -141,3 +141,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-ModuleDirective | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-ModuleDirective | ||
$.RULE("moduleDirective", () => { | ||
@@ -161,3 +161,3 @@ // Spec Deviation: Each of the alternatives of "moduleDirective" was extracted | ||
/** | ||
* https://docs.oracle.com/javase/specs/jls/se16/html/jls-3.html#jls-3.9 - | ||
* https://docs.oracle.com/javase/specs/jls/se22/html/jls-3.html#jls-3.9 - | ||
* There is one exception: immediately to the right of the character sequence `requires` in the ModuleDirective production, | ||
@@ -230,3 +230,3 @@ * the character sequence `transitive` is tokenized as a keyword unless it is followed by a separator, | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-RequiresModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-7.html#jls-RequiresModifier | ||
$.RULE("requiresModifier", () => { | ||
@@ -233,0 +233,0 @@ $.OR([ |
@@ -6,3 +6,3 @@ export function defineRules($, t) { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-PrimitiveType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-PrimitiveType | ||
$.RULE("primitiveType", () => { | ||
@@ -18,3 +18,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-NumericType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-NumericType | ||
$.RULE("numericType", () => { | ||
@@ -27,3 +27,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-IntegralType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-IntegralType | ||
$.RULE("integralType", () => { | ||
@@ -39,3 +39,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-FloatingPointType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-FloatingPointType | ||
$.RULE("floatingPointType", () => { | ||
@@ -48,3 +48,3 @@ $.OR([ | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-ReferenceType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-ReferenceType | ||
$.RULE("referenceType", () => { | ||
@@ -83,3 +83,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-ClassOrInterfaceType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-ClassOrInterfaceType | ||
$.RULE("classOrInterfaceType", () => { | ||
@@ -92,3 +92,3 @@ // Spec Deviation: The spec says: "classType | interfaceType" but "interfaceType" | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-ClassType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-ClassType | ||
$.RULE("classType", () => { | ||
@@ -114,3 +114,3 @@ // Spec Deviation: Refactored left recursion and alternation to iterations | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-InterfaceType | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-InterfaceType | ||
$.RULE("interfaceType", () => { | ||
@@ -120,2 +120,3 @@ $.SUBRULE($.classType); | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeVariable | ||
$.RULE("typeVariable", () => { | ||
@@ -129,3 +130,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-Dims | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-Dims | ||
$.RULE("dims", () => { | ||
@@ -149,3 +150,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-TypeParameter | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeParameter | ||
$.RULE("typeParameter", () => { | ||
@@ -161,3 +162,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-TypeParameterModifier | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeParameterModifier | ||
$.RULE("typeParameterModifier", () => { | ||
@@ -167,3 +168,3 @@ $.SUBRULE($.annotation); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-TypeBound | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeBound | ||
$.RULE("typeBound", () => { | ||
@@ -174,3 +175,3 @@ $.CONSUME(t.Extends); | ||
$.SUBRULE($.classOrInterfaceType); | ||
$.MANY2(() => { | ||
$.MANY(() => { | ||
$.SUBRULE($.additionalBound); | ||
@@ -180,3 +181,3 @@ }); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-AdditionalBound | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-AdditionalBound | ||
$.RULE("additionalBound", () => { | ||
@@ -187,3 +188,3 @@ $.CONSUME(t.And); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-TypeArguments | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeArguments | ||
$.RULE("typeArguments", () => { | ||
@@ -195,3 +196,3 @@ $.CONSUME(t.Less); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-TypeArgumentList | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeArgumentList | ||
$.RULE("typeArgumentList", () => { | ||
@@ -205,3 +206,3 @@ $.SUBRULE($.typeArgument); | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-TypeArgument | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-TypeArgument | ||
$.RULE("typeArgument", () => { | ||
@@ -215,3 +216,3 @@ // TODO: performance: evaluate flipping the order of alternatives | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-Wildcard | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-Wildcard | ||
$.RULE("wildcard", () => { | ||
@@ -227,3 +228,3 @@ $.MANY(() => { | ||
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-4.html#jls-WildcardBounds | ||
// https://docs.oracle.com/javase/specs/jls/se22/html/jls-4.html#jls-WildcardBounds | ||
$.RULE("wildcardBounds", () => { | ||
@@ -230,0 +231,0 @@ // TODO: consider in-lining suffix into the alternatives to match the spec more strongly |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
260008
7494
1