Repository navigation
Commit 927c724
committed
fix: link statements nested in others, and position every comment
Statements that never pass through SingleStatement get their node where
they are built: data-modifying CTEs, statements inside an Oracle block,
CREATE SCHEMA elements, CREATE TABLE ... AS EXECUTE and the GRANT or
REVOKE of ALTER DEFAULT PRIVILEGES. An IF statement's range takes in the
semicolon it prints.
A RangeNode that widens a tree node answers its children, id and dump
too, so a WITH statement's node still shows the tree beneath it.
Comments are positioned in one backwards pass over the recorded match
begins, and comments before the end of input are positioned once
parsing ends, since the end-of-file token gets no token action.
Values in a primary expression, string literals, expression lists and
row patterns get a RangeNode only once something wraps them, so a
production's own tree node is the only node most of them get. On a
20,000-row INSERT ... VALUES this cuts the added allocation from 12.9%
to 3.2%.
The coverage test parses the Oracle tests in the Oracle dialect, checks
that getParent() encloses each range, and runs its checks over the
statements above, which the test corpus does not contain.1 parent 4702549 commit 927c724
4 files changed
Lines changed: 214 additions & 83 deletions
File tree
- src
- main
- java/net/sf/jsqlparser/parser
- jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/parser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
31 | 71 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
117 | 118 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
122 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
123 | 132 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 133 | | |
129 | 134 | | |
130 | 135 | | |
| |||
0 commit comments