summaryrefslogtreecommitdiffstats
path: root/generic/tclParseExpr.c
Commit message (Collapse)AuthorAgeFilesLines
* * generic/tclParseExpr.c: Dropped the old expr parser.dgp2006-08-301-1965/+8
|
* silence compiler warndgp2006-08-291-2/+2
|
* undo mistaken commitdgp2006-08-291-2/+2
|
* * generic/tclParseExpr.c: Use the "parent" field ofdgp2006-08-291-6/+11
| | | | | | | orphan ExprNodes to store the closure of left pointers. This lets us avoid repeated re-scanning leftward for the left boundary of subexpressions, which in worst case led to near O(N^2) runtime.
* * generic/tclStringObj.c: Revised ObjPrintfVA to take caredgp2006-08-281-8/+5
| | | | | | | | * generic/tclParseExpr.c: to copy only whole characters when doing %s formatting. This relieves callers of TclObjPrintf() and TclFormatToErrorInfo() from needing to fix arguments to character boundaries. Tcl_ParseExpr() simplified by taking advantage. [Bug 1547786]
* * generic/tclParseExpr.c: Minimal collection of new testsdgp2006-08-231-43/+36
| | | | | | * tests/parseExpr.test: testing the error messages of the new expr parser. Several bug fixes and code simplifications that appeared during that effort.
* * generic/tclParseExpr.c: Revised mistaken call todgp2006-08-211-7/+12
| | | | | TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same additional info in error message.
* * generic/tclCompile.c: Revised the new set of expressiondgp2006-08-171-103/+82
| | | | * generic/tclParseExpr.c: parse error messages.
* * generic/tclParseExpr.c: Replace PrecedenceOf() functiondgp2006-08-161-76/+14
| | | | with prec[] static array.
* * generic/regc_locale.c (cclass):das2006-07-201-2/+2
| | | | | | | | | | | | | * generic/tclExecute.c (TclExecuteByteCode): * generic/tclIOCmd.c (Tcl_ExecObjCmd): * generic/tclListObj.c (NewListIntRep): * generic/tclObj.c (Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, FreeBignum, Tcl_SetBignumObj): * generic/tclParseExpr.c (Tcl_ParseExpr): * generic/tclStrToD.c (TclParseNumber): * generic/tclStringObj.c (TclAppendFormattedObjs): * unix/tclUnixPipe.c (TclpCreateProcess): fix signed-with-unsigned comparison and other warnings from gcc4 -Wextra.
* Improvements to error context messagesdgp2006-07-051-3/+9
|
* * generic/tclParseExpr.c: Completely new expression parserdgp2006-07-051-8/+1142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that builds a parse tree instead of operating with deep recursion. This corrects reports of stack-blowing crashes parsing long expressions [Bug 906201] and replaces a fundamentally O(N^2) algorithm with an O(N) one [RFE 903765]. The new parser is better able to generate error messages that clearly report both the nature and context of the syntax error [Bugs 1029267, 1381715]. For now, the code for the old parser is still present and can be activated with a "#define OLD_EXPR_PARSER 1". This is for the sake of a clean implementation patch, and for ease of benchmarking. The new parser is non-recursive, so much lighter in stack consumption, but it does use more heap, so there may be cases where parsing of long expressions that succeeded with the old parser will lead to out of memory panics with the new one. There are still more improvements possible on that point, though significant progress may require changes to the Tcl_Token specifications documented for the public Tcl_Parse*() routines. ***POTENTIAL INCOMPATIBILITY*** for any callers that rely on the exact (usually terrible) error messages generated by the old parser. This includes a large number of tests in the test suite. * generic/tclInt.h: Replaced TclParseWhiteSpace() with * generic/tclParse.c: TclParseAllWhiteSpace() which is what * generic/tclParseExpr.c: all the callers really needed. Breaking whitespace runs at newlines is useful only to the command parsing function, and it can call the file scoped routine ParseWhiteSpace() to do that. * tests/expr-old.test: Removed knownBug constraints that masked * tests/expr.test: failures due to revised error messages. * tests/parseExpr.test:
* 2005-12-19 Don Porter <dgp@users.sourceforge.net>dgp2005-12-191-2/+2
| | | | | | | | | | | | | | | * generic/tclCmdMZ.c: Modified [string is double] to use * tests/string.test: TclParseNumber() to parse trailing whitespace. Ensures consistency, and makes it easier to cleanup after invalid internal reps left behind by parsing [Bugs 1360432 1382287]. * generic/tclParseExpr.c: Added TCL_PARSE_NO_WHITESPACE to * generic/tclScan.c: TclParseNumber() calls since [scan] and * tests/scan.test: [expr] parsing don't want spaces in parsed numbers. * generic/tclInt.h: Added TCL_PARSE_NO_WHITESPACE flag to the * generic/tclStrToD.c: TclParseNumber() interface.
* Export stubs for libtommath; fix mingw compiler warningsKevin B Kenny2005-12-131-2/+2
|
* Convert to using ANSI decls/definitions and using the (ANSI) assumption that ↵dkf2005-10-311-72/+74
| | | | | | NULL can be cast to any pointer type transparently.
* * generic/tclClock.c: Removed some dead code.dgp2005-10-191-63/+1
| | | | | | | | | | | | * generic/tclCmdIL.c: * generic/tclCompCmds.c: * generic/tclDictObj.c: * generic/tclExecute.c: * generic/tclLiteral.c: * generic/tclParseExpr.c: * generic/tclScan.c: * generic/tclUtil.c: * generic/tclVar.c:
* TIP#237 IMPLEMENTATIONdgp2005-10-081-119/+11
| | | | | | [kennykb-numerics-branch] Resynchronized with the HEAD; at this checkpoint [-rkennykb-numerics-branch-20051008], the HEAD and kennykb-numerics-branch contain identical code.
* Systematizing the formattingdkf2005-07-211-551/+552
|
* * generic/tclParseExpr.c: Corrected parser to recognize alldgp2005-05-201-59/+36
| | | | | | boolean literals accepted by Tcl_GetBoolean, including prefixes like "y" and "f", and to allow "eq" and "ne" as function names in the proper context. [Bug 1201589].
* Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-43/+26
|
* * doc/DString.3: Eliminated use of identifier "string" in Tcl'sdgp2005-05-031-11/+11
| | | | | | | | | | | | | * doc/Environment.3: public C API to avoid conflict/confusion with * doc/Eval.3: the std::string of C++. * doc/ExprLong.3, doc/ExprLongObj.3, doc/GetInt.3, doc/GetOpnFl.3: * doc/ParseCmd.3, doc/RegExp.3, doc/SetResult.3, doc/StrMatch.3: * doc/Utf.3, generic/tcl.decls, generic/tclBasic.c, generic/tclEnv.c: * generic/tclGet.c, generic/tclParse.c, generic/tclParseExpr.c: * generic/tclRegexp.c, generic/tclResult.c, generic/tclUtf.c: * generic/tclUtil.c, unix/tclUnixChan.c: * generic/tclDecls.h: `make genstubs`
* Core of implementation of TIP#201 ('in' and 'ni' operators)dkf2004-10-081-6/+32
|
* Stop words starting with 'eq' or 'ne' from being subdivided by the expressiondkf2004-10-041-3/+5
| | | | parser. [Bug 884830]
* Patch 922727 committed. Implements three changes:dgp2004-04-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | | * generic/tclInt.h: Reworked the Tcl header files into a clean * unix/tclUnixPort.h: hierarchy where tcl.h < tclPort.h < tclInt.h * win/tclWinInt.h: and every C source file should #include * win/tclWinPort.h: at most one of those files to satisfy its declaration needs. tclWinInt.h and tclWinPort.h also better organized so that tclWinPort.h includes the Windows implementation of cross-platform declarations, while tclWinInt.h makes declarations that are available on Windows only. * generic/tclBinary.c (TCL_NO_MATH): Deleted the generic/tclMath.h * generic/tclMath.h (removed): header file. The internal Tcl * macosx/Makefile (PRIVATE_HEADERS): header, tclInt.h, has a * win/tcl.dsp: #include <math.h> directly, and file external to Tcl needing libm should do the same. * win/Makefile.in (WIN_OBJS): Deleted the win/tclWinMtherr.c file. * win/makefile.bc (TCLOBJS): It's a vestige from matherr() days * win/makefile.vc (TCLOBJS): gone by. * win/tcl.dsp: * win/tclWinMtherr.c (removed):
* * generic/tclInt.h (TclParseInit): Factored the common codedgp2004-03-041-14/+2
| | | | | * generic/tclParse.c (TclParseInit): for initializing a Tcl_Parse * generic/tclParseExpr.c: struct into one routine.
* * generic/tclBasic.c (TclAppendObjToErrorInfo): New internal routinedgp2003-10-141-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | that appends a Tcl_Obj to the errorInfo, saving the caller the trouble of extracting the string rep. * generic/tclStringObj.c (TclAppendLimitedToObj): New internal routine that supports truncated appends with optional ellipsis marking. This single routine supports UTF-8-safe truncated appends needed in several places throughout the Tcl source code, mostly for error and stack messages. Clean fix for [Bug 760872]. * generic/tclInt.h: Declarations for new internal routines. * generic/tclCmdMZ.c: Updated callers to use the new routines. * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclExecute.c: * generic/tclIOUtil.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclParseExpr.c: * generic/tclProc.c: * generic/tclStringObj.c: * mac/tclMacResource.c: * library/init.tcl: Updated ::errorInfo cleanup in [unknown] to reflect slight modifications to Tcl_LogCommandInfo(). Corrects failing init-4.* tests.
* TIP#123 Implementation based on work by Arjen Markus. [Patch 655176]dkf2003-09-121-7/+83
|
* Don Porter's fix for bad parsing of nested scripts [Bug 681841].Miguel Sofer2003-02-161-2/+15
|
* * generic/tclParseExpr.c (TclParseInteger): Return 1 for thedgp2002-12-111-2/+4
| | | | | string "0x" (recognize leading "0" as an integer). [Bug 648441]. * tests/parseExpr.test (parseExpr-19.1): Test for Bug 648441.
* * doc/CmdCmplt.3: Applied Patch 585105 to fully CONST-ifydgp2002-08-051-172/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/Concat.3: all remaining public interfaces of Tcl. * doc/CrtCommand.3: Notably, the parser no longer writes on * doc/CrtSlave.3: the string it is parsing, so it is no * doc/CrtTrace.3: longer necessary for Tcl_Eval() to be * doc/Eval.3: given a writable string. Also, the * doc/ExprLong.3: refactoring of the Tcl_*Var* routines * doc/LinkVar.3: by Miguel Sofer is included, so that the * doc/ParseCmd.3: "part1" argument for them no longer needs * doc/SetVar.3: to be writable either. * doc/TraceVar.3: * doc/UpVar.3: Compatibility support has been enhanced so * generic/tcl.decls that a #define of USE_NON_CONST will remove * generic/tcl.h all possible source incompatibilities with * generic/tclBasic.c the 8.3 version of the header file(s). * generic/tclCmdMZ.c The new #define of USE_COMPAT_CONST now does * generic/tclCompCmds.c what USE_NON_CONST used to do -- disable * generic/tclCompExpr.c only those new CONST's that introduce * generic/tclCompile.c irreconcilable incompatibilities. * generic/tclCompile.h * generic/tclDecls.h Several bugs are also fixed by this patch. * generic/tclEnv.c [Bugs 584051,580433] [Patches 585105,582429] * generic/tclEvent.c * generic/tclInt.decls * generic/tclInt.h * generic/tclIntDecls.h * generic/tclInterp.c * generic/tclLink.c * generic/tclObj.c * generic/tclParse.c * generic/tclParseExpr.c * generic/tclProc.c * generic/tclTest.c * generic/tclUtf.c * generic/tclUtil.c * generic/tclVar.c * mac/tclMacTest.c * tests/expr-old.test * tests/parseExpr.test * unix/tclUnixTest.c * unix/tclXtTest.c * win/tclWinTest.c
* Allowed parser to recognise 'Inf' as a floating-point number. [Bug 218000]dkf2002-07-221-2/+3
| | | | Also produce better error messages when this happens.
* LogSyntaxError() should reset the interpreter resultjenglish2002-06-211-1/+2
| | | | [Bug 550142 "Tcl_ExprObj -> abort"]
* TIP#72 implementation. See ChangeLog for details.dkf2002-02-151-1/+5
| | | | | This version builds clean on Solaris/SPARC, with GCC and CC, both with and without threads and both in 32-bit and 64-bit mode.
* More expr syntax error improvementsdkf2001-12-061-15/+43
|
* Improved messages produced on getting a syntax error in an expressiondkf2001-12-041-46/+92
|
* removed unnecessary inclusions of tclCompile.h [Patch 466823]Miguel Sofer2001-10-011-2/+1
|
* Recognise the non-numeric boolean literals (true,false,yes,no,on,off.)dkf2001-04-091-3/+47
| | | | [Bug #217777]
* * doc/expr.n:hobbs2000-05-091-6/+36
| | | | | | | | | | | | * tests/expr.test: * tests/expr-old.test: added tests for 'eq' and 'ne' * generic/tclExecute.c: * generic/tclCompile.h: added INST_STREQ and INST_STRNEQ opcodes that do strict string comparisons. * generic/tclCompExpr.c: added 'eq' and 'ne' string comparison operators. * generic/tclParseExpr.c (GetLexeme): added 'eq' and 'ne' expr parse terms (string (in)equality check).
* * tests/expr-old.test:hobbs1999-12-041-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/parseExpr.test: * tests/string.test: * generic/tclGet.c: * generic/tclInt.h: * generic/tclObj.c: * generic/tclParseExpr.c: * generic/tclUtil.c: * generic/tclExecute.c: added TclCheckBadOctal routine to enhance error message checking for when users use invalid octal numbers (like 08), as well as replumbed the Expr*Funcs with a new VerifyExprObjType to simplify type handling. * tests/expr.test: * generic/tclCompile.c: fixed 'bad code length' error for 'expr + {[incr]}' case, with new test case [Bug: 3736] and seg fault on 'expr + {[error]}' (different cause) that was caused by a correct optimization that didn't correctly track how it was modifying the source string in the opt. The optimization was removed, which means that: expr 1 + {[string length abc]} will be not be compiled inline as before, but this should be written: expr {1 + [string length abc]} which will be compiled inline for speed. This prevents expr 1 + {[mindless error]} from seg faulting, and only affects optimizations for degenerate cases [Bug: 3737]
* 1999-09-01 Jeff Hobbs <hobbs@scriptics.com>hobbs1999-09-021-2/+2
| | | | | | | | | | | | | * generic/tclParseExpr.c: changed '"' to '\"' to make FreeBSD happy [Bug: 2625] * generic/tclProc.c: moved static buf to better location and changed static msg that would overflow in ProcessProcResultCode [Bug: 2483] and added Tcl_DStringFree to Tcl_ProcObjCmd. Also reworked size of static buffers. * tests/stringObj.test: added test 9.11 * generic/tclStringObj.c: changed Tcl_AppendObjToObj to properly handle the 1-byte dest and mixed src case where both had had Unicode string len checks made on them. [Bug: 2678]
* Resynced with mainline.rjohnson1999-04-211-1/+1
|
* merged the parse changes between TclPro1.2 and Tcl8.1. Fixed bug in Windows ↵surles1999-04-211-1/+7
| | | | makefile caused when the win/pkgIndex.tcl file was replaced
* merged tcl 8.1 branch back into the main trunkstanton1999-04-161-0/+1826