public VBLexer(TextReader reader, VBLexerMemento state) : this(reader)
		{
			SetInitialLocation(new TextLocation(state.Line, state.Column));
			lastToken = new Token(state.PrevTokenKind, 0, 0);
			ef = new ExpressionFinder(state.ExpressionFinder);
			lineEnd = state.LineEnd;
			isAtLineBegin = state.IsAtLineBegin;
			encounteredLineContinuation = state.EncounteredLineContinuation;
			misreadExclamationMarkAsTypeCharacter = state.MisreadExclamationMarkAsTypeCharacter;
			xmlModeStack = new Stack<XmlModeInfo>(state.XmlModeInfoStack.Select(i => (XmlModeInfo)i.Clone()).Reverse());
			inXmlMode = state.InXmlMode;
		}
		public VBLexer(TextReader reader)
		{
			this.reader = new LATextReader(reader);
			ef = new ExpressionFinder();
		}
Example #3
0
		void RunTest(string code, string expectedOutput)
		{
			ExpressionFinder p = new ExpressionFinder();
			VBLexer lexer = new VBLexer(new StringReader(code));
			Token t;
			
			do {
				t = lexer.NextToken();
				p.InformToken(t);
			} while (t.Kind != Tokens.EOF);
			
			Console.WriteLine(p.Output);
			
			Assert.IsEmpty(p.Errors);
			
			Assert.AreEqual(expectedOutput.Replace("\r", ""),
			                p.Output.Replace("\r", ""));
		}