Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch th1ExprFix Excluding Merge-Ins
This is equivalent to a diff from df9880287f to 57b1290be3
2014-09-01
| ||
18:51 | Add the --with-miniz configuration option (with the complete miniz source code.) Add the globalState TH1 command and fixes to the TH1 expr command. check-in: 66ae70a54b user: drh tags: trunk | |
2014-08-29
| ||
02:29 | Update the change log. Closed-Leaf check-in: 57b1290be3 user: mistachkin tags: th1ExprFix | |
2014-08-28
| ||
15:22 | Fix the "fossil bisect chart" so that it always shows CURRENT in between the last BAD and first GOOD. check-in: 36d63c67d2 user: drh tags: trunk | |
05:54 | Merge updates from trunk. check-in: 629891a775 user: mistachkin tags: optFor130, globalStateCmd | |
05:54 | Merge updates from trunk. check-in: cdad2dc0c2 user: mistachkin tags: reviewFor130, optionalMiniz | |
00:00 | Merge updates from trunk. check-in: 937d2f479d user: mistachkin tags: reqdFor130, th1ExprFix | |
2014-08-27
| ||
22:52 | Add another merge test case. check-in: df9880287f user: mistachkin tags: trunk | |
18:40 | Updated changelog for previous commit. check-in: 8b4bcd9d1f user: stephan tags: trunk | |
Changes to src/th.c.
︙ | ︙ | |||
1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 | /* ** These two types are used only by the expression module, where ** the expression module means the Th_Expr() and exprXXX() functions. */ typedef struct Operator Operator; struct Operator { const char *zOp; int eOp; int iPrecedence; int eArgType; }; typedef struct Expr Expr; struct Expr { Operator *pOp; | > | 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | /* ** These two types are used only by the expression module, where ** the expression module means the Th_Expr() and exprXXX() functions. */ typedef struct Operator Operator; struct Operator { const char *zOp; int nOp; int eOp; int iPrecedence; int eArgType; }; typedef struct Expr Expr; struct Expr { Operator *pOp; |
︙ | ︙ | |||
1829 1830 1831 1832 1833 1834 1835 | */ #define ARG_INTEGER 1 #define ARG_NUMBER 2 #define ARG_STRING 3 static Operator aOperator[] = { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 | */ #define ARG_INTEGER 1 #define ARG_NUMBER 2 #define ARG_STRING 3 static Operator aOperator[] = { {"(", 1, OP_OPEN_BRACKET, -1, 0}, {")", 1, OP_CLOSE_BRACKET, -1, 0}, /* Note: all unary operators have (iPrecedence==1) */ {"-", 1, OP_UNARY_MINUS, 1, ARG_NUMBER}, {"+", 1, OP_UNARY_PLUS, 1, ARG_NUMBER}, {"~", 1, OP_BITWISE_NOT, 1, ARG_INTEGER}, {"!", 1, OP_LOGICAL_NOT, 1, ARG_INTEGER}, /* Binary operators. It is important to the parsing in Th_Expr() that * the two-character symbols ("==") appear before the one-character * ones ("="). And that the priorities of all binary operators are * integers between 2 and 12. */ {"<<", 2, OP_LEFTSHIFT, 4, ARG_INTEGER}, {">>", 2, OP_RIGHTSHIFT, 4, ARG_INTEGER}, {"<=", 2, OP_LE, 5, ARG_NUMBER}, {">=", 2, OP_GE, 5, ARG_NUMBER}, {"==", 2, OP_EQ, 6, ARG_NUMBER}, {"!=", 2, OP_NE, 6, ARG_NUMBER}, {"eq", 2, OP_SEQ, 7, ARG_STRING}, {"ne", 2, OP_SNE, 7, ARG_STRING}, {"&&", 2, OP_LOGICAL_AND, 11, ARG_INTEGER}, {"||", 2, OP_LOGICAL_OR, 12, ARG_INTEGER}, {"*", 1, OP_MULTIPLY, 2, ARG_NUMBER}, {"/", 1, OP_DIVIDE, 2, ARG_NUMBER}, {"%", 1, OP_MODULUS, 2, ARG_INTEGER}, {"+", 1, OP_ADD, 3, ARG_NUMBER}, {"-", 1, OP_SUBTRACT, 3, ARG_NUMBER}, {"<", 1, OP_LT, 5, ARG_NUMBER}, {">", 1, OP_GT, 5, ARG_NUMBER}, {"&", 1, OP_BITWISE_AND, 8, ARG_INTEGER}, {"^", 1, OP_BITWISE_XOR, 9, ARG_INTEGER}, {"|", 1, OP_BITWISE_OR, 10, ARG_INTEGER}, {0,0,0,0,0} }; /* ** The first part of the string (zInput,nInput) contains an integer. ** Set *pnVarname to the number of bytes in the numeric string. */ static int thNextInteger( |
︙ | ︙ | |||
2121 2122 2123 2124 2125 2126 2127 | } } } iLeft = 0; for(jj=nToken-1; jj>=0; jj--){ if( apToken[jj] ){ | | > < < | | 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | } } } iLeft = 0; for(jj=nToken-1; jj>=0; jj--){ if( apToken[jj] ){ if( apToken[jj]->pOp && apToken[jj]->pOp->iPrecedence==1 && iLeft>0 && ISTERM(iLeft) ){ apToken[jj]->pLeft = apToken[iLeft]; apToken[jj]->pLeft->pParent = apToken[jj]; apToken[iLeft] = 0; } iLeft = jj; } } for(i=2; i<=12; i++){ iLeft = -1; for(jj=0; jj<nToken; jj++){ Expr *pToken = apToken[jj]; if( apToken[jj] ){ if( pToken->pOp && !pToken->pLeft && pToken->pOp->iPrecedence==i ){ int iRight = jj+1; for(; !apToken[iRight] && iRight<nToken; iRight++); if( iRight==nToken || iLeft<0 || !ISTERM(iRight) || !ISTERM(iLeft) ){ return TH_ERROR; } pToken->pLeft = apToken[iLeft]; apToken[iLeft] = 0; pToken->pLeft->pParent = pToken; pToken->pRight = apToken[iRight]; |
︙ | ︙ | |||
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 | int nExpr, /* Number of bytes at zExpr */ Expr ***papToken, /* OUT: Array of tokens. */ int *pnToken /* OUT: Size of token array */ ){ int i; int rc = TH_OK; int nToken = 0; Expr **apToken = 0; for(i=0; rc==TH_OK && i<nExpr; ){ char c = zExpr[i]; if( th_isspace(c) ){ /* White-space */ i++; | > | 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 | int nExpr, /* Number of bytes at zExpr */ Expr ***papToken, /* OUT: Array of tokens. */ int *pnToken /* OUT: Size of token array */ ){ int i; int rc = TH_OK; int nNest = 0; int nToken = 0; Expr **apToken = 0; for(i=0; rc==TH_OK && i<nExpr; ){ char c = zExpr[i]; if( th_isspace(c) ){ /* White-space */ i++; |
︙ | ︙ | |||
2221 2222 2223 2224 2225 2226 2227 | pNew->nValue = iEnd+1-i; } break; } default: { int j; | > | | > > > > > > > > > | < | | 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 | pNew->nValue = iEnd+1-i; } break; } default: { int j; const char *zOp; for(j=0; (zOp=aOperator[j].zOp); j++){ int nOp = aOperator[j].nOp; int isMatch = 0; if( (nExpr-i)>=nOp && 0==memcmp(zOp, &zExpr[i], nOp) ){ isMatch = 1; } if( isMatch && aOperator[j].eOp==OP_OPEN_BRACKET ){ nNest++; }else if( isMatch && aOperator[j].eOp==OP_CLOSE_BRACKET ){ nNest--; } if( nToken>0 && aOperator[j].iPrecedence==1 ){ Expr *pPrev = apToken[nToken-1]; if( !pPrev->pOp || pPrev->pOp->eOp==OP_CLOSE_BRACKET ){ continue; } } if( isMatch ){ pNew->pOp = &aOperator[j]; i += nOp; break; } } } } |
︙ | ︙ | |||
2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 | nToken++; }else{ Th_Free(interp, pNew); rc = TH_ERROR; } } } *papToken = apToken; *pnToken = nToken; return rc; } /* | > > > > | 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 | nToken++; }else{ Th_Free(interp, pNew); rc = TH_ERROR; } } } if( nNest!=0 ){ rc = TH_ERROR; } *papToken = apToken; *pnToken = nToken; return rc; } /* |
︙ | ︙ |
Changes to test/th1.test.
︙ | ︙ | |||
475 476 477 478 479 480 481 482 483 484 485 486 487 488 | fossil test-th-eval "expr 0b1+5" test th1-expr-34 {$RESULT eq {6}} ############################################################################### fossil test-th-eval "expr 0+0b" test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}} ############################################################################### fossil test-th-eval "checkout 1"; # NOTE: Assumes running "in tree". test th1-checkout-1 {[string length $RESULT] > 0} ############################################################################### | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | fossil test-th-eval "expr 0b1+5" test th1-expr-34 {$RESULT eq {6}} ############################################################################### fossil test-th-eval "expr 0+0b" test th1-expr-35 {$RESULT eq {TH_ERROR: expected number, got: "0b"}} ############################################################################### fossil test-th-eval "expr (-1)+1" test th1-expr-36 {$RESULT eq {0}} ############################################################################### fossil test-th-eval "expr (((-1)))" test th1-expr-37 {$RESULT eq {-1}} ############################################################################### fossil test-th-eval "expr (((1)))" test th1-expr-38 {$RESULT eq {1}} ############################################################################### fossil test-th-eval "expr (((1))" test th1-expr-39 {$RESULT eq {TH_ERROR: syntax error in expression: "(((1))"}} ############################################################################### fossil test-th-eval "expr ((1)))" test th1-expr-40 {$RESULT eq {TH_ERROR: syntax error in expression: "((1)))"}} ############################################################################### fossil test-th-eval "expr (((1)*2)*2)" test th1-expr-41 {$RESULT eq {4}} ############################################################################### fossil test-th-eval "checkout 1"; # NOTE: Assumes running "in tree". test th1-checkout-1 {[string length $RESULT] > 0} ############################################################################### |
︙ | ︙ |
Changes to www/changes.wiki.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <title>Change Log</title> <h2>Changes For Version 1.30 (as yet unreleased)</h2> * Add setting to control the number of times autosync will be tried before returning an error. * Add the [/help/fusefs|fossil fusefs DIRECTORY] command that mounts a Fuse Filesystem at the given DIRECTORY and populates it with read-only copies of all historical check-ins. This only works on systems that support FuseFS. * Support customization of commands and webpages, including the ability to add new ones, via the "TH1 hooks" feature. Disabled by default. Enabled via a compile-time option. * Add the <nowiki>[checkout], [render], [styleHeader], [styleFooter], [trace], [getParameter], [setParameter], and [artifact]</nowiki> commands to TH1, primarily for use by TH1 hooks. * Bring in the latest version of autosetup from upstream. | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <title>Change Log</title> <h2>Changes For Version 1.30 (as yet unreleased)</h2> * Add setting to control the number of times autosync will be tried before returning an error. * Add the [/help/fusefs|fossil fusefs DIRECTORY] command that mounts a Fuse Filesystem at the given DIRECTORY and populates it with read-only copies of all historical check-ins. This only works on systems that support FuseFS. * Several fixes to the TH1 expression parser. * Support customization of commands and webpages, including the ability to add new ones, via the "TH1 hooks" feature. Disabled by default. Enabled via a compile-time option. * Add the <nowiki>[checkout], [render], [styleHeader], [styleFooter], [trace], [getParameter], [setParameter], and [artifact]</nowiki> commands to TH1, primarily for use by TH1 hooks. * Bring in the latest version of autosetup from upstream. |
︙ | ︙ |