# -*- tcl -*- ## Parsing Expression Grammar '@NAME@'. ## Recursive Descent Packrat parser generated ## by the PAGE writer plugin 'me'. @COPY@ # ### ### ### ######### ######### ######### ## Package description # The commands provided here match an input provided through a buffer # command to the PE grammar '@NAME@'. The parser is based on the package # 'grammar::me::tcl' (recursive-descent, packrat, pulling chars, # pushing the generated AST). # ### ### ### ######### ######### ######### ## Requisites package require grammar::me::tcl # ### ### ### ######### ######### ######### ## Implementation namespace eval ::@PKG@ { # Import the virtual machine for matching. namespace import ::grammar::me::tcl::* upvar #0 ::grammar::me::tcl::ok ok } # ### ### ### ######### ######### ######### ## API Implementation. proc ::@PKG@::parse {nxcmd emvar astvar} { variable ok variable se upvar 1 $emvar emsg $astvar ast init $nxcmd @MATCH@ isv_nonterminal_reduce ALL -1 set ast [sv] if {!$ok} { foreach {l m} [ier_get] break lappend l [lc $l] set emsg [list $l $m] } return $ok } # ### ### ### ######### ######### ######### ## Internal helper methods @RULES@ # ### ### ### ######### ######### ######### ## Package Management package provide @PKG@ 0.1