Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: dc8f9cd4dbcfd0f379686b9c06f97626d3c8fb22
Ticket: 1201589fffffffffffffffffffffffffffffffff
bareword madness in expr parser
User & Date: dgp on 2005-05-13 18:31:45
Changes

  1. assignee changed to: "dgp"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    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.
    
    
  4. foundin changed to: "obsolete: 8.5a3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "dgp"
  9. subsystem changed to: "45. Parsing and Eval"
  10. title changed to: "bareword madness in expr parser"
  11. type changed to: "Bug"