summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | * generic/tclCompExpr.c: Call TclCompileSyntaxError() whendgp2007-08-271-23/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | expression syntax errors are found when compiling expressions. With this in place, convert TclCompileExpr to return void, since there's no longer any need to report TCL_ERROR. * generic/tclCompile.c: Update callers. * generic/tclExecute.c: * generic/tclCompCmds.c: New routine TclCompileSyntaxError() * generic/tclCompile.h: to directly compile bytecodes that report a * generic/tclCompile.c: syntax error, rather than (ab)use a call to TclCompileReturnCmd. Also, undo the most recent commit that papered over some issues with that (ab)use. New routine produces a new opcode INST_SYNTAX, which is a minor variation of INST_RETURN_IMM. Also a bit of constification.
* | * generic/tclCompile.c: Move the deallocation of local LiteralTabledgp2007-08-271-4/+1
| | | | | | | | | | * generic/tclCompExpr.c: entries into TclFreeCompileEnv(). * generic/tclExecute.c: Update callers.
* | * generic/tclCompExpr.c: Force numeric and boolean literalsdgp2007-08-271-7/+26
| | | | | | | | | | in expressions to register with their intreps intact, even if that means overwriting existing intreps in already registered literals.
* | * generic/tclCompExpr.c: Register literals found in expressionsdgp2007-08-241-5/+29
| | | | | | | | | | | | * tests/compExpr.test: to restore literal sharing. Preserve numeric intreps when literals are created for the first time. Correct memleak in ExecConstantExprTree() and add test for the leak.
* | * generic/tclCompExpr.c: Suppress the attempt to convert todgp2007-08-231-2/+2
| | | | | | | | numeric when pre-compiling a constant expresion indicates an error.
* | Missing init in ParseExpr().dgp2007-08-221-1/+2
| | | | | | | | Label needs debug build exposure in TEBC.
* | * generic/tclCompExpr.c: Added a "constant" field to the OpNodedgp2007-08-161-90/+296
| | | | | | | | | | | | | | | | struct (again "free" due to alignment requirements) to mark those subexpressions that are completely known at compile time. Enhanced CompileExprTree() and its callers to precompute these constant subexpressions at compile time. This resolves the issue raised in [Bug 1564517].
* | comment correctionsdgp2007-08-141-8/+7
| |
* | Then reorder code todgp2007-08-101-219/+174
| | | | | | | | eliminate duplication.
* | * generic/tclCompExpr.c: Revise CompileExprTree() to use thedgp2007-08-101-65/+117
| | | | | | | | | | | | | | | | OpNode mark field scheme of tree traversal. This eliminates the need to use magic values in the left and right fields for that purpose. Also stop abusing the left field within ParseExpr() to store the number of arguments in a parsed function call. CompileExprTree() now determines that for itself at compile time.
* | * tests/parseExpr.test: Update source file name of expr parser code.dgp2007-08-061-262/+285
| | | | | | | | | | | | | | | | | | * generic/tclCompExpr.c: Added a "mark" field to the OpNode struct, which is used to guide tree traversal. This field costs nothing since alignement requirements used the memory already. Rewrote ConvertTreeToTokens() to use the new field, which permitted consolidation of utility routines CopyTokens() and GenerateTokensForLiteral().
* | * generic/tclCompExpr.c: Removed unused arguments and variables.dgp2007-07-181-43/+25
| |
* | typodgp2007-07-171-2/+2
| |
* | * generic/tclCompExpr.c (ParseExpr): While adding comments todgp2007-07-171-202/+251
| | | | | | | | | | | | explain the operations of ParseExpr(), made significant revisions to the code so it would be easier to explain, and in the process made the code simpler and clearer as well.
* | * generic/tclCompExpr.c: More commentary.dgp2007-07-161-6/+27
| | | | | | | | | | | | * tests/parseExpr.test: Several tests of syntax error messages to check that when expression substrings are truncated they leave visible the context relevant to the reported error.
* | additional commentarydgp2007-07-121-6/+25
| |
* | * generic/tclCompExpr.c: Factored out, corrected, and commenteddgp2007-07-121-44/+43
| | | | | | | | common code for reporting syntax errors in LEAF elements.
* | * generic/tclCompExpr.c: Added a "parseOnly" flag argument todgp2007-07-111-49/+29
| | | | | | | | | | | | | | | | | | | | | | ParseExpr() to indicate whether the caller is Tcl_ParseExpr(), with an end goal of filling a Tcl_Parse with Tcl_Tokens representing the parsed expression, or TclCompileExpr() with the goal of compiling and executing the expression. In the latter case, more aggressive conversion of QUOTED and BRACED lexeme to literals is done. In the former case, all such conversion is avoided, since Tcl_Token production would revert it anyway. This enables simplifications to the GenerateTokensForLiteral() routine as well.
* | Renamed some variables fordgp2007-07-101-46/+115
| | | | | | | | clarity and replaced some cryptic logic with more readable macros.
* | Removed some unused counter variables.dgp2007-07-101-6/+17
| |
* | * generic/tclCompExpr.c: Added a field for operator precedencedgp2007-07-101-40/+165
| | | | | | | | | | | | | | | | to be stored directly in the parse tree. There's no memory cost to this addition, since that memory would have been lost to alignment issues anyway. Also, converted precedence definitions and lookup tables to use symbolic constants instead of raw number for improved readability, and continued extending/improving/correcting comments.
* | More extended commentary about the data structures of the expr parser.dgp2007-07-091-43/+85
| |
* | * generic/tclCompExpr.c: Revision so that the END lexeme neverdgp2007-07-091-4/+32
| | | | | | | | | | | | | | gets inserted into the parse tree. Later tree traversal never reaches it since its location in the tree is not variable. Starting and stopping with the START lexeme (node 0) is sufficient. Also finished lexeme code commentary.
* | * generic/tclCompExpr.c: Added missing creation and returndgp2007-07-091-2/+11
| | | | | | | | of the Tcl_Parse fields that indicate error conditions. [Bug 1749987]
* | More work in progress commenting the expr parserdgp2007-07-051-10/+55
| |
* | Start of work adding more useful comments to the expr parser.dgp2007-07-051-20/+63
| |
* | * generic/tclCompExpr.c: Revised #define values so that theredgp2007-07-031-4/+12
| | | | | | | | is now more expansion room to define more BINARY operators.
* | * generic/tclCompExpr.c: Removed dead code, old implementationsdgp2007-07-021-1486/+48
| | | | | | | | | | * generic/tclEvent.c: of expr parsing and compiling, including the * generic/tclInt.h: routine TclFinalizeCompilation().
* | * generic/tclBasic.c: Move most instances of the Tcl_Parse structdgp2007-06-211-78/+95
| | | | | | | | | | | | * generic/tclCompExpr.c: off the C stack and onto the Tcl stack. * generic/tclCompile.c: This is a rather large struct (> 3kB). * generic/tclParse.c:
* | * generic/tclInt.decls: Revised the interfaces of the routinesdgp2007-06-201-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclExecute.c: TclStackAlloc and TclStackFree to make them easier for callers to use (or more precisely, harder to misuse). TclStackFree now takes a (void *) argument which is the pointer intended to be freed. TclStackFree will panic if that's not actually the memory the call will free. TSA/TSF also now tolerate receiving (interp == NULL), in which case they simply fall back to be calls to Tcl_Alloc/Tcl_Free. * generic/tclIntDecls.h: make genstubs * generic/tclBasic.c: Updated callers * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCompCmds.c: * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclFCmd.c: * generic/tclFileName.c: * generic/tclIOCmd.c: * generic/tclIndexObj.c: * generic/tclInterp.c: * generic/tclNamesp.c: * generic/tclProc.c: * generic/tclTrace.c: * unix/tclUnixPipe.c:
* | * generic/tclCompExpr.c (ParseExpr): Revised to be sure thatdgp2007-04-251-3/+17
| | | | | | | | | | | | an error return doesn't prevent all literals getting placed on the litList to be returned to the caller for freeing. Corrects some memleaks. [Bug 1705778, leak K23]
* | * generic/tclCompExpr.c (ParseExpr): Memory leak in error case; thedgp2007-04-241-1/+2
| | | | | | | | literal Tcl_Obj was not getting freed. [Bug 1705778, leak #1 (new)]
* | * generic/tclCompCmds.c (TclCompileUpvarCmd): Plugged a memoryKevin B Kenny2007-04-231-2/+5
| | | | | | | | | | | | | | | | leak in 'upvar' when compiling (a) upvar outside a proc, (b) upvar with a syntax error, or (c) upvar where the frame index is not known at compile time. * generic/tclParseExpr.c (ParseExpr): Plugged a memory leak when parsing expressions that contain syntax errors.
* | Eliminate use of (VOID*) casts when calling memset or memcpy.dkf2007-04-171-3/+3
| |
* | Handle creation of Tcl_Objs from constant strings better (easier to use, moredkf2007-04-101-42/+37
| | | | | | | | efficient). After [Patch 1529526] (afredd)
* | * generic/tclCompExpr.c:dgp2007-03-301-13/+18
| | | | | | | | | | | | * generic/tclCompCmds.c: Replace arrays on the C stack and ckalloc calls with TclStackAlloc calls to use memory on Tcl's evaluation stack
* | various "const" additions, in line with TIP #27nijtmans2007-02-201-31/+31
| |
* | Cleanup to follow engineering manual guidelinesdkf2006-12-131-232/+327
| |
* | * generic/tclCompExpr.c: Now that the new internal structsdgp2006-12-121-3/+3
| | | | | | | | | | | | | | | | | | are in use to support operator commands, might as well make them the default for [expr] as well and avoid passing every parsed expression through the inefficient Tcl_Token array format. This addresses most issues in [RFE 1517602] Assuming no performance disasters result from this, much dead code supporting the other implementation might now be removed.
* | * generic/tclBasic.c: Final step routing all direct evaluation formsdgp2006-12-121-8/+114
| | | | | | | | | | | | * generic/tclCompExpr.c: of the operator commands through TEBC, * generic/tclCompile.h: dropping all the routines in tclMathOp.c. * generic/tclMathOp.c: Still needs Engineering Manual attention.
* | * generic/tclBasic.c: Another step with all sorting operator commandsdgp2006-12-111-1/+56
| | | | | | | | | | * generic/tclCompExpr.c: now routing through TEBC via * generic/tclCompile.h: TclSortingOpCmd().
* | * generic/tclBasic.c: Another step down the path of re-usingdgp2006-12-081-23/+37
| | | | | | | | | | | | | | | | * generic/tclCompExpr.c: TclExecuteByteCode to implement the TIP 174 * generic/tclCompile.h: commands instead of using a mass of code * generic/tclMathOp.c: duplication. Now all operator commands that * tests/mathop.test: demand exactly one operation are implemented via TclSingleOpCmd and a call to TEBC.
* | * generic/tclCompExpr.c: Revised implementation of TclInvertOpCmddgp2006-12-081-24/+55
| | | | | | | | | | | | | | | | | | | | * generic/tclMathOp.c: to perform a bytecode compile / execute sequence. This demonstrates a path toward avoiding mountains of code duplication in tclMathOp.c and tclExecute.c. * generic/tclCompile.h: Change TclExecuteByteCode() from static to * generic/tclExecute.c: MODULE_SCOPE so all files including tclCompile.h may call it.
* | * generic/tclCompExpr.c: Added implementation for thedgp2006-12-041-24/+260
| | | | | | | | | | | | | | CompileExprTree() routine that can produce expression bytecode directly from internal structures with no need to pass through the Tcl_Token array representation. Still disabled by default. #undef USE_EXPR_TOKENS to try it out.
* | * generic/tclCompExpr.c: Added expr parsing routines thatdgp2006-12-031-6/+1089
| | | | | | | | | | | | | | | | | | | | produce a different set of internal structures representing the parsed expression, as well as routines that go on to convert those structures into the traditional Tcl_Token array format. Use of these routines is currently disabled. #undef PARSE_DIRECT_EXPR_TOKENS to enable them. These routines will only become really useful when more routines that compile directly from the new internal structures are completed.
* | * generic/tclBasic.c: TIP #280 implementation.andreas_kupries2006-11-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclCompCmds.c: * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclCompile.h: * generic/tclExecute.c: * generic/tclIOUtil.c: * generic/tclInt.h: * generic/tclInterp.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclProc.c: * tests/compile.test: * tests/info.test: * tests/platform.test: * tests/safe.test:
* | TIP#270 IMPLEMENTATIONdgp2006-11-151-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tcl.decls: New public routines Tcl_ObjPrintf, * generic/tclStringObj.c: Tcl_AppendObjToErrorInfo, Tcl_Format, * generic/tclInt.h: Tcl_AppendLimitedToObj, Tcl_AppendFormatToObj and Tcl_AppendPrintfToObj. Former internal versions removed. * generic/tclDecls.h: make genstubs * generic/tclStubInit.c: * generic/tclBasic.c: Updated callers. * generic/tclCkalloc.c: * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclDictObj.c: * generic/tclExecute.c: * generic/tclIORChan.c: * generic/tclIOUtil.c: * generic/tclMain.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclPkg.c: * generic/tclProc.c: * generic/tclStrToD.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/tclUnixFCmd.c:
* | * generic/tclCompExpr.c: fix gcc warnings about 'cast to/fromdas2006-11-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclEncoding.c: pointer from/to integer of different * generic/tclEvent.c: size' on 64-bit platforms by casting to * generic/tclExecute.c: intermediate types intptr_t/uintptr_t * generic/tclHash.c: via new PTR2INT(), INT2PTR(), * generic/tclIO.c: PTR2UINT() and UINT2PTR() macros. * generic/tclInt.h: [Patch 1592791] * generic/tclProc.c: * generic/tclTest.c: * generic/tclThreadStorage.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/configure.in: * unix/tclUnixChan.c: * unix/tclUnixPipe.c: * unix/tclUnixPort.h: * unix/tclUnixTest.c: * unix/tclUnixThrd.c: * unix/configure: autoconf-2.59 * unix/tclConfig.h.in: autoheader-2.59
* | * generic/tclParseExpr.c (removed): Moved all the code ofdgp2006-11-091-1/+1051
| | | | | | | | | | | | | | | | | | * generic/tclCompExpr.c: tclParseExpr.c into tclCompExpr.c. * unix/Makefile.in: This sets the stage for expr compiling to * win/Makefile.in: work directly with the full parse tree * win/makefile.bc: structures, and not have to pass through * win/makefile.vc: the information lossy format of an array * win/tcl.dsp: of Tcl_Tokens.
* | * generic/tclCompExpr.c: Removed much complexity that isdgp2006-09-051-292/+88
| | | | | | | | no longer needed.