public TinyToken Parse(IEnumerable <Token <YamlTokenType> > tokens) { TinyToken result = null; var context = new ParseContext <YamlTokenType>(tokens, new AnyParser(r => result = r)); while (context.CurrentToken != null) { switch (context.CurrentToken.Type) { case YamlTokenType.Indent: context.Indent(context.CurrentToken.Value.Length / 2); context.ConsumeToken(); continue; case YamlTokenType.EndLine: context.NewLine(); context.ConsumeToken(); continue; } //Debug.Print($" - {context.Parser.GetType().Name} ({context.ParserCount})"); context.Parser.Parse(context); } context.End(); return(result); }
public TinyToken Parse(IEnumerable <Token <JsonTokenType> > tokens) { TinyToken result = null; var context = new ParseContext <JsonTokenType>(tokens, new AnyParser(r => result = r)); while (context.CurrentToken != null) { //Debug.Print($" - {context.Parser.GetType().Name} ({context.ParserCount}) {context.CurrentToken}"); context.Parser.Parse(context); } context.End(); return(result); }