Commit 1b8c3858 authored by POTTIER Francois's avatar POTTIER Francois

Disallow the escape sequence \n in a token alias.

parent 24bd0387
......@@ -782,10 +782,16 @@ and string openingpos = parse
and record_string openingpos buffer = parse
| '"'
{ Buffer.contents buffer }
| ('\\' ['\\' '\'' '"' 'n' 't' 'b' 'r' ' ']) as sequence
| ('\\' ['\\' '\'' '"' 't' 'b' 'r' ' ']) as sequence
{ (* This escape sequence is recognized as such, but not decoded. *)
Buffer.add_string buffer sequence;
record_string openingpos buffer lexbuf }
| '\\' 'n'
(* We disallow this escape sequence in a token alias because we wish
to use this string (unescaped) when we print a concrete sentence
in a .messages file (see [Interpret]), and we want this sentence
to fit on a single line. *)
{ error2 lexbuf "'\\n' is not permitted in a token alias." }
| '\\' _
{ error2 lexbuf "illegal backslash escape in string." }
| newline
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment