diff -r 78982602de6f -r 0e9a2c98c9aa tools/incparser/Program.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/incparser/Program.cs Mon May 21 04:46:17 2007 +0000 @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace incparser +{ + class Program + { + static void Main(string[] args) + { + Environment.Exit(SubMain(args)); + } + + static int SubMain(string[] args) + { + if (args.Length < 1) + { + Console.WriteLine("Usage: incparser "); + return 1; + } + + IncParser inc = null; + try + { + inc = new IncParser(args[0]); + } + catch (ParseException e) + { + Console.WriteLine("Initial browsing failed: " + e.Message); + return 1; + } + catch (System.Exception e) + { + Console.WriteLine("Failed to read file: " + e.Message); + return 1; + } + + ParseWriter pw = new ParseWriter(); + + try + { + inc.Parse(pw); + } + catch (System.Exception e) + { + Console.WriteLine("Error parsing file (line " + inc.GetLineNumber() + "): " + e.Message); + return 1; + } + + if (pw.Level != 0) + { + Console.WriteLine("Fatal parse error detected; unable to complete output."); + return 1; + } + + Console.Write(pw.Contents); + Console.Write("\n"); + + return 0; + } + } +}