لن يتم تحليل المفارقة C # باستخدام المفارقة المقدمة C # Grammar

StackOverflow https://stackoverflow.com//questions/9646213

  •  10-12-2019
  •  | 
  •  

سؤال

لذلك، أحاول تحليل بعض رمز 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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top