示例#1
0
//        public bool MoveNextIgnoreWhiteSpace()
//        {
//            _index+=Configuration.JumpWhiteSpace(_index);
//            return MoveNext();
//        }

        private void InternalMoveNext()
        {
            DetermineState();
            switch (_state)
            {
            case TokenizerState.Seperator:
                HandleSeperator();
                break;

            case TokenizerState.Literal:
                if (_configuration.ReturnLiterals)
                {
                    HandeLiteral();
                }
                else
                {
                    HandeNormal();
                }
                break;

            case TokenizerState.Normal:
                HandeNormal();
                break;

            default:
                throw TokenException.IllegalStateAt(
                          CurrentChar(),
                          _index,
                          _state).Decorate(_current);
            }
        }
示例#2
0
 private void GuardEndState()
 {
     if (!HasNext() && _state != TokenizerState.Normal)
     {
         TokenException.IllegalStateAtEnd(_index, _state);
     }
 }
示例#3
0
 private char Read(Is isMethod)
 {
     if (!isMethod())
     {
         throw TokenException.Expected(isMethod, _index).Decorate(_current);
     }
     return(NextChar());
 }
示例#4
0
 private void ThrowUnClosedLiteral(int start)
 {
     throw TokenException.UnTerminatedLiteral(start + 1).Decorate(
               new Token(TokenType.Literal,
                         _template[start].ToString(),
                         start,
                         _template,
                         _offSet
                         )
               );
 }
示例#5
0
        private void ThrowExpectedMoreCharacters()
        {
            throw TokenException.MoreCharactersExpectedAt(_index).Decorate(
                      _current ??
                      new Token(TokenType.NotSet,
                                _template[_index - 1].ToString(),
                                _index - 1,
                                _template, _offSet

                                )
                      );
        }