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

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