diff --git a/annogen.py b/annogen.py index f0bc79f8da947091cba2907de20e4d387992bb12..ee65def4c6e3b9a118176e68d45495e8f6207a1f 100755 --- a/annogen.py +++ b/annogen.py @@ -1190,11 +1190,18 @@ public String result() { } """ -cSharp_start = r"""// C# generated by """+program_name[:program_name.index("(c)")].strip()+r""" -// use: new Annotator(txt).result() -// (can also set annotation_mode on the Annotator) +if os.environ.get("ANNOGEN_CSHARP_NO_MAIN",""): + cSharp_mainNote = "" +else: cSharp_mainNote = """ // or just use the Main() at end (compile with csc, and // see --help for usage) +// (to omit this Main() from the generated file, set +// the environment variable ANNOGEN_CSHARP_NO_MAIN before +// running Annotator Generator)""" + +cSharp_start = r"""// C# generated by """+program_name[:program_name.index("(c)")].strip()+r""" +// use: new Annotator(txt).result() +// (can also set annotation_mode on the Annotator)"""+cSharp_mainNote+""" enum Annotation_Mode { ruby_markup, annotations_only, brace_notation }; @@ -1270,8 +1277,8 @@ public string result() { return System.Text.Encoding.UTF8.GetString(outBuf.ToArray()); } """ -cSharp_end = r"""} - +cSharp_end = "}\n" +if cSharp_mainNote: cSharp_end += r""" class Test { static void Main(string[] args) { Annotation_Mode annotation_mode = Annotation_Mode.ruby_markup;