sklose / NCalc2

expression evaluator for .NET with built-in compiler
MIT License
166 stars 58 forks source link

Comment support #77

Closed Bykiev closed 8 months ago

Bykiev commented 9 months ago

Hi, I need a comment support (like in C# /**/ and //), is anybody tried to add support directly in NCalc? Of course I can prepare the data before passing to NCalc, but I believe antlr will be faster and more suitable for it.

david-brink-talogy commented 8 months ago

Something like this will work if you just want to throw them away.

SINGLE_LINE_COMMENT:
    '//' .*? ('\r'? '\n' | '\r') -> channel(HIDDEN);

MULTI_LINE_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);