]> granicus.if.org Git - yasm/commitdiff
gas-token.re: Use new yasm_unescape_cstring() to handle string constants.
authorPeter Johnson <peter@tortall.net>
Tue, 21 Nov 2006 09:00:29 +0000 (09:00 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 21 Nov 2006 09:00:29 +0000 (09:00 -0000)
svn path=/trunk/yasm/; revision=1697

modules/parsers/gas/gas-token.re

index a4f3700490e1861a3673feb4937e38f8eb3234d6..d9a2c214995365d8bc1e2aa6f9ca4a0bef4c1055 100644 (file)
@@ -562,64 +562,15 @@ stringconst_scan:
     SCANINIT();
 
     /*!re2c
-       /* Escaped constants */
-       "\\b"   {
-           strbuf_append(count++, cursor, s, '\b');
-           goto stringconst_scan;
-       }
-       "\\f"   {
-           strbuf_append(count++, cursor, s, '\f');
-           goto stringconst_scan;
-       }
-       "\\n"   {
-           strbuf_append(count++, cursor, s, '\n');
-           goto stringconst_scan;
-       }
-       "\\r"   {
-           strbuf_append(count++, cursor, s, '\r');
-           goto stringconst_scan;
-       }
-       "\\t"   {
-           strbuf_append(count++, cursor, s, '\t');
-           goto stringconst_scan;
-       }
-       "\\" digit digit digit  {
-           savech = s->tok[TOKLEN];
-           s->tok[TOKLEN] = '\0';
-           lvalp->intn = yasm_intnum_create_oct(TOK+1);
-           s->tok[TOKLEN] = savech;
-
-           strbuf_append(count++, cursor, s,
-                         yasm_intnum_get_int(lvalp->intn));
-           yasm_intnum_destroy(lvalp->intn);
-           goto stringconst_scan;
-       }
-       '\\x' hexdigit+    {
-           savech = s->tok[TOKLEN];
-           s->tok[TOKLEN] = '\0';
-           lvalp->intn = yasm_intnum_create_hex(TOK+2);
-           s->tok[TOKLEN] = savech;
-
-           strbuf_append(count++, cursor, s,
-                         yasm_intnum_get_int(lvalp->intn));
-           yasm_intnum_destroy(lvalp->intn);
-           goto stringconst_scan;
-       }
-       "\\\\"      {
-           strbuf_append(count++, cursor, s, '\\');
-           goto stringconst_scan;
-       }
+       /* Handle escaped double-quote by copying and continuing */
        "\\\""      {
            strbuf_append(count++, cursor, s, '"');
            goto stringconst_scan;
        }
-       /*"\\" any    {
-           strbuf_append(count++, cursor, s, s->tok[0]);
-           goto stringconst_scan;
-       }*/
 
        dquot   {
            strbuf_append(count, cursor, s, '\0');
+           yasm_unescape_cstring(strbuf, &count);
            lvalp->str.contents = (char *)strbuf;
            lvalp->str.len = count;
            RETURN(STRING);