MCPcopy
hub / github.com/alibaba/druid / nextToken

Method nextToken

core/src/main/java/com/alibaba/druid/sql/parser/Lexer.java:1253–1521  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1251 }
1252
1253 public final void nextToken() {
1254 startPos = pos;
1255 bufPos = 0;
1256 if (comments != null && comments.size() > 0) {
1257 comments = null;
1258 }
1259
1260 this.lines = 0;
1261 int startLine = line;
1262
1263 for (; ; ) {
1264 if (isWhitespace(ch)) {
1265 if (ch == '\n') {
1266 line++;
1267
1268 lines = line - startLine;
1269 }
1270
1271 ch = charAt(++pos);
1272 startPos = pos;
1273 continue;
1274 }
1275
1276 if (ch == EOI && pos < text.length()) {
1277 ch = charAt(++pos);
1278 continue;
1279 }
1280
1281 if (ch == '$') {
1282 scanVariable();
1283 return;
1284 }
1285
1286 if (isFirstIdentifierChar(ch)) {
1287 if (ch == '(') {
1288 scanChar();
1289 token = LPAREN;
1290 return;
1291 } else if (ch == ')') {
1292 scanChar();
1293 token = RPAREN;
1294 return;
1295 }
1296
1297 if (ch == 'N' || ch == 'n') {
1298 if (charAt(pos + 1) == '\'') {
1299 ++pos;
1300 ch = '\'';
1301 scanString();
1302 token = Token.LITERAL_NCHARS;
1303 return;
1304 }
1305 }
1306
1307 if (ch == '—' && charAt(pos + 1) == '—' && charAt(pos + 2) == '\n') {
1308 pos += 3;
1309 ch = charAt(pos);
1310 continue;

Callers 15

test_0Method · 0.95
test_lexerMethod · 0.95
test_lexer2Method · 0.95
test_lexer_computePosMethod · 0.95
test_0Method · 0.95
test_2Method · 0.95
hashMethod · 0.95
getAllTokensMethod · 0.95
startsWithHintMethod · 0.95
containsAnyMethod · 0.95
getSimpleSelectValueMethod · 0.95
replaceBackQuoteMethod · 0.95

Calls 15

charAtMethod · 0.95
scanVariableMethod · 0.95
scanCharMethod · 0.95
scanStringMethod · 0.95
scanIdentifierMethod · 0.95
scanHexaDecimalMethod · 0.95
scanNumberMethod · 0.95
scanLBracketMethod · 0.95
isEnabledMethod · 0.95
dialectFeatureEnabledMethod · 0.95
unscanMethod · 0.95
scanSharpMethod · 0.95

Tested by 15

test_0Method · 0.76
test_lexerMethod · 0.76
test_lexer2Method · 0.76
test_lexer_computePosMethod · 0.76
test_0Method · 0.76
test_2Method · 0.76
test_first_commnetMethod · 0.36
test_hintMethod · 0.36
test_0Method · 0.36
test_0Method · 0.36
test_1Method · 0.36
test_2Method · 0.36