Example #1
0
 public void Init()
 {
     if (!_tokenizer.MoveNext())
     {
         ParseException.ExpectedToken();
     }
     _lookahead = _tokenizer.Token;
 }
Example #2
0
 public bool Exist(Token name)
 {
     return _tags.Any(t => t.TagName.Equals(name));
 }
Example #3
0
 public ITag Get(Token name)
 {
     return Get(name.Contents, name.Context);
 }
Example #4
0
 private void ReinitLookAhead()
 {
     if (_tokenizer.MoveNext())
     {
         _lookahead = _tokenizer.Token;
     }
 }
Example #5
0
 private void InitLookAhead()
 {
     if (_tokenizer.MoveNext())
     {
         _previous = _current;
         _current = _lookahead;
         _lookahead = _tokenizer.Token;
     }
 }
Example #6
0
 public Token Next()
 {
     _previous = _current;
     _current = _lookahead;
     _lookahead = null;
     if (_tokenizer.MoveNext())
     {
         _lookahead = _tokenizer.Token;
     }
     if (_current == null)
     {
         throw ParseException.ExpectedToken().Decorate(_previous);
     }
     return _current;
 }
Example #7
0
 public TextPart(Token token)
     : this(token.Contents, token.Context)
 {
 }
Example #8
0
        public bool At(ICollection <string> expectedTokens)
        {
            Token current = Current;

            return(Current != null?expectedTokens.Contains(current.Contents) : false);
        }