@@ -94,15 +94,28 @@ public static void parse(String sqlString, Recognizer recognizer) throws QueryEx
94
94
final char c = sqlString .charAt ( indx );
95
95
final boolean lastCharacter = indx == stringLength -1 ;
96
96
97
- if ( inLineComment ) {
97
+ if ( inDelimitedComment ) {
98
+ recognizer .other ( c );
99
+ if ( !lastCharacter && '*' == c && '/' == sqlString .charAt ( indx +1 ) ) {
100
+ inDelimitedComment = false ;
101
+ recognizer .other ( sqlString .charAt ( indx +1 ) );
102
+ indx ++;
103
+ }
104
+ }
105
+ else if ( !lastCharacter && '/' == c && '*' == sqlString .charAt ( indx +1 ) ) {
106
+ inDelimitedComment = true ;
107
+ recognizer .other ( c );
108
+ recognizer .other ( sqlString .charAt ( indx +1 ) );
109
+ indx ++;
110
+ }
111
+ else if ( inLineComment ) {
112
+ recognizer .other ( c );
98
113
// see if the character ends the line
99
114
if ( '\n' == c ) {
100
115
inLineComment = false ;
101
- recognizer .other ( c );
102
116
}
103
117
else if ( '\r' == c ) {
104
118
inLineComment = false ;
105
- recognizer .other ( c );
106
119
if ( !lastCharacter && '\n' == sqlString .charAt ( indx +1 ) ) {
107
120
recognizer .other ( sqlString .charAt ( indx +1 ) );
108
121
indx ++;
@@ -117,20 +130,6 @@ else if ( '-' == c ) {
117
130
indx ++;
118
131
}
119
132
}
120
- else if ( inDelimitedComment ) {
121
- recognizer .other ( c );
122
- if ( !lastCharacter && '*' == c && '/' == sqlString .charAt ( indx +1 ) ) {
123
- inDelimitedComment = true ;
124
- recognizer .other ( sqlString .charAt ( indx +1 ) );
125
- indx ++;
126
- }
127
- }
128
- else if ( !lastCharacter && '/' == c && '*' == sqlString .charAt ( indx +1 ) ) {
129
- inDelimitedComment = true ;
130
- recognizer .other ( c );
131
- recognizer .other ( sqlString .charAt ( indx +1 ) );
132
- indx ++;
133
- }
134
133
else if ( inDoubleQuotes ) {
135
134
if ( '\"' == c ) {
136
135
inDoubleQuotes = false ;
0 commit comments