pascalabcnet/Parsers/PascalABCParserNewSaushkin/GPLex_GPPG/guesser.frame
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

78 lines
1.9 KiB
Plaintext

##
## DO NOT EDIT THIS FILE CARELESSLY!
## THE CONTENTS OF THIS FILE ARE STRONGLY LINKED TO THE
## CODE OF Dfsa.cs, AND ALL MUST VARY TOGETHER
##
## This frame file produces an include file for gplex
## C# output. It does not produce a stand-alone scanner
## and uses not defined symbols, or "using" declarations.
## This only works for automata with no backup states!
##
//
// Guesser.frame version 1.1.0 of 30-January-2009
//
##-->version255
##-->usingDcl
{
public enum Tokens { EndToken = 0, MaxParseToken = int.MaxValue }
public class Scanner
{
ScanBuff buffer;
enum Result {accept, noMatch, contextFound};
bool yywrap() { return true; }
public int GuessCodePage() { return Scan(); }
##-->consts
#region user code
##-->codeIncl
#endregion user code
int state;
int currentStart = startState[0];
int code;
##-->tableDef
public Scanner(System.IO.Stream file) { SetSource(file); }
public void SetSource(System.IO.Stream source)
{
this.buffer = new BuildBuffer(source);
code = buffer.Read();
}
int Scan()
{
##-->prolog
for (; ; )
{
int next;
state = currentStart;
while ((next = NextState()) == goStart)
code = buffer.Read();
state = next;
code = buffer.Read();
while ((next = NextState()) > eofNum)
{
state = next;
code = buffer.Read();
}
if (state <= maxAccept)
{
##-->actionCases
}
}
##-->epilog
}
##-->userCode
} // end class Scanner
} // end namespace