Make CLI prescan handle goofy identifier delimiters too. Streamline code.
FossilOrigin-Name: 968aed690ba7240f8a256f5ba679cc971f432ff9af0ff99744824af79b952545
This commit is contained in:
parent
8bc4cbce6b
commit
a96bbe9af6
15
manifest
15
manifest
@ -1,5 +1,5 @@
|
|||||||
C Speed-up\sCLI's\sprocessing\sfor\shuge\sblock\scomments,\sfor\sany\scontent
|
C Make\sCLI\sprescan\shandle\sgoofy\sidentifier\sdelimiters\stoo.\sStreamline\scode.
|
||||||
D 2021-09-10T00:58:46.038
|
D 2021-09-10T19:45:22.999
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@ -545,7 +545,7 @@ F src/random.c 097dc8b31b8fba5a9aca1697aeb9fd82078ec91be734c16bffda620ced7ab83c
|
|||||||
F src/resolve.c 42b94d37a54200707a95566eff4f7e8a380e32d080016b699f23bd79a73a5028
|
F src/resolve.c 42b94d37a54200707a95566eff4f7e8a380e32d080016b699f23bd79a73a5028
|
||||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||||
F src/select.c b2c48dfc02b486fd2da2be1605503615958ba1997d40d994c2946975d0150a31
|
F src/select.c b2c48dfc02b486fd2da2be1605503615958ba1997d40d994c2946975d0150a31
|
||||||
F src/shell.c.in a9db850f1254f281a59042d180d2c6c8f3208cc8455e140600c3d95481c6c168
|
F src/shell.c.in f857f13def27b87c6759a537b4d53b30c5c232736b8b31040ba3eb49714a0de3
|
||||||
F src/sqlite.h.in 4e977a5e2ed1a9e8987ff65a2cab5f99a4298ebf040ea5ff636e1753339ff45a
|
F src/sqlite.h.in 4e977a5e2ed1a9e8987ff65a2cab5f99a4298ebf040ea5ff636e1753339ff45a
|
||||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||||
F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
|
F src/sqlite3ext.h e97f4e9b509408fea4c4e9bef5a41608dfac343b4d3c7a990dedde1e19af9510
|
||||||
@ -1922,10 +1922,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 6844ede29e1dac93a392dfb1e7e676bb9d0a2e7bbec0a4a5804ffc2025a99b66
|
P c4568f9f458bad16bd4481f1f6f5e7b6f39f5ccf23f2b05890078577ce2ab9a2
|
||||||
R 5477d1fa459b11493c202e9f0cfe1148
|
R eb5e78e09aa48719a67382400efc7d61
|
||||||
T *branch * speedy_cli
|
|
||||||
T *sym-speedy_cli *
|
|
||||||
T -sym-trunk *
|
|
||||||
U larrybr
|
U larrybr
|
||||||
Z b7d7b6be2bca4895f81d545876286c4b
|
Z d182a98bc0a685d688796d8bc75a9046
|
||||||
|
@ -1 +1 @@
|
|||||||
c4568f9f458bad16bd4481f1f6f5e7b6f39f5ccf23f2b05890078577ce2ab9a2
|
968aed690ba7240f8a256f5ba679cc971f432ff9af0ff99744824af79b952545
|
@ -10601,15 +10601,18 @@ meta_command_exit:
|
|||||||
/* Line scan result and intermediate states (supporting scan resumption)
|
/* Line scan result and intermediate states (supporting scan resumption)
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
QSS_InPlain = 0, QSS_InString, QSS_InDquote,
|
QSS_InPlain = 0, QSS_InQuote = 1, QSS_InBlockComment = 2,
|
||||||
QSS_InBlockComment, QSS_EndingSemi,
|
QSS_NoDark = 0, QSS_HasDark = 1<<2, QSS_EndingSemi = 1<<3,
|
||||||
QSS_NoDark = 0, QSS_HasDark = 1<<3,
|
QSS_ScanMask = 0x3, QSS_DarkMask = 1<<2,
|
||||||
QSS_ScanMask = 0x7, QSS_DarkMask = 1<<3
|
QSS_CharShift = 4, QSS_StateMask = ((1<<QSS_CharShift)-1),
|
||||||
|
QSS_Start = 0
|
||||||
} QuickScanState;
|
} QuickScanState;
|
||||||
#define QSS_STATE(qss) ((qss) & QSS_ScanMask)
|
#define QSS_STATE(qss) ((qss) & QSS_ScanMask)
|
||||||
#define QSS_SETV(qss, newst) (newst | ((qss) & QSS_DarkMask))
|
#define QSS_SETV(qss, newst) (newst | ((qss) & (QSS_StateMask^QSS_ScanMask)))
|
||||||
#define QSS_PLAINWHITE(qss) ((qss)==QSS_NoDark)
|
#define QSS_PLAINWHITE(qss) (((qss)&~QSS_EndingSemi)==QSS_NoDark)
|
||||||
#define QSS_PLAINDARK(qss) ((qss)==QSS_HasDark)
|
#define QSS_PLAINDARK(qss) (((qss)&~QSS_EndingSemi)==QSS_HasDark)
|
||||||
|
#define QSS_SEMITERM(qss) \
|
||||||
|
(((qss)&(QSS_ScanMask|QSS_EndingSemi))==QSS_EndingSemi)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Scan line for classification to guide shell's handling.
|
** Scan line for classification to guide shell's handling.
|
||||||
@ -10629,14 +10632,16 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
|
|||||||
switch (cin){
|
switch (cin){
|
||||||
case '-':
|
case '-':
|
||||||
if( *zLine=='-' ){
|
if( *zLine=='-' ){
|
||||||
while(*++zLine!=0)
|
while((cin = *++zLine)!=0 ){
|
||||||
;
|
if( cin=='\n')
|
||||||
|
continue;
|
||||||
|
}
|
||||||
return qss;
|
return qss;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ';':
|
case ';':
|
||||||
qss = QSS_SETV(qss, QSS_EndingSemi);
|
qss |= QSS_EndingSemi;
|
||||||
goto EndingSemi;
|
continue;
|
||||||
case '/':
|
case '/':
|
||||||
if( *zLine=='*' ){
|
if( *zLine=='*' ){
|
||||||
++zLine;
|
++zLine;
|
||||||
@ -10644,38 +10649,25 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
|
|||||||
goto InBlockComment;
|
goto InBlockComment;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '[':
|
||||||
qss = QSS_SETV(qss, QSS_InString);
|
cin = ']';
|
||||||
goto InString;
|
/* fall thru */
|
||||||
case '"':
|
case '`': case '\'': case '"':
|
||||||
qss = QSS_SETV(qss, QSS_InDquote);
|
qss = qss & ~QSS_EndingSemi | QSS_HasDark;
|
||||||
goto InDquote;
|
qss = QSS_SETV(qss, QSS_InQuote) | (cin<<QSS_CharShift);
|
||||||
|
goto InQuote;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qss |= QSS_HasDark;
|
qss = qss & ~QSS_EndingSemi | QSS_HasDark;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QSS_InString:
|
case QSS_InQuote:
|
||||||
InString:
|
InQuote: {
|
||||||
while (cin = *zLine++){
|
char cLeave = qss >> QSS_CharShift;
|
||||||
if( cin=='\'' ){
|
while (cin = *zLine++){
|
||||||
if( *zLine!='\'' ){
|
if( cin==cLeave ){
|
||||||
goto InPlainSet;
|
goto InPlainSet;
|
||||||
}else{
|
|
||||||
++zLine;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case QSS_InDquote:
|
|
||||||
InDquote:
|
|
||||||
while (cin = *zLine++){
|
|
||||||
if( cin=='"' ){
|
|
||||||
if( *zLine!='"' ){
|
|
||||||
goto InPlainSet;
|
|
||||||
}else{
|
|
||||||
++zLine;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10689,16 +10681,7 @@ static QuickScanState quickscan(char *zLine, QuickScanState qss){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QSS_EndingSemi:
|
default:;
|
||||||
EndingSemi:
|
|
||||||
while (cin = *zLine++){
|
|
||||||
if( !IsSpace(cin) && cin!=';' ){
|
|
||||||
--zLine;
|
|
||||||
goto InPlain;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: assert(0);
|
|
||||||
}
|
}
|
||||||
return qss;
|
return qss;
|
||||||
}
|
}
|
||||||
@ -10716,7 +10699,7 @@ static int line_is_command_terminator(char *zLine){
|
|||||||
zLine += 2; /* SQL Server */
|
zLine += 2; /* SQL Server */
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
return quickscan(zLine,QSS_NoDark)==QSS_NoDark;
|
return quickscan(zLine,QSS_Start)==QSS_Start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -10859,7 +10842,7 @@ static int process_input(ShellState *p){
|
|||||||
memcpy(zSql+nSql, zLine, nLine+1);
|
memcpy(zSql+nSql, zLine, nLine+1);
|
||||||
nSql += nLine;
|
nSql += nLine;
|
||||||
}
|
}
|
||||||
if( nSql && QSS_STATE(qss)==QSS_EndingSemi && sqlite3_complete(zSql) ){
|
if( nSql && QSS_SEMITERM(qss) && sqlite3_complete(zSql) ){
|
||||||
errCnt += runOneSqlLine(p, zSql, p->in, startline);
|
errCnt += runOneSqlLine(p, zSql, p->in, startline);
|
||||||
nSql = 0;
|
nSql = 0;
|
||||||
if( p->outCount ){
|
if( p->outCount ){
|
||||||
|
Loading…
Reference in New Issue
Block a user