在我的項目中,我編寫了一種用于處理鍵值對的語言。所以我有一些規(guī)則來匹配多個鍵keysList和一個值valuesList?,F(xiàn)在我想在另一個規(guī)則中使用它們operationExpression : keysList CompareOperator valuesList ;哪個工作正常。我認為這將是很好命名這些規(guī)則元素keys和valuesoperationExpression : keys=keysList CompareOperator values=valueList ;當我現(xiàn)在嘗試編譯我的項目時,我收到一千個錯誤,抱怨缺少分號。當我查看生成的代碼時,我發(fā)現(xiàn) Antlr 給這些上下文起了奇怪的名字。我期望它們是keys,values但它們似乎是每個 C# 關(guān)鍵字(并且值之間有一些 @s)。public KeysListContext structexterndoushortfloatwhileoperatorrefprotectedreadonlycontinueelsecheckedlockcatchifcasenewusingstaticvoidinsizeofbytedoublesealedfinallythisuncheckedisparamsenumexplicitasnulltruefixedtrydecimalobjectimplicitinternalprivatevirtualboolconststringforinterfaceunsafelongoutswitchdelegateforeachdefaultulonggotopublicstackallocoverrideeventclasstypeofbreakfalsevolatileabstractuintintthrowcharnamespacesbyteshortreturnbase;public ValuesListContext @struct@extern@do@ushort@float@while@operator@ref@protected@readonly@continue@else@checked@lock@catch@if@case@new@using@static@void@in@sizeof@byte@double@sealed@finally@this@unchecked@is@params@enum@explicit@as@null@true@fixed@try@decimal@object@implicit@internal@private@virtual@bool@const@string@for@interface@unsafe@long@out@switch@delegate@foreachkey@ulong@goto@public@stackalloc@override@event@class@typeof@break@false@volatile@abstract@uint@int@throw@char@namespace@sbyte@short@return@base;每個其他名字似乎都很好。為什么 Antlr 這樣做,為什么我不允許使用keys和values作為規(guī)則元素標簽?
- 2 回答
- 0 關(guān)注
- 220 瀏覽
添加回答
舉報
0/150
提交
取消