public override bool Matches(object actual) { string source = (string) actual; Lexer lexer = new Lexer(source, ""); IEnumerable<Token> filteredTokens = _filter(lexer.Tokens); List<Token> lexedTokens = new List<Token>(filteredTokens); List<string> inspectedTokens = lexedTokens.ConvertAll<string>( delegate(Token token) { return token.Inspect(); }); string actualString = String.Join(Environment.NewLine, inspectedTokens.ToArray()); return base.Matches(actualString); }
private IEnumerable<Token> GetSourceTokensForInclude(Token token, string baseName) { string currentDirectory = token.Location.Directory; string fileName = _fileLoader.ExpandFileName(currentDirectory, baseName); string source = _fileLoader.Load(fileName); Lexer lexer = new Lexer(source, fileName); return lexer.Tokens; }
public void ThrowOnUnrecognizedDirective() { Lexer lexer = new Lexer("{$FOO}", ""); TokenFilter filter = new TokenFilter(lexer.Tokens, _defines, _fileLoader); new List<Token>(filter.Tokens); }