Re: Unquoted strings in BASIC

Maury Markowitz <[email protected]> Wed, 4 Dec 2024 16:30:41 -0500
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
To top this thread off, I went with this:


 /* DATA statements convert everything to a string */
<DATA_STATEMENT>{
[^,:\n]* {
            // eat any leading and trailing whitespace
            yytext =3D str_trim(yytext);
           =20
            // and quotes
            yytext =3D str_unquote(yytext);

            yylval.s =3D str_new(yytext);
            return STRING;
          }

[,] { return ','; } // triggers the exprlist syntax
=20
 /* colons or line-ends end the data statement and reset the state */
[:] { BEGIN(INITIAL); return ':'; }
[\n] { BEGIN(INITIAL); return '\n'; }
}

It's worked with everything I've thrown at it from every book I could =
find. Hans noted that it would be best to do this in the patterns, and I =
agree, but working is a feature!

Now I just have to get my matrix inversion working and we're good to =
release.=