لن يتم تحليل المفارقة C # باستخدام المفارقة المقدمة C # Grammar
سؤال
لذلك، أحاول تحليل بعض رمز C # بسيط لمعرفة كيفية استخدام المفارقة.أنا أستخدم Grammar C # المضمنة مع عينات المفارقة واستخدام رمز تحميل مجموعة العينة من هناك أيضا.يبدو أن هناك القليل جدا إذا أي وثائق حول المفارقة.إليك المصدر الكامل الذي أحاول تحليله: giveacodicetagpre.
و Code Code: giveacodicetagpre.
... حيث g هو g # النحو من السخرية.هل شهد أي شخص هذه المشكلات مع تحليل C # مع قواعد السخرية من قبل؟أنا آسف لا أستطيع تقديم أي معلومات أخرى.لا يوجد أي excep
المحلول
When I tried your code, the parsing indeed was unsuccessful. And the error (in parseTree.ParserMessages
) was on the end of the first line with the error message Invalid character: ''.
, where the character between the quotes is \r
.
Hmm, it seems \r
is not considered whitespace, so we need to modify the grammar. In the grammar, there is a method SkipWhitespace()
, that contains a list of whitespace characters in a switch
. If you just add case '\r':
there, the parsing should succeed.