Problems parsing ruby on rails files with xtext [message #1743033] |
Fri, 09 September 2016 13:46  |
Eclipse User |
|
|
|
Hi
I'm parsing Ruby on rails models with xtext.
I'm having problems parsing the las 3 lines of this sample (when there is no space between foreign_key and equals symbol (=).
belongs_to :school,:foreign_key => "model_id"
belongs_to "school", :foreign_key =>:model_id
belongs_to "school", :foreign_key =>"model_id"
belongs_to :school,:foreign_key=> "model_id"
belongs_to "school", :foreign_key=>:model_id
belongs_to "school", :foreign_key =>"school_id"
The xtext file is:
Main:
belongs_to+=BelongsTo*
;
BelongsTo returns BelongsTo:
'belongs_to' RWS+ name=(RUBY_SYMBOL|RUBY_STRING) (RWS*','RWS* ('foreign_key:'|':foreign_key'RWS*'=>')RWS*foreign_key=(RUBY_SYMBOL|RUBY_STRING))? (RWS*'\r'? '\n')
;
terminal RUBY_STRING: '"' -> '"'|"'"->"'";
terminal RUBY_METHOD_NAME: ('a'..'z'|'_') ('a'..'z'|'_'|'0'..'9')*'='?;
terminal RUBY_SYMBOL:':'RUBY_METHOD_NAME;
terminal RWS:(' '|'\t');
Thanks in advance, for any idea
Attachment: MyDsl.xtext
(Size: 0.54KB, Downloaded 94 times)
Attachment: samples.mydsl
(Size: 0.27KB, Downloaded 88 times)
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05458 seconds