sourcemod/tools/incparser/Program.cs
Scott Ehlert 251cced1f8 Spring Cleaning, Part Ichi (1)
Various minor things done to project files
Updated sample extension project file and updated makefile to the new unified version (more changes likely on the way)
Updated regex project file and makefile

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401971
2008-03-30 07:00:22 +00:00

63 lines
1.5 KiB
C#

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 <infile>");
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;
}
}
}