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

Method scanString

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

Source from the content-addressed store, hash-verified

1746 }
1747
1748 protected void scanString() {
1749 mark = pos;
1750 boolean hasSpecial = false;
1751 Token preToken = this.token;
1752
1753 for (; ; ) {
1754 if (isEOF()) {
1755 lexError("unclosed.str.lit");
1756 return;
1757 }
1758
1759 ch = charAt(++pos);
1760
1761 if (ch == '\'') {
1762 scanChar();
1763 if (ch != '\'') {
1764 token = LITERAL_CHARS;
1765 break;
1766 } else {
1767 if (!hasSpecial) {
1768 initBuff(bufPos);
1769 arraycopy(mark + 1, buf, 0, bufPos);
1770 hasSpecial = true;
1771 }
1772 putChar('\'');
1773 continue;
1774 }
1775 }
1776
1777 if (!hasSpecial) {
1778 bufPos++;
1779 continue;
1780 }
1781
1782 if (bufPos == buf.length) {
1783 putChar(ch);
1784 } else {
1785 buf[bufPos++] = ch;
1786 }
1787 }
1788
1789 if (!hasSpecial) {
1790 if (preToken == Token.AS) {
1791 stringVal = subString(mark, bufPos + 2);
1792 } else {
1793 stringVal = subString(mark + 1, bufPos);
1794 }
1795 } else {
1796 stringVal = new String(buf, 0, bufPos);
1797 }
1798 }
1799
1800 protected final void scanString2() {
1801 {

Callers 4

nextTokenValueMethod · 0.95
nextTokenMethod · 0.95
parseValueClauseMethod · 0.45

Calls 8

isEOFMethod · 0.95
lexErrorMethod · 0.95
charAtMethod · 0.95
scanCharMethod · 0.95
initBuffMethod · 0.95
arraycopyMethod · 0.95
putCharMethod · 0.95
subStringMethod · 0.95

Tested by

no test coverage detected