Sometimes it comes out more beautiful, sometimes it is not.
Tried ZestyParser.
Here is the banal parsing of a phrase "create or replace"
from ZestyParser import *
sp = Omit((RE('\s+')) + Skip((RE('#[^\n]*\n') | RE('\s+'))))
create_package = RawToken('create') + sp
+ ((RawToken('or') + sp + RawToken('replace')) | EmptyToken)
ZestyParser('create or replace').scan(create_package)
I have to dig it further, so far it comes out ugly enough.
No comments:
Post a Comment