Skip to content

Instantly share code, notes, and snippets.

Created March 8, 2017 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/2c04533cb3a61a00b8822ea20237ba7e to your computer and use it in GitHub Desktop.
Save anonymous/2c04533cb3a61a00b8822ea20237ba7e to your computer and use it in GitHub Desktop.
use Grammar::Tracer;
grammar TEST {
rule TEST { <from> <where> }
rule from {:i FROM <selectedtable> [',' <selectedtable>]* }
rule selectedtable {[<shema_name>'.']?<tablename>['@'<linkname>]? [<alias>]? }
token shema_name { <identifier> }
regex tablename { <identifier> }
token linkname { <identifier> }
regex alias { <identifier> }
token identifier {:i <ident>+ }
rule where {:i WHERE .* }
regex comma {',' }
}
my $fic = q:to/FIN_INI/;
FROM table1 ,table2 WHERE t1 = t2(+)
FIN_INI
say TEST.parse($fic, rule => 'TEST');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment