From aa7bae213d6454daf3ba4a0b9074ef7ebbb221c2 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Tue, 5 May 2015 12:33:11 +0300 Subject: [PATCH] Introduce `++` operator into grammar --- grammar/src/attributes.grm | 2 +- grammar/src/expressions.grm | 10 +++++----- grammar/src/modifiers.grm | 6 +++++- grammar/src/notation.grm | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/grammar/src/attributes.grm b/grammar/src/attributes.grm index e068d312de3..c149d9f33fb 100644 --- a/grammar/src/attributes.grm +++ b/grammar/src/attributes.grm @@ -12,5 +12,5 @@ annotation ; annotationEntry - : "@"? SimpleName{"."} typeArguments? valueArguments? + : "@"? ++ SimpleName{"."} typeArguments? valueArguments? ; \ No newline at end of file diff --git a/grammar/src/expressions.grm b/grammar/src/expressions.grm index b124b45d8a8..190d74ae360 100644 --- a/grammar/src/expressions.grm +++ b/grammar/src/expressions.grm @@ -126,11 +126,11 @@ atomicExpression ; labelReference - : "@" LabelName + : "@" ++ LabelName ; labelDefinition - : LabelName "@" + : LabelName ++ "@" ; literalConstant @@ -246,9 +246,9 @@ valueArguments jump : "throw" expression - : "return" labelReference? expression? - : "continue" labelReference? - : "break" labelReference? + : "return" ++ labelReference? expression? + : "continue" ++ labelReference? + : "break" ++ labelReference? // yield ? ; diff --git a/grammar/src/modifiers.grm b/grammar/src/modifiers.grm index af9415c3d94..ba1f4d6967e 100644 --- a/grammar/src/modifiers.grm +++ b/grammar/src/modifiers.grm @@ -3,10 +3,14 @@ */ modifiers - : ("@"? modifier)* + : modifier* ; modifier + : "@"? ++ modifierKeyword + ; + +modifierKeyword : classModifier : accessModifier : varianceAnnotation diff --git a/grammar/src/notation.grm b/grammar/src/notation.grm index 31e43eef235..1700271f9a1 100644 --- a/grammar/src/notation.grm +++ b/grammar/src/notation.grm @@ -17,7 +17,8 @@ Operator `|` denotes _alternative_.
Operator `*` denotes _iteration_ (zero or more).
Operator `+` denotes _iteration_ (one or more).
Operator `?` denotes _option_ (zero or one).
-alpha`{`beta`}` denotes a nonempty _beta_-separated list of _alpha_'s. +alpha`{`beta`}` denotes a nonempty _beta_-separated list of _alpha_'s.
+Operator ``++'' means that no space or comment allowed between operands. # Semicolons