コード例 #1
0
ファイル: Lexer.cs プロジェクト: xavierzwirtz/sqltoolsservice
        /// <summary>
        /// Push current input into the stack
        /// </summary>
        public void PushInput(TextReader reader, string name)
        {
            Debug.Assert(currentToken != null &&
                         (currentToken.TokenType == LexerTokenType.NewLine || currentToken.TokenType == LexerTokenType.Eof), "New input can only be pushed after new line token or EOF");

            if (name.Equals(currentInput.Filename, StringComparison.OrdinalIgnoreCase))
            {
                RaiseError(ErrorCode.CircularReference, GetCircularReferenceErrorMessage(name));
            }

            foreach (LexerInput input in inputStack)
            {
                if (name.Equals(input.Filename, StringComparison.OrdinalIgnoreCase))
                {
                    RaiseError(ErrorCode.CircularReference, GetCircularReferenceErrorMessage(name));
                }
            }

            inputStack.Push(currentInput);
            currentInput = new LexerInput(reader, name);
            SetState(RuleLine);
            // We don't want to close the input, in that case the current file would be taken out of the
            // input stack and cycle detection won't work.
            popInputAtNextConsume = false;
            ConsumeToken();
        }
コード例 #2
0
ファイル: Lexer.cs プロジェクト: xavierzwirtz/sqltoolsservice
        /// <summary>
        /// Constructor for the lexer class used by SMO Batch Parser
        /// </summary>
        public Lexer(TextReader input, string name)
        {
            currentInput          = new LexerInput(input, name);
            currentToken          = null;
            RecognizeSqlCmdSyntax = true;

            SetState(RuleLine);
        }
コード例 #3
0
ファイル: Lexer.cs プロジェクト: xavierzwirtz/sqltoolsservice
 public void PopAndCloseInput()
 {
     if (currentInput != null)
     {
         currentInput.Dispose();
         currentInput = null;
     }
     if (inputStack.Count > 0)
     {
         currentInput = inputStack.Pop();
         SetState(RuleLine);
     }
 }