-
-
Save lucaswerkmeister/b0c4a7369d87bd0a16034ea0f1ae9796 to your computer and use it in GitHub Desktop.
part of eclipse-archived/ceylon#7413
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/typechecker/antlr/org/eclipse/ceylon/compiler/typechecker/parser/Ceylon.g b/typechecker/antlr/org/eclipse/ceylon/compiler/typechecker/parser/Ceylon.g | |
index 0a77b9fae5..36cd89b7c6 100644 | |
--- a/typechecker/antlr/org/eclipse/ceylon/compiler/typechecker/parser/Ceylon.g | |
+++ b/typechecker/antlr/org/eclipse/ceylon/compiler/typechecker/parser/Ceylon.g | |
@@ -1718,41 +1718,51 @@ statement returns [Statement statement] | |
; | |
expressionOrSpecificationStatement returns [Statement statement] | |
- @init { SpecifierStatement ss=new SpecifierStatement(null); | |
- ExpressionStatement es=new ExpressionStatement(null); } | |
- : expression | |
- { $statement = es; | |
- if ($expression.expression!=null) | |
- es.setExpression($expression.expression); | |
- if ($expression.expression.getTerm() instanceof AssignOp) { | |
- AssignOp a = (AssignOp) $expression.expression.getTerm(); | |
- Term lt = a.getLeftTerm(); | |
- if (lt instanceof BaseMemberExpression || | |
- lt instanceof ParameterizedExpression || | |
- lt instanceof QualifiedMemberExpression && | |
- ((QualifiedMemberExpression) lt).getPrimary() instanceof This && | |
- ((QualifiedMemberExpression) lt).getMemberOperator() instanceof MemberOp) { | |
- Expression e = new Expression(null); | |
- e.setTerm(a.getRightTerm()); | |
- SpecifierExpression se = new SpecifierExpression(a.getMainToken()); | |
- se.setExpression(e); | |
- ss.setSpecifierExpression(se); | |
- ss.setBaseMemberExpression(a.getLeftTerm()); | |
- $statement = ss; | |
- } | |
- } | |
- } | |
+ : (specificationStatementStart) => | |
+ specificationStatement | |
+ { $statement = $specificationStatement.statement; } | |
+ | expressionStatement | |
+ { $statement = $expressionStatement.statement; } | |
+ ; | |
+ | |
+specificationStatementStart | |
+ : ((THIS|SUPER|OUTER|PACKAGE) MEMBER_OP)? | |
+ LIDENTIFIER | |
( | |
- /*specifier | |
- { ss.setSpecifierExpression($specifier.specifierExpression); | |
- ss.setBaseMemberExpression($expression.expression.getTerm()); | |
- $statement = ss; } | |
- | */ | |
- lazySpecifier | |
- { ss.setSpecifierExpression($lazySpecifier.specifierExpression); | |
- ss.setBaseMemberExpression($expression.expression.getTerm()); | |
- $statement = ss; } | |
- )? | |
+ SPECIFY | |
+ | COMPUTE | |
+ | typeParameters? specifierParametersStart | |
+ ) | |
+ ; | |
+ | |
+specificationStatement returns [SpecifierStatement statement] | |
+ : e1=valueExpression | |
+ { $statement = new SpecifierStatement(null); | |
+ $statement.setBaseMemberExpression($e1.term); } | |
+ ( | |
+ s1=specifier | |
+ { $statement.setSpecifierExpression($s1.specifierExpression); } | |
+ | | |
+ s2=lazySpecifier | |
+ { $statement.setSpecifierExpression($s2.specifierExpression); } | |
+ ) | |
+ { expecting=SEMICOLON; } | |
+ ( | |
+ SEMICOLON | |
+ { $statement.setEndToken($SEMICOLON); } | |
+ | { displayRecognitionError(getTokenNames(), | |
+ new MismatchedTokenException(SEMICOLON, input)); } | |
+ COMMA | |
+ { $statement.setEndToken($COMMA); } | |
+ ) | |
+ { expecting=-1; } | |
+ ; | |
+ | |
+expressionStatement returns [ExpressionStatement statement] | |
+ : e1=expression | |
+ { $statement = new ExpressionStatement(null); | |
+ if ($e1.expression!=null) | |
+ $statement.setExpression($e1.expression); } | |
{ expecting=SEMICOLON; } | |
( | |
SEMICOLON |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment