Skip to content
This repository
Browse code

Fixed handling of escape sequences in pire_inline.

  • Loading branch information...
commit 13494225e2a6846594bd9ea14b41826b93dd9521 1 parent dd4219e
authored December 01, 2011
1  pire/inline.lpp
@@ -79,6 +79,7 @@ void eatComment(void (*action)(char));
79 79
 <Regexp>"/*"             { eatComment(suppressChar); }
80 80
 <INITIAL>"//".*\n        { ++line; fprintf(yyout, "%s", yytext); }
81 81
 <Regexp>"//".*\n         { ++line; }
  82
+<INITIAL>"\\".           { fprintf(yyout, "%s", yytext); if (yytext[1] == '\n') ++line; }
82 83
 "\""([^\"]|\\.)*"\""     { fprintf(yyout, "%s", yytext); }
83 84
 \n                       { ++line; putc('\n', yyout); }
84 85
 
3  tests/inline_ut.cpp
@@ -60,6 +60,9 @@ bool ParticularMatch(Pire::Scanner& sc, Pire::Scanner::State st, size_t idx)
60 60
 
61 61
 SIMPLE_UNIT_TEST(Inline)
62 62
 {
  63
+	const char* STRING_WITH_BACKSHASHED_QUOTES = "aaa\"bbb";
  64
+	++STRING_WITH_BACKSHASHED_QUOTES; // Suppress 'unused variable' warning
  65
+
63 66
 	Pire::Scanner scanner = PIRE_REGEXP("http://([a-z0-9]+\\.)+[a-z]{2,4}/?", "is");
64 67
 	UNIT_ASSERT(Matches(scanner, "http://domain.vasya.ru/"));
65 68
 	UNIT_ASSERT(Matches(scanner, "prefix http://domain.vasya.ru/"));

0 notes on commit 1349422

Please sign in to comment.
Something went wrong with that request. Please try again.