blob: 46675cb258ece3aa423b0b8712be1406f83b0094 [file] [log] [blame]
drh60a15a42015-10-07 12:21:14 +00001#!/usr/bin/tclsh
2#
3# This script appends additional token codes to the end of the
4# parse.h file that lemon generates. These extra token codes are
5# not used by the parser. But they are used by the tokenizer and/or
6# the code generator.
7#
8#
9set in [open [lindex $argv 0] rb]
10set max 0
11while {![eof $in]} {
12 set line [gets $in]
13 if {[regexp {^#define TK_} $line]} {
14 puts $line
15 set x [lindex $line 2]
16 if {$x>$max} {set max $x}
17 }
18}
19close $in
20
21# The following are the extra token codes to be added
22#
23set extras {
24 TO_TEXT
25 TO_BLOB
26 TO_NUMERIC
27 TO_INT
28 TO_REAL
29 ISNOT
30 END_OF_FILE
31 ILLEGAL
32 SPACE
33 UNCLOSED_STRING
34 FUNCTION
35 COLUMN
36 AGG_FUNCTION
37 AGG_COLUMN
38 UMINUS
39 UPLUS
40 REGISTER
41}
42foreach x $extras {
43 incr max
44 puts [format "#define TK_%-29s %4d" $x $max]
45}