On Thu, 3 Apr 2014, Sergei Gavrikov wrote:
> TH does trig on such typos
>
> expr 0+0b2
> expr 0+0o8
I mean
% fossil test-th-eval 'expr 0+0b2'
fossil: ../src/th.c:2140: exprMakeTree: Assertion `!apToken[jj] ||
!apToken[0]' failed.
Aborted
> So, for the new three things I would enter three new bit sets for
> aCharProp[].
Jan, excuse me that was mistaken guess on the bit sets, the reason was
my miss in src/th.c:thNexNumber(). The fix is attached.
Thank you.
Sergei
Index: src/th.c
==================================================================
--- src/th.c
+++ src/th.c
@@ -1879,31 +1879,35 @@
int nInput,
int *pnLiteral
){
int i = 0;
int seenDot = 0;
+ int seenPfx = 0;
int (*isdigit)(char) = th_isdigit;
if( nInput>2 ){
if( zInput[0]=='0' && (zInput[1]=='x' || zInput[1]=='X') ){
i=2;
+ seenPfx = 1;
isdigit = th_ishexdig;
}
if( zInput[0]=='0' && (zInput[1]=='o' || zInput[1]=='O') ){
i=2;
+ seenPfx = 1;
isdigit = th_isoctdig;
}
if( zInput[0]=='0' && (zInput[1]=='b' || zInput[1]=='B') ){
i=2;
+ seenPfx = 1;
isdigit = th_isbindig;
}
}
for(; i<nInput; i++){
char c = zInput[i];
if( (seenDot || c!='.') && !isdigit(c) ) break;
if( c=='.' ) seenDot = 1;
}
- *pnLiteral = i;
+ *pnLiteral = i - (seenPfx ? 2 : 0);
return TH_OK;
}
/*
** Free an expression tree.
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users