Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 9a6c53ddb8933bd25546bc36b5a217857079afdd
Ticket: 3401704fffffffffffffffffffffffffffffffff
expr parses numbers before function names
User & Date: ferrieux on 2011-09-01 15:41:00
Changes

  1. icomment:
    To summarise why I think revising T_PN is okay:
    T_PN's contract can be described by a single regexp not very far from (simplifying on the actual float syntax):
    
       ^[+-]?(
             [0-9.e]+
        |
             Inf(inity)?
        |
             Nan(\([0-9af]+\))?
       )
    
    Note that due to the greediness of '+', adding a positive lookahead of [^0-9] after the floating-point part is a no-op:
    
    
       ^[+-]?(
             [0-9.e]+  (?=[^0-9])
        |
             Inf(inity)?
        |
             Nan(\([0-9af]+\))?
       )
    
    This is the current trunk status.
    Now the patch just adds 2 more lookaheads:
    
    
       ^[+-]?(
             [0-9.e]+  (?=[^0-9])
        |
             Inf(inity)? (?=[^0-9A-Za-z_])
        |
             Nan(\([0-9af]+\))? (?=[^0-9A-Za-z_])
       )
    
    That's it. No dirty hack, just a slight bend of the accepted regular language. And that bend is justified, across all callers of T_PN, by the fact that Nancy and Infinitesimal being parsed as Nan+cy and Inf+initesimal are utterly meaningless. If you want to flag this as POTENTIAL INCOMPATIBILITY, please do, but it's a very very tiny one.
    
    While doing the equivalent fix only in T_PE would IMO break symmetry. People doing script emulations of one of the primitives with the others would start noting inconsistencies !
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"