diff options
author | Mark Lindner <hyperrealm@gmail.com> | 2023-12-26 10:05:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-26 10:05:52 -0700 |
commit | f9404f60a435aa06321f4ccd8357364dcb216d46 (patch) | |
tree | 6ea8e2127236817d9dee7b18761a462228363202 | |
parent | 52429168334ac93334ef8557638c5ce1686f94c4 (diff) | |
parent | 94d1084104a289a7c2c8b1efe129ab6b2f28fba6 (diff) | |
download | libconfig-upstream-master.tar.gz |
Merge pull request #223 from fe-dagostino/fix_escapingupstream-master
add \a \b \v for correct escaping
-rw-r--r-- | doc/libconfig.texi | 2 | ||||
-rw-r--r-- | lib/scanner.l | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/doc/libconfig.texi b/doc/libconfig.texi index 07310ce..97f8501 100644 --- a/doc/libconfig.texi +++ b/doc/libconfig.texi @@ -563,7 +563,7 @@ Boolean values may have one of the following values: @samp{true}, String values consist of arbitrary text delimited by double quotes. Literal double quotes can be escaped by preceding them with a backslash: @samp{\"}. The escape sequences @samp{\\}, @samp{\f}, -@samp{\n}, @samp{\r}, and @samp{\t} are also recognized, and have the +@samp{\n}, @samp{\r}, @samp{\a}, @samp{\b}, @samp{\v} and @samp{\t} are also recognized, and have the usual meaning. In addition, the @samp{\x} escape sequence is supported; this sequence diff --git a/lib/scanner.l b/lib/scanner.l index 6b750e4..57b9754 100644 --- a/lib/scanner.l +++ b/lib/scanner.l @@ -81,9 +81,12 @@ include_open ^[ \t]*@include[ \t]+\" \" { BEGIN STRING; } <STRING>[^\"\\]+ { libconfig_scanctx_append_string(yyextra, yytext); } +<STRING>\\a { libconfig_scanctx_append_char(yyextra, '\a'); } +<STRING>\\b { libconfig_scanctx_append_char(yyextra, '\b'); } <STRING>\\n { libconfig_scanctx_append_char(yyextra, '\n'); } <STRING>\\r { libconfig_scanctx_append_char(yyextra, '\r'); } <STRING>\\t { libconfig_scanctx_append_char(yyextra, '\t'); } +<STRING>\\v { libconfig_scanctx_append_char(yyextra, '\v'); } <STRING>\\f { libconfig_scanctx_append_char(yyextra, '\f'); } <STRING>\\\\ { libconfig_scanctx_append_char(yyextra, '\\'); } <STRING>\\\" { libconfig_scanctx_append_char(yyextra, '\"'); } @@ -125,7 +128,7 @@ include_open ^[ \t]*@include[ \t]+\" BEGIN INITIAL; } -\n|\r|\f { /* ignore */ } +\n|\r|\f|\a|\b|\v { /* ignore */ } [ \t]+ { /* ignore */ } \=|\: { return(TOK_EQUALS); } |