ANTLR for C # and CLSCompliant Attributes

I am using ANTLR V3 to create C # code for DSL.

The generated code contains the CLSCompliant attribute on both the laxer and parser classes, which trigger a warning because my project does not comply with the CLS.

  • How can I make ANTLR code without CLSCompliant attribute?
  • Is it possible to change the string pattern of a grammar of C # 3?
+5
source share
2 answers

I assume that now you have figured out how easy it is to circumvent the solution, which is to turn off the corresponding warning (and saves you from messing with the templates).

Just add the following to your grammar file:

@parser::header {#pragma warning disable 3021}
@lexer::header {#pragma warning disable 3021}

NTN Gabriel

+9
source

, CLS, AssemblyInfo.cs:

[assembly: CLSCompliant(false)]

.

0

All Articles