Re: Unquoted strings in BASIC
Hans Ã…berg <[email protected]> Tue, 3 Dec 2024 17:57:13 +0100
| Newsgroups | gmane.comp.parsers.bison.general |
|---|---|
| Message-ID | <[email protected]> |
> On 3 Dec 2024, at 17:44, Maury Markowitz <[email protected]> = wrote: >=20 >> On Dec 1, 2024, at 2:07=E2=80=AFPM, James K. Lowden = <[email protected]> wrote: >>=20 >> require some real thinking, never easy. For example, is >>=20 >> 10100 DATA "one",2B,"three" >>=20 >> valid? If it is, you'll need one pattern for "leading alpha" that = might >> be just one character, and another for "leading digit" that requires >=20 > On further reflection, it seems it is much easier to parse everything = in the data section as a string, and then turn it into a string or = number at runtime based on the variable that's reading it. That's how = INPUT works, so I can re-use that code. It might be easier to first write a rule for unquoted strings, and then = add a start condition when the quote arrives. This parallels the example = with any_identifier that I gave. In general, one tries to exploit tokens to do special things, which is = also useful in a Bison parser when adding mid-rule actions.