From c156b8778e3c863159921395b8c0b7f6d42592cb Mon Sep 17 00:00:00 2001 From: "Silas S. Brown" <ssb22@cam.ac.uk> Date: Thu, 16 Apr 2015 20:48:03 +0000 Subject: [PATCH] Update adjuster/annogen/termlayout git-svn-id: http://svn.code.sf.net/p/e-guidedog/code/ssb22/adjuster@2160 29193198-4895-4776-b068-10539e920549 --- annogen.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/annogen.py b/annogen.py index f0bc79f..ee65def 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; -- GitLab