Fixed grammar to include all keywords in qualified names (except
'group', which makes the grammar ambiguous.) From now on we depend on
Xtext 2.1.1.
diff --git a/com.google.eclipse.protobuf/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
index 54b2e6e..a7c6159 100644
--- a/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
+++ b/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
@@ -34,5 +34,6 @@
com.google.eclipse.protobuf.scoping,
com.google.eclipse.protobuf.services,
com.google.eclipse.protobuf.util,
- com.google.eclipse.protobuf.validation
+ com.google.eclipse.protobuf.validation,
+ com.google.eclipse.protobuf.formatting
diff --git a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
index f391141..d1b1665 100644
--- a/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
+++ b/com.google.eclipse.protobuf/src/com/google/eclipse/protobuf/Protobuf.xtext
@@ -68,7 +68,7 @@
Option | IndexedElement | Enum | MessageExtension;
MessageField:
- modifier=Modifier type=TypeLink name=Name '=' index=(LONG | HEX)
+ =>modifier=Modifier type=TypeLink name=Name '=' index=(LONG | HEX)
('[' (fieldOptions+=FieldOption (',' fieldOptions+=FieldOption)*)? ']')? (';')+;
enum Modifier:
@@ -103,7 +103,7 @@
('-')? '0x' (NUMBER | 'a'..'f' | 'A'..'F')+;
MessageExtension:
- 'extend' message=MessageLink '{'
+ =>'extend' message=MessageLink '{'
elements+=MessageElement*
'}' (';')?;
@@ -124,12 +124,6 @@
IdOrReservedWord:
ID | ReservedWord;
-
-ReservedWord:
- 'package' | 'import' | 'public' | 'option' | 'extend' | 'message' | 'optional' | 'required' | 'repeated' |
- 'group' | 'enum' | 'service' | 'rpc' | 'returns' | 'true' | 'false' | 'default' | 'extensions' | 'to' | 'max' |
- 'double' | 'float' | 'int32' | 'int64' | 'uint32' | 'uint64' | 'sint32' | 'sint64' | 'fixed32' | 'fixed64' |
- 'sfixed32' | 'sfixed64' | 'bool' | 'string' | 'bytes';
MessageLink:
target=[Message|QualifiedName];
@@ -148,7 +142,7 @@
DefaultValueFieldOption | NativeFieldOption | CustomFieldOption;
DefaultValueFieldOption:
- 'default' '=' value=Value;
+ =>'default' '=' value=Value;
NativeFieldOption:
source=OptionSource '=' value=Value;
@@ -170,7 +164,7 @@
'(' target=[IndexedElement|QualifiedName] ')';
IndexedElement:
- MessageField | Group;
+ =>MessageField | Group;
Value:
ComplexValue | SimpleValueLink;
@@ -200,10 +194,19 @@
'[' target=[MessageField|QualifiedName] ']';
QualifiedName:
- '.'? ReducedId ('.' ReducedId)*;
+ '.'? SafeId ('.' SafeId)*;
-ReducedId:
- ID | 'rpc';
+SafeId:
+ ID | SafeReservedWord;
+
+ReservedWord:
+ SafeReservedWord | 'group';
+
+SafeReservedWord:
+ 'package' | 'import' | 'public' | 'option' | 'extend' | 'message' | 'optional' | 'required' | 'repeated' |
+ 'enum' | 'service' | 'rpc' | 'returns' | 'default' | 'extensions' | 'to' | 'max' | 'true' | 'false' |
+ 'double' | 'float' | 'int32' | 'int64' | 'uint32' | 'uint64' | 'sint32' | 'sint64' | 'fixed32' | 'fixed64' |
+ 'sfixed32' | 'sfixed64' | 'bool' | 'string' | 'bytes';
SimpleValueLink:
LiteralLink | BooleanLink | NumberLink | StringLink;
@@ -215,8 +218,7 @@
target=BOOL;
enum BOOL:
- true
- | false;
+ true | false;
NumberLink:
HexNumberLink | LongLink | DoubleLink;