Skip to content

Commit a789b47

Browse files
Very early and partial grammar changes for lambda rewiring
1 parent 1733641 commit a789b47

File tree

34 files changed

+1872
-1987
lines changed

34 files changed

+1872
-1987
lines changed

org.eclipse.jdt.core.compiler.batch/grammar/java.g

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ $Terminals
113113
BeginLambda
114114
BeginIntersectionCast
115115
BeginTypeArguments
116-
ElidedSemicolonAndRightBrace
117116
AT308
118117
AT308DOTDOTDOT
119118
BeginCaseExpr
@@ -1835,7 +1834,6 @@ PrimaryNoNewArray -> ArrayAccess
18351834
-- Start of rules for JSR 335
18361835
-----------------------------------------------------------------------
18371836

1838-
PrimaryNoNewArray -> LambdaExpression
18391837
PrimaryNoNewArray -> ReferenceExpression
18401838
/:$readableName Expression:/
18411839

@@ -1931,17 +1929,12 @@ TypeElidedFormalParameter ::= Modifiersopt Identifier
19311929
/:$readableName TypeElidedFormalParameter:/
19321930
/:$compliance 1.8:/
19331931

1934-
-- A lambda body of the form x is really '{' return x; '}'
1935-
LambdaBody -> ElidedLeftBraceAndReturn Expression ElidedSemicolonAndRightBrace
1932+
LambdaBody ::= Expression
1933+
/.$putCase consumeLambdaBody(false); $break ./
19361934
LambdaBody -> Block
19371935
/:$readableName LambdaBody:/
19381936
/:$compliance 1.8:/
19391937

1940-
ElidedLeftBraceAndReturn ::= $empty
1941-
/.$putCase consumeElidedLeftBraceAndReturn(); $break ./
1942-
/:$readableName ElidedLeftBraceAndReturn:/
1943-
/:$compliance 1.8:/
1944-
19451938
-----------------------------------------------------------------------
19461939
-- End of rules for JSR 335
19471940
-----------------------------------------------------------------------
@@ -2261,6 +2254,7 @@ ConditionalOrExpression ::= ConditionalOrExpression '||' ConditionalAndExpressio
22612254

22622255
ConditionalExpression -> ConditionalOrExpression
22632256
ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' ConditionalExpression
2257+
ConditionalExpression ::= ConditionalOrExpression '?' Expression ':' LambdaExpression
22642258
/.$putCase consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; $break ./
22652259
/:$readableName Expression:/
22662260

@@ -2308,10 +2302,8 @@ AssignmentOperator ::= '|='
23082302
/:$readableName AssignmentOperator:/
23092303
/:$recovery_template =:/
23102304

2311-
-- For handling lambda expressions, we need to know when a full Expression
2312-
-- has been reduced.
2313-
Expression ::= AssignmentExpression
2314-
/.$putCase consumeExpression(); $break ./
2305+
Expression -> LambdaExpression
2306+
Expression -> AssignmentExpression
23152307
/:$readableName Expression:/
23162308
/:$recovery_template Identifier:/
23172309

@@ -3206,3 +3198,5 @@ COLON_COLON ::= '::'
32063198

32073199
$end
32083200
-- need a carriage return after the $end
3201+
3202+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/GenerateParserScript.class

0 commit comments

Comments
 (0)