2017-05-03 45 views
0

特別是當我使用多於3個OR符號時。超過3個選項在聲明Xtext語法時不起作用

datatype: 
    Integer | Float | Char | Blah | Blah 
entity: 
    Class | Struct | Enumeration | Union 

完整的語法可以在這裏找到:https://gist.github.com/Mrprofessor/7b8df3f00c75ef2ac67bffd0a20e983c

+1

你會得到什麼錯誤?你能分享一個小的可重現的Xtext語法嗎?你的語法不是獨立的,並且看起來是假的缺少分號。 –

+0

[請在此檢查](https://gist.github.com/Mrprofessor/7b8df3f00c75ef2ac67bffd0a20e983c) –

回答

1

的問題是,你的語法是ambigous

考慮這種模式

Bla; 
Blubb; 
Pling; 

是這些位|指針|標籤| Entrys |邏輯| HwordLogicals |字節

+0

好吧,我得到你..我現在只是在學習。所以在寫規則之前我只想讓確定這些工作是否正常。 –

+0

非常感謝你們。我只是嘗試了xtext。順便提一下你的觀點。 –