Example #1
0
 public override LineMatch Match(ParsedLine line)
 {
     var textLine = line.Text.Trim(WhiteSpace).ToLower();
     if (textLine.StartsWith("file://"))
         return new LineMatch(@"file://", line.Text, line, this);
     return null;
 }
 public void Should_not_match_if_token_in_middle_of_string()
 {
     var listener = MockRepository.GenerateMock<IListener>();
     var parsedLine = new ParsedLine("Given R#", "\n", 1);
     var commentLexer = new CommentLexer(null, new LineEnumerator(new[] { parsedLine }), listener, new Language("en"));
     var match = commentLexer.Match(parsedLine);
     Assert.IsNull(match);
 }
Example #3
0
 public virtual LineMatch Match(ParsedLine line)
 {
     var match = regex.Match(line.Text);
     if (match.Success == false)
         return null;
     var keyword = match.Groups["keyword"].Value.Trim().TrimEnd(new[] { ':' });
     return new LineMatch(keyword, match.Groups["text"].Value.Trim(), line, this);
 }
Example #4
0
 public LineMatch Match(ParsedLine line)
 {
     LineMatch match = null;
     lexers.FirstOrDefault(_ =>
                               {
                                   match = _.Lexer.Match(line);
                                   return match != null;
                               });
     return match;
 }
Example #5
0
 public LexerError(ParsedLine currentWord)
     : base(string.Format("Line: {0}. Failed to parse '{1}'", currentWord.Line, currentWord.Text))
 {
 }