diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-02-29 10:23:36 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-02-29 10:23:36 -0500 |
commit | 7ff4186aa88118a0f3a7bcd2762db82d09a33bbc (patch) | |
tree | fd51e7e136506f298d2ad993392e2380c0e310b3 /minic | |
parent | d3530271f8c0296170d306be276231cb9ebc51e8 (diff) | |
download | roux-7ff4186aa88118a0f3a7bcd2762db82d09a33bbc.tar.gz |
patch minic to new string syntax
Diffstat (limited to 'minic')
-rw-r--r-- | minic/minic.y | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/minic/minic.y b/minic/minic.y index 1ea19c5..8cb4079 100644 --- a/minic/minic.y +++ b/minic/minic.y @@ -893,20 +893,20 @@ yylex() i = 0; n = 32; p = alloc(n); - p[0] = '"'; - for (i=1;; i++) { + strcpy(p, "{ b \""); + for (i=5;; i++) { c = getchar(); if (c == EOF) die("unclosed string literal"); - if (i+1 >= n) { + if (i+8 >= n) { p = memcpy(alloc(n*2), p, n); n *= 2; } p[i] = c; - if (c == '"' && (!i || p[i-1]!='\\')) + if (c == '"' && p[i-1]!='\\') break; } - p[i+1] = 0; + strcpy(&p[i], "\", b 0 }"); if (nglo == NGlo) die("too many globals"); ini[nglo] = p; @@ -950,6 +950,6 @@ main() if (yyparse() != 0) die("parse error"); for (i=1; i<nglo; i++) - fprintf(of, "data $glo%d = {b %s, b 0 }\n", i, ini[i]); + fprintf(of, "data $glo%d = %s\n", i, ini[i]); return 0; } |