Permalink
Browse files

Fixed handling of escape sequences in pire_inline.

  • Loading branch information...
1 parent dd4219e commit 13494225e2a6846594bd9ea14b41826b93dd9521 Dmitry Prokoptsev committed Dec 1, 2011
Showing with 4 additions and 0 deletions.
  1. +1 −0 pire/inline.lpp
  2. +3 −0 tests/inline_ut.cpp
View
@@ -79,6 +79,7 @@ void eatComment(void (*action)(char));
<Regexp>"/*" { eatComment(suppressChar); }
<INITIAL>"//".*\n { ++line; fprintf(yyout, "%s", yytext); }
<Regexp>"//".*\n { ++line; }
+<INITIAL>"\\". { fprintf(yyout, "%s", yytext); if (yytext[1] == '\n') ++line; }
"\""([^\"]|\\.)*"\"" { fprintf(yyout, "%s", yytext); }
\n { ++line; putc('\n', yyout); }
View
@@ -60,6 +60,9 @@ bool ParticularMatch(Pire::Scanner& sc, Pire::Scanner::State st, size_t idx)
SIMPLE_UNIT_TEST(Inline)
{
+ const char* STRING_WITH_BACKSHASHED_QUOTES = "aaa\"bbb";
+ ++STRING_WITH_BACKSHASHED_QUOTES; // Suppress 'unused variable' warning
+
Pire::Scanner scanner = PIRE_REGEXP("http://([a-z0-9]+\\.)+[a-z]{2,4}/?", "is");
UNIT_ASSERT(Matches(scanner, "http://domain.vasya.ru/"));
UNIT_ASSERT(Matches(scanner, "prefix http://domain.vasya.ru/"));

0 comments on commit 1349422

Please sign in to comment.