-
-
Save jasondown/743596ce2c0ce5ebc12d9fe2e069cbe6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ParserState | |
{ | |
private readonly Parser _parser; | |
protected ParserState(Parser parser) | |
{ | |
_parser = parser; | |
InitRegex(); | |
} | |
public Parser Parser | |
{ | |
get { return _parser; } | |
} | |
protected Regex VariableRegex { get; private set; } | |
protected int ObjectTypeIndex { get; set; } | |
protected int ObjectIdIndex | |
{ | |
get; | |
set; | |
} | |
// required by all state classes to handle specific | |
// parsing strategy | |
public abstract void ReadLine(string line); | |
public virtual void Reset() | |
{ | |
// related to nested levels of code, | |
// tracking if we are ready for variable declarations etc. | |
} | |
protected void ParseVariable(string line) | |
{ | |
// variable parsing logic here based on the regex below | |
} | |
private void InitRegex() | |
{ | |
// Matching against variablename@variableid : type objectid; | |
// e.g. BinContent@1000 : Record 7302; | |
// VariableRegex is set here | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment