Skip to content

Commit

Permalink
docs: update parser Java spec references to Java 16
Browse files Browse the repository at this point in the history
  • Loading branch information
clementdessoude committed Jun 13, 2021
1 parent deda6ca commit d20c1e3
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 165 deletions.
4 changes: 2 additions & 2 deletions packages/java-parser/src/productions/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { tokenMatcher } = require("chevrotain");

function defineRules($, t) {
// https://docs.oracle.com/javase/specs/jls/se11/html/jls-10.html#jls-ArrayInitializer
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-10.html#jls-ArrayInitializer
$.RULE("arrayInitializer", () => {
$.CONSUME(t.LCurly);
$.OPTION(() => {
Expand All @@ -15,7 +15,7 @@ function defineRules($, t) {
$.CONSUME(t.RCurly);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-10.html#jls-VariableInitializerList
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-10.html#jls-VariableInitializerList
$.RULE("variableInitializerList", () => {
$.SUBRULE($.variableInitializer);
$.MANY({
Expand Down
90 changes: 45 additions & 45 deletions packages/java-parser/src/productions/blocks-and-statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { tokenMatcher } = require("chevrotain");
// the dangling else is resolved by attaching an "else" block
// to the nearest "if"
function defineRules($, t) {
// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-Block
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Block
$.RULE("block", () => {
$.CONSUME(t.LCurly);
$.OPTION(() => {
Expand All @@ -15,15 +15,15 @@ function defineRules($, t) {
$.CONSUME(t.RCurly);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-BlockStatements
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BlockStatements
$.RULE("blockStatements", () => {
$.SUBRULE($.blockStatement);
$.MANY(() => {
$.SUBRULE2($.blockStatement);
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-BlockStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BlockStatement
$.RULE("blockStatement", () => {
const isLocalVariableDeclaration = this.BACKTRACK_LOOKAHEAD(
$.isLocalVariableDeclaration
Expand All @@ -44,13 +44,13 @@ function defineRules($, t) {
]);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-LocalVariableDeclaration
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LocalVariableDeclarationStatement
$.RULE("localVariableDeclarationStatement", () => {
$.SUBRULE($.localVariableDeclaration);
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-LocalVariableDeclaration
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LocalVariableDeclaration
$.RULE("localVariableDeclaration", () => {
$.MANY(() => {
$.SUBRULE($.variableModifier);
Expand All @@ -59,7 +59,7 @@ function defineRules($, t) {
$.SUBRULE($.variableDeclaratorList);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-LocalVariableType
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LocalVariableType
$.RULE("localVariableType", () => {
$.OR({
DEF: [
Expand All @@ -70,7 +70,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-Statement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Statement
$.RULE("statement", () => {
$.OR({
DEF: [
Expand All @@ -87,7 +87,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-StatementWithoutTrailingSubstatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-StatementWithoutTrailingSubstatement
$.RULE("statementWithoutTrailingSubstatement", () => {
$.OR({
DEF: [
Expand All @@ -112,25 +112,25 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-EmptyStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-EmptyStatement
$.RULE("emptyStatement", () => {
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-LabeledStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-LabeledStatement
$.RULE("labeledStatement", () => {
$.CONSUME(t.Identifier);
$.CONSUME(t.Colon);
$.SUBRULE($.statement);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ExpressionStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ExpressionStatement
$.RULE("expressionStatement", () => {
$.SUBRULE($.statementExpression);
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-StatementExpression
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-StatementExpression
$.RULE("statementExpression", () => {
// Spec deviation: The many alternatives here were replaced with
// the "expression" rule as it contains them all,
Expand All @@ -141,8 +141,8 @@ function defineRules($, t) {
});

// Spec deviation: combined "IfThenStatement" and "IfThenElseStatement"
// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-IfThenStatement
// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-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
$.RULE("ifStatement", () => {
$.CONSUME(t.If);
$.CONSUME(t.LBrace);
Expand All @@ -155,7 +155,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-AssertStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-AssertStatement
$.RULE("assertStatement", () => {
$.CONSUME(t.Assert);
$.SUBRULE($.expression);
Expand All @@ -166,7 +166,7 @@ function defineRules($, t) {
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-SwitchStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchStatement
$.RULE("switchStatement", () => {
$.CONSUME(t.Switch);
$.CONSUME(t.LBrace);
Expand All @@ -175,7 +175,7 @@ function defineRules($, t) {
$.SUBRULE($.switchBlock);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-SwitchBlock
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchBlock
$.RULE("switchBlock", () => {
$.CONSUME(t.LCurly);
$.OR([
Expand All @@ -200,7 +200,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-SwitchLabel
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchLabel
$.RULE("switchLabel", () => {
$.OR([
{
Expand All @@ -222,7 +222,7 @@ function defineRules($, t) {
]);
});

// https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-SwitchRule
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SwitchRule
$.RULE("switchRule", () => {
$.SUBRULE($.switchLabel);
$.CONSUME(t.Arrow);
Expand All @@ -238,12 +238,12 @@ function defineRules($, t) {
]);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-EnumConstantName
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-EnumConstantName
$.RULE("caseConstant", () => {
$.SUBRULE($.ternaryExpression);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-WhileStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-WhileStatement
$.RULE("whileStatement", () => {
$.CONSUME(t.While);
$.CONSUME(t.LBrace);
Expand All @@ -252,7 +252,7 @@ function defineRules($, t) {
$.SUBRULE($.statement);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-DoStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-DoStatement
$.RULE("doStatement", () => {
$.CONSUME(t.Do);
$.SUBRULE($.statement);
Expand All @@ -262,7 +262,7 @@ function defineRules($, t) {
$.CONSUME(t.RBrace);
$.CONSUME(t.Semicolon);
});
// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ForStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ForStatement
$.RULE("forStatement", () => {
$.OR([
{
Expand All @@ -273,7 +273,7 @@ function defineRules($, t) {
]);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-BasicForStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BasicForStatement
$.RULE("basicForStatement", () => {
$.CONSUME(t.For);
$.CONSUME(t.LBrace);
Expand All @@ -292,7 +292,7 @@ function defineRules($, t) {
$.SUBRULE($.statement);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ForInit
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ForInit
$.RULE("forInit", () => {
$.OR([
{
Expand All @@ -303,12 +303,12 @@ function defineRules($, t) {
]);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ForUpdate
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ForUpdate
$.RULE("forUpdate", () => {
$.SUBRULE($.statementExpressionList);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-StatementExpressionList
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-StatementExpressionList
$.RULE("statementExpressionList", () => {
$.SUBRULE($.statementExpression);
$.MANY(() => {
Expand All @@ -317,7 +317,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-EnhancedForStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-EnhancedForStatement
$.RULE("enhancedForStatement", () => {
$.CONSUME(t.For);
$.CONSUME(t.LBrace);
Expand All @@ -332,7 +332,7 @@ function defineRules($, t) {
$.SUBRULE($.statement);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-BreakStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-BreakStatement
$.RULE("breakStatement", () => {
$.CONSUME(t.Break);
$.OPTION(() => {
Expand All @@ -341,7 +341,7 @@ function defineRules($, t) {
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ContinueStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ContinueStatement
$.RULE("continueStatement", () => {
$.CONSUME(t.Continue);
$.OPTION(() => {
Expand All @@ -350,7 +350,7 @@ function defineRules($, t) {
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ReturnStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ReturnStatement
$.RULE("returnStatement", () => {
$.CONSUME(t.Return);
$.OPTION(() => {
Expand All @@ -359,14 +359,14 @@ function defineRules($, t) {
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ThrowStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ThrowStatement
$.RULE("throwStatement", () => {
$.CONSUME(t.Throw);
$.SUBRULE($.expression);
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-SynchronizedStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-SynchronizedStatement
$.RULE("synchronizedStatement", () => {
$.CONSUME(t.Synchronized);
$.CONSUME(t.LBrace);
Expand All @@ -375,7 +375,7 @@ function defineRules($, t) {
$.SUBRULE($.block);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-TryStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-TryStatement
$.RULE("tryStatement", () => {
$.OR({
DEF: [
Expand All @@ -402,15 +402,15 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-Catches
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Catches
$.RULE("catches", () => {
$.SUBRULE($.catchClause);
$.MANY(() => {
$.SUBRULE2($.catchClause);
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-CatchClause
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-CatchClause
$.RULE("catchClause", () => {
$.CONSUME(t.Catch);
$.CONSUME(t.LBrace);
Expand All @@ -419,7 +419,7 @@ function defineRules($, t) {
$.SUBRULE($.block);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-CatchFormalParameter
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-CatchFormalParameter
$.RULE("catchFormalParameter", () => {
$.MANY(() => {
$.SUBRULE($.variableModifier);
Expand All @@ -428,7 +428,7 @@ function defineRules($, t) {
$.SUBRULE($.variableDeclaratorId);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-CatchType
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-CatchType
$.RULE("catchType", () => {
$.SUBRULE($.unannClassType);
$.MANY(() => {
Expand All @@ -437,13 +437,13 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-Finally
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Finally
$.RULE("finally", () => {
$.CONSUME(t.Finally);
$.SUBRULE($.block);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-TryWithResourcesStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-TryWithResourcesStatement
$.RULE("tryWithResourcesStatement", () => {
$.CONSUME(t.Try);
$.SUBRULE($.resourceSpecification);
Expand All @@ -456,7 +456,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ResourceSpecification
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ResourceSpecification
$.RULE("resourceSpecification", () => {
$.CONSUME(t.LBrace);
$.SUBRULE($.resourceList);
Expand All @@ -466,7 +466,7 @@ function defineRules($, t) {
$.CONSUME(t.RBrace);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-ResourceList
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-ResourceList
$.RULE("resourceList", () => {
$.SUBRULE($.resource);
$.MANY({
Expand All @@ -478,7 +478,7 @@ function defineRules($, t) {
});
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-Resource
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-Resource
$.RULE("resource", () => {
$.OR([
{
Expand All @@ -502,14 +502,14 @@ function defineRules($, t) {
$.SUBRULE($.expression);
});

// https://docs.oracle.com/javase/specs/jls/se15/html/jls-14.html#jls-YieldStatement
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-YieldStatement
$.RULE("yieldStatement", () => {
$.CONSUME(t.Yield);
$.SUBRULE($.expression);
$.CONSUME(t.Semicolon);
});

// https://docs.oracle.com/javase/specs/jls/se11/html/jls-14.html#jls-VariableAccess
// https://docs.oracle.com/javase/specs/jls/se16/html/jls-14.html#jls-VariableAccess
$.RULE("variableAccess", () => {
// Spec Deviation: both "expressionName" and "fieldAccess" can be parsed
// by the "primary" rule
Expand Down
Loading

0 comments on commit d20c1e3

Please sign in to comment.