@@ -25,7 +25,7 @@ interface TokenState {
25
25
}
26
26
27
27
export default class SQLTokeniser {
28
- matchers : Matcher [ ] = [
28
+ static matchers : Matcher [ ] = [
29
29
{
30
30
name : `PROCEDURE_PARM_TYPE` ,
31
31
match : [ { type : `word` , match : ( value : string ) => { return [ `IN` , `OUT` , `INOUT` ] . includes ( value . toUpperCase ( ) ) } } ] ,
@@ -145,6 +145,8 @@ export default class SQLTokeniser {
145
145
readonly startCommentBlock = `/*` ;
146
146
readonly endCommentBlock = `*/` ;
147
147
148
+ storeComments : boolean = false ;
149
+
148
150
constructor ( ) { }
149
151
150
152
tokenise ( content : string ) {
@@ -166,6 +168,11 @@ export default class SQLTokeniser {
166
168
// Handle when the end of line is there and we're in a comment
167
169
} else if ( state === ReadState . IN_SIMPLE_COMMENT && content [ i ] === this . endCommentString ) {
168
170
const preNewLine = i - 1 ;
171
+
172
+ if ( this . storeComments ) {
173
+ result . push ( { value : content . substring ( commentStart , i ) , type : `comment` , range : { start : commentStart , end : i } } ) ;
174
+ }
175
+
169
176
content = content . substring ( 0 , commentStart ) + ` ` . repeat ( preNewLine - commentStart ) + content . substring ( preNewLine ) ;
170
177
i -- ; // So we process the newline next
171
178
state = ReadState . NORMAL ;
@@ -268,8 +275,8 @@ export default class SQLTokeniser {
268
275
let tokens = state . tokens ;
269
276
270
277
for ( let i = 0 ; i < tokens . length ; i ++ ) {
271
- for ( let y = 0 ; y < this . matchers . length ; y ++ ) {
272
- const type = this . matchers [ y ] ;
278
+ for ( let y = 0 ; y < SQLTokeniser . matchers . length ; y ++ ) {
279
+ const type = SQLTokeniser . matchers [ y ] ;
273
280
let goodMatch = true ;
274
281
275
282
for ( let x = 0 ; x < type . match . length ; x ++ ) {
0 commit comments