diff options
author | drh <drh@noemail.net> | 2015-10-07 12:21:14 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-10-07 12:21:14 +0000 |
commit | 60a15a48c583b426fe2fac604e27281b7924bdcd (patch) | |
tree | 30d5756637abcc2ef3eb700d46450a3a6a9f983f /tool/addopcodes.tcl | |
parent | 7651e0a43969cd7e8f524a300cdf8abd094a2a4b (diff) | |
download | sqlite-60a15a48c583b426fe2fac604e27281b7924bdcd.tar.gz sqlite-60a15a48c583b426fe2fac604e27281b7924bdcd.zip |
Change the addopcodes.awk script into tool/addopcodes.tcl.
FossilOrigin-Name: 8bbf37142ef2759274668f6da114b5c8072e42db
Diffstat (limited to 'tool/addopcodes.tcl')
-rw-r--r-- | tool/addopcodes.tcl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tool/addopcodes.tcl b/tool/addopcodes.tcl new file mode 100644 index 000000000..46675cb25 --- /dev/null +++ b/tool/addopcodes.tcl @@ -0,0 +1,45 @@ +#!/usr/bin/tclsh +# +# This script appends additional token codes to the end of the +# parse.h file that lemon generates. These extra token codes are +# not used by the parser. But they are used by the tokenizer and/or +# the code generator. +# +# +set in [open [lindex $argv 0] rb] +set max 0 +while {![eof $in]} { + set line [gets $in] + if {[regexp {^#define TK_} $line]} { + puts $line + set x [lindex $line 2] + if {$x>$max} {set max $x} + } +} +close $in + +# The following are the extra token codes to be added +# +set extras { + TO_TEXT + TO_BLOB + TO_NUMERIC + TO_INT + TO_REAL + ISNOT + END_OF_FILE + ILLEGAL + SPACE + UNCLOSED_STRING + FUNCTION + COLUMN + AGG_FUNCTION + AGG_COLUMN + UMINUS + UPLUS + REGISTER +} +foreach x $extras { + incr max + puts [format "#define TK_%-29s %4d" $x $max] +} |