|
2026-10-17
| ||
| 10:51 | • New ticket [1e66ba3d49] expr cannot call math functions named eq/ne/in/ni or sta... artifact: 63df456f61 user: serhiy.storchaka | |
|
2008-03-12
| ||
| 22:43 | • Ticket [1201589fff] bareword madness in expr parser status still Open with 1... artifact: 49703a35f3 user: dgp | |
|
2007-11-28
| ||
| 01:58 | • Ticket [1201589fff]: 1 change artifact: 366731daae user: dgp | |
|
2006-11-08
| ||
| 00:40 | • Open ticket [1201589fff]. artifact: 24a374c1b8 user: hobbs | |
|
2005-05-25
| ||
| 23:09 | • Ticket [1201589fff]: 2 changes artifact: 2a94e72b8d user: dgp | |
| 23:09 | • Closed ticket [1201589fff]. artifact: 402de23bdf user: dgp | |
|
2005-05-20
| ||
| 22:30 | • Ticket [1201589fff]: 5 changes artifact: e2b717e839 user: dgp | |
| 22:19 | • Ticket [1201589fff]: 4 changes artifact: 9882d13e92 user: dgp | |
| 22:19 | • Add attachment 1201589-84.patch to ticket [1201589fff] artifact: 7cb1c4b279 user: dgp | |
| 22:19 | • Ticket [1201589fff] bareword madness in expr parser status still Open with 4... artifact: 0c23a9d8d8 user: dgp | |
| 22:04 | • Ticket [1201589fff]: 4 changes artifact: c262f75c61 user: dgp | |
| 22:04 | • Ticket [1201589fff]: 4 changes artifact: e9daec38ef user: dgp | |
| 22:04 | • Add attachment 1201589-2.patch to ticket [1201589fff] artifact: 39f117445f user: dgp | |
| 21:29 | • Ticket [1201589fff] bareword madness in expr parser status still Open with 4... artifact: 7404426b03 user: dgp | |
| 21:29 | • Add attachment 1201589.patch to ticket [1201589fff] artifact: ed4a558f96 user: dgp | |
| 21:29 | • Ticket [1201589fff] bareword madness in expr parser status still Open with 4... artifact: e876adb924 user: dgp | |
|
2005-05-13
| ||
| 18:31 | • New ticket [1201589fff]. artifact: dc8f9cd4db user: dgp | |
bareword madness in expr parser
Open1201589fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 19 years ago
Descriptionplain2005-05-13 18:31:45
dgp% if {yes} {puts foo}
foo
% if {!no} {puts foo}
foo
% if {y} {puts foo}
foo
% if {!n} {puts foo}
syntax error in expression "!n": the word "n"
requires a preceding $ if it's a variable or function
arguments if it's a function
kbkdgp - You have the appropriate logic in the 'n'
case in tclParseExpr.c(GetLexeme)?
kbkHmmm, ok, I see that you did it farther down, in
the 'default' branch, but look for those literals
exactly, not with unique-prefix matching.
[14:22]kbkHmm. I don't really like unique-prefix
matching in this context.
[14:23]kbkbut if we do it, we should do it only if
all else fails.
[14:23]dgpwell, the parser doesn't (can't?) check the
validity of function names.
[14:23]kbkwhich is to say, *don't* do it if the
bareword is followed by optional whitespace and a left
paren.
[14:24]kbkbecause false() isn't a valid expr.
[14:24]dgphmmm.... parens...
[14:24]kbkunless there's a function so named.
[14:25]kbkeq, ne, in, ni, would need further handling
somehow, though, becase $a eq("stuff") is valid, and is
not a function call.
[14:27]kbkand *that* interpretation depends on left
context; the eq, ne, in, ni operators are operators
only if they follow a constant, a variable, or a right
paren.
[14:27]kbkUgh.
[14:27]kbkI'm starting to think that expr has
outgrown a recursive-descent parser.
Referenced by1
63df456f61New ticket [1e66ba3d49] expr cannot call math functions named eq/ne/in/ni or starting with them (in_range, eq_zero, ...). ticket2026-10-17 10:51:11
dgpplain2005-05-20 21:29:55
Logged In: YES user_id=80530 Attached patch makes expr parser accept *all* barewords as literals, which then includes the reported problem of accepting boolean value prefix barewords as literals.
dgpplain2005-05-20 21:29:58
File Added - 135271: 1201589.patch
dgpplain2005-05-20 22:04:57
Logged In: YES user_id=80530 second version of the patch is limited to just fixing the boolean literal prefix problem, as well as accepting as function names "eq" "ne" "in" and "ni" when they appear in the context for a function name rather than an operator. Treatment of other barewords is left unchanged.
dgpplain2005-05-20 22:04:58
File Added - 135277: 1201589-2.patch
dgpplain2005-05-20 22:19:41
Logged In: YES user_id=80530 and here's a version suitable for application to the 8.4 branch.
dgpplain2005-05-20 22:19:42
File Added - 135280: 1201589-84.patch
dgpplain2005-05-20 22:30:02
Logged In: YES user_id=80530 Committed for 8.4.10 and 8.5a3. Leaving report open because some tests really ought to be added to the test suite for this. (Volunteers invited!)
dgpplain2005-05-25 23:09:04
Logged In: YES user_id=80530 TIP 182 implementation includes tests for the improved bareword parser.
dgp Ticket [1201589fff]: 2 changes
[History diff]2005-05-25 23:09:05
hobbsplain2006-11-08 00:40:27
Logged In: YES user_id=72656 FWIW, users find the single char bareword handling of booleans surprising: http://bugs.activestate.com/show_bug.cgi?id=59177 While I could see the pattern straight off, not even other expert Tcl'ers could, and it is eyebrow raising. This needs at least clear exception docs in expr.n, if not other consideration for correction.
dgp Ticket [1201589fff]: 1 change
[History diff]2007-11-28 01:58:16
dgp Ticket [1201589fff]: 1 change
[History diff]2008-03-12 22:43:46
Log in (anonymous is fine) to add a comment.
Attachments:
- 1201589-84.patch [download] added by dgp on 2005-05-20 22:19:41. [details]
- 1201589-2.patch [download] added by dgp on 2005-05-20 22:04:57. [details]
- 1201589.patch [download] added by dgp on 2005-05-20 21:29:57. [details]