In the 'swarmvtabfault' test module, make sure to close the database handle prior...
[sqlite.git] / tool / addopcodes.tcl
blobdfd7fac88cea4af7b4af90b10858ca2a55b9f576
1 #!/usr/bin/tclsh
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.
9 set in [open [lindex $argv 0] rb]
10 set max 0
11 while {![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}
19 close $in
21 # The following are the extra token codes to be added. SPACE and
22 # ILLEGAL *must* be the last two token codes and they must be in that order.
24 set extras {
25 ISNOT
26 FUNCTION
27 COLUMN
28 AGG_FUNCTION
29 AGG_COLUMN
30 UMINUS
31 UPLUS
32 REGISTER
33 VECTOR
34 SELECT_COLUMN
35 IF_NULL_ROW
36 ASTERISK
37 SPAN
38 END_OF_FILE
39 UNCLOSED_STRING
40 SPACE
41 ILLEGAL
43 if {[lrange $extras end-1 end]!="SPACE ILLEGAL"} {
44 error "SPACE and ILLEGAL must be the last two token codes and they\
45 must be in that order"
47 foreach x $extras {
48 incr max
49 puts [format "#define TK_%-29s %4d" $x $max]
52 # Some additional #defines related to token codes.
54 puts "\n/* The token codes above must all fit in 8 bits */"
55 puts [format "#define %-20s %-6s" TKFLG_MASK 0xff]
56 puts "\n/* Flags that can be added to a token code when it is not"
57 puts "** being stored in a u8: */"
58 foreach {fg val comment} {
59 TKFLG_DONTFOLD 0x100 {/* Omit constant folding optimizations */}
60 } {
61 puts [format "#define %-20s %-6s %s" $fg $val $comment]