Re: Unquoted strings in BASIC

2024-12-01 Thread Hans Åberg
> On 1 Dec 2024, at 19:08, Maury Markowitz wrote: > >> This will probably require you to take into account the current context; see >> Hans's reply. > > Yeah, I am completely new to that side of things. I'm in the bison dox now > and I can't say I'm understanding much yet. Check the Flex ma

Re: Unquoted strings in BASIC

2024-12-01 Thread Maury Markowitz
> On Nov 30, 2024, at 8:42 PM, James K. Lowden wrote: > I'm just a bit skeptical. If the rule is that > >> DATA 10,20,"HELLO,WORLD!" > and >> DATA 10,20,HELLO,WORLD! > Or is it the case that the quoted equivalent would be > >> DATA 10,20,"HELLO","WORLD!" This. It's basically CSV, and given

Re: Unquoted strings in BASIC

2024-12-01 Thread Maury Markowitz
> On Dec 1, 2024, at 12:31 PM, EML wrote: > > This matches, among other things, a string which starts with a double quote, > terminated by a newline, with no closing quote. Not even Basic can be that > bad. Sorry to be the bearer of bad news, but BASIC is precisely that bad. Since many PRINTs

Re: Unquoted strings in BASIC

2024-12-01 Thread Hans Åberg
> On 1 Dec 2024, at 16:07, Maury Markowitz wrote: > > But many dialects allow strings to be unquoted as long as they do not contain > a line end, colon or comma: > > DATA 10,20,HELLO,WORLD! One way is to use context switches; see the Flex and Bison manuals. In the .l file one has say: %x D

Re: Unquoted strings in BASIC

2024-12-01 Thread EML
Basic... wow. Start by fixing your regexes: [0-9]*[0-9.][0-9]*([Ee][-+]?[0-9]+)? { yylval.d = strtod(yytext, NULL); return NUMBER; } This matches a single '.', '.E0', and so on. Presumably you want something which looks more like dec_digit [0-9] suffix 

Re: Unquoted strings in BASIC

2024-12-01 Thread James K. Lowden
On Sun, 1 Dec 2024 10:07:45 -0500 Maury Markowitz wrote: > DATA 10,20,HELLO,WORLD! > > I am looking for ways to attack this. To add to what Hans said, you want to extend what the scanner accepts in a DATA statement. In your case, DATA has a slightly more expansive view of what an expression is

Unquoted strings in BASIC

2024-12-01 Thread Maury Markowitz
I seem to have programmed myself into a corner, and I'm hoping someone can offer some suggestions. Source code here: https://github.com/maurymarkowitz/RetroBASIC/tree/master/src The BASIC language has two constant types, numbers and strings. The ~300 line scanner is basically a list of the keyw