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); }
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); }
public LineMatch Match(ParsedLine line) { LineMatch match = null; lexers.FirstOrDefault(_ => { match = _.Lexer.Match(line); return match != null; }); return match; }
public LexerError(ParsedLine currentWord) : base(string.Format("Line: {0}. Failed to parse '{1}'", currentWord.Line, currentWord.Text)) { }