Skip to content

Instantly share code, notes, and snippets.

@jasondown
Created August 3, 2021 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondown/d716263a35ad32c9cc389e297c52f4e8 to your computer and use it in GitHub Desktop.
Save jasondown/d716263a35ad32c9cc389e297c52f4e8 to your computer and use it in GitHub Desktop.
public class ObjectHeaderState : ParserState
{
private Regex _regex;
private int _objectTypeIndex;
private int _objectIdIndex;
public ObjectHeaderState(Parser parser)
: base(parser)
{
InitRegex();
}
private void InitRegex()
{
// regex used to pull out object type and id
}
public override void ReadLine(string line)
{
var match = _regex.Match(line);
if (match.Success)
{
// add object to dependency graph if it
// is on the list of imported objects
}
// If we hit OBJECT-PROPERTIES move to next
// state (object properties), otherwise, just ignore
// this line.
else if (line.IndexOf("object-properties", StringComparison.OrdinalIgnoreCase) >= 0)
{
Parser.SetState(Parser.ObjectPropertiesState);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment