Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 public void ThrowOnUnrecognizedDirective()
 {
     Lexer lexer = new Lexer("{$FOO}", "");
     TokenFilter filter = new TokenFilter(lexer.Tokens, _defines, _fileLoader);
     new List<Token>(filter.Tokens);
 }