diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-02-24 19:21:53 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-02-24 19:21:53 (GMT) |
commit | 9bfe0e4b83c2b315ead079a9e6c746173878f0af (patch) | |
tree | b27da73b31fb3726391576b43970ba43bdf8dfc0 /taccle/taccle.tcl | |
parent | 64443ae4af0357574ac3108258ac0f315e2a3bc9 (diff) | |
download | blt-9bfe0e4b83c2b315ead079a9e6c746173878f0af.zip blt-9bfe0e4b83c2b315ead079a9e6c746173878f0af.tar.gz blt-9bfe0e4b83c2b315ead079a9e6c746173878f0af.tar.bz2 |
add support for namespaces
Diffstat (limited to 'taccle/taccle.tcl')
-rw-r--r-- | taccle/taccle.tcl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/taccle/taccle.tcl b/taccle/taccle.tcl index e3d11fe..b2e67b3 100644 --- a/taccle/taccle.tcl +++ b/taccle/taccle.tcl @@ -4,6 +4,12 @@ set TACCLE_VERSION 1.2 +# no yydebug +# no YYDEBUG +# no yyerrok +# no YYERROR +# no YYRECOVERING + #//# # Taccle is another compiler compiler written in pure Tcl. reads a # <em>taccle specification file</em> to generate pure Tcl code that @@ -837,6 +843,7 @@ namespace eval ${::p} \{ variable table variable rules variable token {} + variable yycnt 0 namespace export yylex \} @@ -851,7 +858,9 @@ proc ${::p}::YYACCEPT \{\} \{ proc ${::p}::yyclearin \{\} \{ variable token + variable yycnt set token {} + incr yycnt -1 \} proc ${::p}::yyerror \{s\} \{ @@ -889,6 +898,7 @@ proc write_parser {} { variable table variable rules variable token + variable yycnt set state_stack {0} set value_stack {{}} @@ -901,6 +911,9 @@ proc write_parser {} { set yylval \"\" set token \[yylex\] set buflval \$yylval + if {\$token>0} { + incr yycnt + } } if {!\[info exists table(\$state:\$token)\]} { \# pop off states until error token accepted |