public TSQLStatementReader( TextReader tsqlStream) { tokenizer = new TSQLTokenizer(tsqlStream); // move to first token tokenizer.MoveNext(); }
public bool MoveNext() { CheckDisposed(); if (_hasMore) { while ( _tokenizer.MoveNext() && ( _tokenizer.Current.Type == TSQLTokenType.SingleLineComment || _tokenizer.Current.Type == TSQLTokenType.MultilineComment || _tokenizer.Current.Type == TSQLTokenType.Whitespace || ( _tokenizer.Current.Type == TSQLTokenType.Character && _tokenizer.Current.AsCharacter.Character == TSQLCharacters.Semicolon ) )) { } if (_tokenizer.Current == null) { _hasMore = false; return(_hasMore); } _current = new TSQLStatementParserFactory().Create(_tokenizer.Current).Parse(_tokenizer); } return(_hasMore); }
public bool MoveNext() { CheckDisposed(); if (_hasMore) { // push the tokenizer to the next token // eat up any tokens inbetween statements until we get to something that might start a new statement // which should be a keyword if the batch is valid // if the last statement parser did not swallow the final semicolon, or there were multiple semicolons, we will swallow it also while ( _tokenizer.MoveNext() && ( _tokenizer.Current.Type == TSQLTokenType.SingleLineComment || _tokenizer.Current.Type == TSQLTokenType.MultilineComment || _tokenizer.Current.Type == TSQLTokenType.Whitespace || ( _tokenizer.Current.Type == TSQLTokenType.Character && _tokenizer.Current.AsCharacter.Character == TSQLCharacters.Semicolon ) )) { ; } if (_tokenizer.Current == null) { _hasMore = false; return(_hasMore); } _current = new TSQLStatementParserFactory().Create(_tokenizer).Parse(); } return(_hasMore); }