internal void Process(string fileArg) { GetNames(fileArg); // check for file exists OpenSource(); // parse source file if (inputFile != null) { DateTime start = DateTime.Now; try { handler = new ErrorHandler(); scanner = new QUT.Gplex.Lexer.Scanner(inputFile); parser = new QUT.Gplex.Parser.Parser(scanner); scanner.yyhdlr = handler; parser.Initialize(this, scanner, handler, new OptionParser2(ParseOption)); aast = parser.Aast; parser.Parse(); // aast.DiagnosticDump(); if (verbose) Status(start); CheckOptions(); if (!Errors && !ParseOnly) { // build NFSA if (ChrClasses) { DateTime t0 = DateTime.Now; partition = new Partition( TargetSymCardinality, this ); partition.FindClasses( aast ); partition.FixMap(); if (verbose) ClassStatus( t0, partition.Length ); } else CharRange.Init( TargetSymCardinality ); nfsa = new NFSA(this); nfsa.Build(aast); if (!Errors) { // convert to DFSA dfsa = new DFSA(this); dfsa.Convert(nfsa); if (!Errors) { // minimize automaton if (minimize) dfsa.Minimize(); if (!Errors && !checkOnly) { // emit the scanner to output file TextReader frameRdr = FrameReader(); TextWriter outputWrtr = OutputWriter(); dfsa.EmitScanner(frameRdr, outputWrtr); if (!embedBuffers) CopyBufferCode(); // Clean up! if (frameRdr != null) frameRdr.Close(); if (outputWrtr != null) outputWrtr.Close(); } } } } } catch (Exception ex) { string str = ex.Message; handler.AddError(str, aast.AtStart); throw; } } }
internal void Process(string fileArg) { GetNames(fileArg); // check for file exists OpenSource(); // parse source file if (inputFile != null) { DateTime start = DateTime.Now; try { handler = new ErrorHandler(); scanner = new QUT.Gplex.Lexer.Scanner(inputFile); parser = new QUT.Gplex.Parser.Parser(scanner); scanner.yyhdlr = handler; parser.Initialize(this, scanner, handler, new OptionParser2(ParseOption)); aast = parser.Aast; parser.Parse(); // aast.DiagnosticDump(); if (verbose) { Status(start); } CheckOptions(); if (!Errors && !ParseOnly) { // build NFSA if (ChrClasses) { DateTime t0 = DateTime.Now; partition = new Partition(TargetSymCardinality, this); partition.FindClasses(aast); partition.FixMap(); if (verbose) { ClassStatus(t0, partition.Length); } } else { CharRange.Init(TargetSymCardinality); } nfsa = new NFSA(this); nfsa.Build(aast); if (!Errors) { // convert to DFSA dfsa = new DFSA(this); dfsa.Convert(nfsa); if (!Errors) { // minimize automaton if (minimize) { dfsa.Minimize(); } if (!Errors && !checkOnly) { // emit the scanner to output file TextReader frameRdr = FrameReader(); TextWriter outputWrtr = OutputWriter(); dfsa.EmitScanner(frameRdr, outputWrtr); if (!embedBuffers) { CopyBufferCode(); } // Clean up! if (frameRdr != null) { frameRdr.Close(); } if (outputWrtr != null) { outputWrtr.Close(); } } } } } } catch (Exception ex) { string str = ex.Message; handler.AddError(str, aast.AtStart); throw; } } }