Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 2.0] How to loose up member order in grammar
[Xtext 2.0] How to loose up member order in grammar [message #668736] Fri, 06 May 2011 22:11
Alex Ruiz is currently offline Alex RuizFriend
Messages: 103
Registered: March 2011
Senior Member
Greetings,

I'm working on a protocol buffer editor for Eclipse using Xtext 2.0. Here is the relevant part of the grammar:

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
generate protobuf "http://www.google.com/eclipse/protobuf/Protobuf"

Protobuf:
  (syntax=Syntax)?	
  (package=Package)?
  (imports+=Import)*
  (options+=Option)*
  (elements+=ProtobufElement)*;

Syntax:
  'syntax' '=' name=STRING ';';  
  
Package:
  'package' name=QualifiedName ';';

Import: 
  'import' importURI=STRING ';';

QualifiedName:
  ID ('.' ID)*;

Option:
  'option' name=ID '=' value=ValueRef ';';

ProtobufElement:
  Type | ExtendMessage | Service;


In the editor, I must specify "package" as the first element, then "imports" and "options". If I specify "options" before "imports" Xtext shows syntax errors.

It turns out that the protocol buffer compiler considers having "imports" before or after "options" as valid. How can I emulate this behavior in Xtext?

Many thanks in advance,
-Alex
Previous Topic:problems with the example of GMF integration
Next Topic:[Xtext 2.0] How to loose up member order in grammar
Goto Forum:
  


Current Time: Thu Apr 25 03:33:51 GMT 2024

Powered by FUDForum. Page generated in 0.02975 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top