2013-07-25 25 views

回答

3

是的。

文檔關於[]

可選:[]之間的項目是可選的。括號中的所有項目或全部不包含在內。

EBNF[]代表可ommitted可選參數,所以[x],y限定的可能性yxy

例子:

Bicycle_Accessories = saddle [bell | horn] {water_bottle_holders} 

定義下一個可能性:

saddle 
saddle bell 
saddle horn 
saddle water_bottle_holder 
saddle bell water_bottle_holder 
saddle bell water_bottle_holder water_bottle_holder 
+0

這正是我需要的,太感謝你了! – user2586173

+0

實際上,'[x],y'既可以是',y'也可以是'x,y' - '',''不代表'','以外的任何其他內容。如果你想'y'或'x,y'你需要'[x,] y'。 –

+1

@ChrisDodd:逗號','是EBNF中的串聯,不是典型的符號。 – m0nhawk