Subject: | QBE parse Update
| Date: | Sat, 27 Jan 2018 06:28:00 +1000
| From: | Bernie van't Hof <berniev@bje.com.au>
| Newsgroups: | pnews.paradox-dos
|
I'm first trying to get parsing playing nicely without wildcards.
Whether or not this is a mistake will be seen later.
It is now state table based and tracks input types much more closely,
greatly reducing code complexity.
Yesterday I realised links (_link) can be referenced before where
defined but I need to know their column types. So I added a first-pass
to dig them all out. I can't see a way around that.
With two passes it is likely much could be improved/changed, but for now
I'll leave the rest of the code structure alone.
Date math gets interesting:
11-Jan-2016-1/10/2016+15.10.2016-4
produces:
DATE_SUB(DATE_ADD('2016-10-15', INTERVAL DATEDIFF('2016-1-11',
'2016-1-10') DAY), INTERVAL 4 DAY)
Two-digit years <70 ==> 20xx, >=70 ==> 19xx
Unlike pdox 2 + 10-oct-2017 in a date column produces
DATE_ADD('2017-10-10', INTERVAL '2' DAY) instead of a type error.
Still lots to do, but feels like it is heading in the right direction.
Even as I write this I'm wondering if I shouldn't add lookahead/rollback
into the stream component so the lexer can give higher-level tokens to
further simplify parsing .....
|