|
|
Re: [Xtext 2.0] How to loose up member order in grammar [message #668835 is a reply to message #668818] |
Sun, 08 May 2011 15:00 |
Alex Ruiz Messages: 103 Registered: March 2011 |
Senior Member |
|
|
Thanks Jan!
Protobuf:
(syntax=Syntax)?
(package=Package)?
(imports+=Import | options+=Option)*
(elements+=ProtobufElement)*;
works for imports and options just as I wanted!
The only remaining issue is "package". It can be declared anywhere between "syntax" and "elements". I tried unordered groups as follows:
Protobuf:
(syntax=Syntax)?
(package=Package)? & (imports+=Import | options+=Option)*
(elements+=ProtobufElement)*;
but I got the following when running the mwe2 file:
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:95:17: Decision can match input such as "'syntax'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:113:3: Decision can match input such as "'package'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:180:2: Decision can match input such as "'import'" using multiple alternatives: 1, 3
As a result, alternative(s) 3 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:180:2: Decision can match input such as "'option'" using multiple alternatives: 2, 3
As a result, alternative(s) 3 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:198:1: Decision can match input such as "'service'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:198:1: Decision can match input such as "'enum'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:198:1: Decision can match input such as "'message'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../com.google.eclipse.protobuf/src-gen/com/google/eclipse/protobuf/parser/antlr/internal/InternalProtobuf.g:198:1: Decision can match input such as "'extend'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
Many thanks in advance,
-Alex
|
|
|
|
Powered by
FUDForum. Page generated in 0.03067 seconds