/***************************************************************
         * Function: main
         **************************************************************/
        public static void Main
        (
            string[] arg
        )
        {
            CLexGen lg;

            //arg=new string[]{"c:\\minimal.lex"};
            if (arg.Length < 1)
            {
                System.Console.WriteLine("Usage: JLex.Main <filename>");
                return;
            }

            /* Note: For debuging, it may be helpful to remove the try/catch
             * block and permit the Exception to propagate to the top level.
             * This gives more information. */
            /*  try
             * {*/
            lg = new CLexGen(arg[0]);
            lg.generate();

            /* }
             * catch (System.Exception e)
             * {
             *   System.Console.WriteLine(e.Message);
             * }*/
        }
Beispiel #2
0
        /***************************************************************
          Function: main
          **************************************************************/
        public static void main
            (
            string[] arg
            )
        {
            CLexGen lg;
       
            if (arg.Length < 1)
            {
                System.Console.WriteLine("Usage: JLex.Main <filename>");
                return;
            }

            /* Note: For debuging, it may be helpful to remove the try/catch
               block and permit the Exception to propagate to the top level. 
               This gives more information. */
            try 
            {	
                lg = new CLexGen(arg[0]);
                lg.generate();
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine(e.Message);
            }
        }
Beispiel #3
0
        /***************************************************************
         *    Function: main
         **************************************************************/
        public static int Main
        (
            string[] arg
        )
        {
            Console.WriteLine("cs_lex {0}", string.Join(" ", arg));
#if !DEBUG
            try
            {
#endif
            CLexGen lg;
            if (arg.Length < 1)
            {
                Console.WriteLine("Usage: JLex.Main <filename>");
                return(1);
            }

            string outfile = arg[0] + ".cs";

            if (File.GetLastWriteTime(typeof(CS_Lex).Assembly.Location) > File.GetLastWriteTime(outfile))
            {
            }
            else if (File.Exists(outfile) && new FileInfo(outfile).Length > 0)
            {
                if (File.GetLastWriteTime(arg[0]) < File.GetLastWriteTime(outfile))
                {
                    return(0);
                }
            }

            lg = new CLexGen(arg[0]);
            lg.generate();

#if !DEBUG
        }

        catch (Exception ex)
        {
            Console.Error.WriteLine(ex.Message);
            return(1);
        }
#endif
            return(0);
        }