summaryrefslogtreecommitdiffstats
path: root/generic/tclParse.c
Commit message (Collapse)AuthorAgeFilesLines
* Demonstrate and fix memory leak in Tcl_ParseVar().dgp2013-07-241-0/+1
|
* Tests for expanded literals quoting detection.dgp2011-05-021-3/+5
|
* Revised TclFindElement() interface.dgp2011-05-021-21/+13
| | | | | | | | | | | | | | | | The final argument had been bracePtr, the address of a boolean var, where the caller can be told whether or not the parsed list element was enclosed in braces. In practice, no callers really care about that. What the callers really want to know is whether the list element value exists as a literal substring of the string being parsed, or whether a call to TclCopyAndCollpase() is needed to produce the list element value. Now the final argument is changed to do what callers actually need. This is a better fit for the calls in tclParse.c, where now a good deal of post-processing checking for "naked backslashes" is no longer necessary. ***POTENTIAL INCOMPATIBILITY*** For any callers calling in via the internal stubs table who really do use the final argument explicitly to check for the enclosing brace scenario. Simply looking for the braces where they must be is the revision available to those callers, and it will backport cleanly.
* New utility routines: TclIsSpaceProc() and TclCountSpaceRuns()dgp2011-04-281-1/+25
| | | Use to replace calls to isspace() and their /* INTL */ risk.
* Rewrites to eliminate isspace() calls.dgp2011-03-161-13/+8
|
* * generic/tclBasic.c: More replacements of Tcl_UtfBackslash() callsdgp2011-03-061-2/+2
|\ | | | | | | | | * generic/tclCompile.c: with TclParseBackslash() where possible. * generic/tclParse.c: * generic/tclUtil.c:
* \ * generic/tclParse.c (TclParseBackslash): Correct trunction checks indgp2011-03-061-2/+2
|\ \ | |/ | | * tests/parse.test: \x and \u substitutions. [Bug 3200987]
| * * generic/tclParse.c (TclParseBackslash): Correct trunction checks indgp2011-03-061-2/+2
| | | | | | * tests/parse.test: \x and \u substitutions. [Bug 3200987]
* | Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-021-2/+0
|\ \ | |/ | | more harm than good. Purged them.
| * Now that we're no longer using SCM based on RCS, the RCS Keyword lines causedgp2011-03-011-2/+0
| | | | | | more harm than good. Purged them.
| * * generic/tclAlloc.c: Cleaned up various routines in thedgp2009-09-281-1/+9
| | | | | | | | | | | | | | * generic/tclCkalloc.c: call stacks for memory allocation to * generic/tclParse.c: guarantee that any size values computed * generic/tclThreadAlloc.c: are within the domains of the routines they get passed to. [Bugs 2557696 and 2557796].
| * * generic/tclParse.c (Tcl_ParseBraces): fix for possible readMiguel Sofer2007-10-151-2/+2
| | | | | | | | after the end of buffer, [Bug 1813528] (Joe Mistachkin).
| * * generic/tclParse.c: In contexts where interp and parsePtr->interpdgp2007-07-191-8/+8
| | | | | | | | might be different, be sure to use the latter for error reporting.
| * * generic/tclParse.c (Tcl_ParseCommand): also return an error ifMiguel Sofer2006-09-241-2/+2
| | | | | | | | | | | | | | start==NULL and numBytes<0. This is coverity's bug #20 * generic/tclStringObj.c (STRING_SIZE): fix allocation for 0-length strings. This is coverity's bugs #54-5
* | silence compiler warningsdgp2009-08-261-2/+2
| |
* | * generic/tclBasic.c (Tcl_CreateInterp, Tcl_EvalTokensStandard,andreas_kupries2009-08-251-7/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EvalTokensStandard, Tcl_EvalEx, EvalEx, TclAdvanceContinuations, TclEvalObjEx): * generic/tclCmdMZ.c (Tcl_SwitchObjCmd, TclListLines): * generic/tclCompCmds.c (*): * generic/tclCompile.c (TclSetByteCodeFromAny, TclInitCompileEnv, TclFreeCompileEnv, TclCompileScript): * generic/tclCompile.h (CompileEnv): * generic/tclInt.h (ContLineLoc, Interp): * generic/tclObj.c (ThreadSpecificData, ContLineLocFree, TclThreadFinalizeObjects, TclInitObjSubsystem, TclContinuationsEnter, TclContinuationsEnterDerived, TclContinuationsCopy, TclContinuationsGet, TclFreeObj): * generic/tclParse.c (TclSubstTokens, Tcl_SubstObj): * generic/tclProc.c (TclCreateProc): * generic/tclVar.c (TclPtrSetVar): * tests/info.test (info-30.0-24): Extended parser, compiler, and execution with code and attendant data structures tracking the positions of continuation lines which are not visible in script Tcl_Obj*'s, to properly account for them while counting lines for #280.
* | * generic/tclParse.c: Backport fix for [Bug 2251175].dgp2008-12-011-10/+26
| |
* | * generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace()dgp2008-05-211-5/+8
| | | | | | | | | | | | | | * tests/parse.test (parse-15.60): routine has no mechanism to return the "incomplete" status of "\\\n" so calling this routine anywhere that can be reached within a Tcl_ParseCommand() call is a mistake. In particular, ParseComment() must not use it. [Bug 1968882].
* | Reconcile coding style issues between branchesdgp2008-01-231-7/+9
| |
* | * generic/tclInt.h: New macro TclGrowParseTokenArray() todgp2008-01-231-66/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCompCmds.c: simplify code that might need to grow * generic/tclCompExpr.c: an array of Tcl_Tokens in the parsePtr * generic/tclParse.c: field of a Tcl_Parse. Replaces the TclExpandTokenArray() routine via replacing: int needed = parsePtr->numTokens + growth; while (needed > parsePtr->tokensAvailable) { TclExpandTokenArray(parsePtr); } with: TclGrowParseTokenArray(parsePtr, growth); This revision merged over from dgp-refactor branch.
* | merge stable branch onto HEADdgp2007-12-131-1/+1
| |
* | More minor cleanupdkf2007-11-181-127/+124
| |
* | [Patch 1830038]: Increased usage of macros to detect and take advantage of ↵Miguel Sofer2007-11-111-3/+3
| | | | | | | | objTypes.
* | * generic/tclParse.c (Tcl_ParseBraces): fix for possible readMiguel Sofer2007-10-151-2/+2
| | | | | | | | after the end of buffer, [Bug 1813528] (Joe Mistachkin).
* | * generic/tclParse.c: In contexts where interp and parsePtr->interpdgp2007-07-191-20/+20
| | | | | | | | | | | | might be different, be sure to use the latter for error reporting. Also pulled the interp argument back out of ParseTokens() since we already had a parsePtr->interp to work with.
* | * generic/tclBasic.c: Move most instances of the Tcl_Parse structdgp2007-06-211-75/+79
| | | | | | | | | | | | * 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/tclParse.c: fix for uninit read [Bug 1732414].Miguel Sofer2007-06-061-2/+3
| |
* | * generic/tclBasic.c: Removed code that dealt withdgp2007-05-301-53/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCompile.c: TCL_TOKEN_EXPAND_WORD tokens representing * generic/tclCompile.h: expanded literal words. These sections were mostly in place to enable [info frame] to discover line information in expanded literals. Since the parser now generates a token for each post-expansion word referring to the right location in the original script string, [info frame] gets all the data it needs. * generic/tclInt.h: Revised the parser so that it never produces * generic/tclParse.c: TCL_TOKEN_EXPAND_WORD tokens when parsing an * tests/parse.test: expanded literal word; that is, something like {*}{x y z}. Instead, generate the series of TCL_TOKEN_SIMPLE_WORD tokens to represent the words that expansion of the literal string produces. [RFE 1725186]
* | * unix/configure: autoconf-2.59 (FC6 fork)dgp2007-05-181-15/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * win/configure: * README: Bump version number to 8.5a7 * generic/tcl.h: * library/init.tcl: * tools/tcl.wse.in: * unix/configure.in: * unix/tcl.spec: * win/configure.in: * generic/tclParse.c: Disable and remove the ALLOW_EXPAND sections * tests/info.test: that continued to support the deprecated * tests/mathop.test: {expand} syntax. Updated the few remaining users of that syntax in the test suite.
* | Reformat to standard function definition formdkf2007-04-101-24/+27
| |
* | * generic/tclExecute.c: More ckalloc -> ckrealloc conversions.dgp2007-03-211-9/+10
| | | | | | | | | | | | | | | | | | * generic/tclLiteral.c: * generic/tclNamesp.c: * generic/tclParse.c: * generic/tclPreserve.c: * generic/tclStringObj.c: * generic/tclUtil.c:
* | * generic/tclBasic.c: TIP #280 implementation.andreas_kupries2006-11-281-8/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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:
* | * doc/ParseCmd.3, doc/Tcl.n, doc/eval.n, doc/exec.n:hobbs2006-11-031-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/fconfigure.n, doc/interp.n, doc/unknown.n: * library/auto.tcl, library/init.tcl, library/package.tcl: * library/safe.tcl, library/tm.tcl, library/msgcat/msgcat.tcl: * tests/all.tcl, tests/basic.test, tests/cmdInfo.test: * tests/compile.test, tests/encoding.test, tests/execute.test: * tests/fCmd.test, tests/http.test, tests/init.test: * tests/interp.test, tests/io.test, tests/ioUtil.test: * tests/iogt.test, tests/namespace-old.test, tests/namespace.test: * tests/parse.test, tests/pkg.test, tests/pkgMkIndex.test: * tests/proc.test, tests/reg.test, tests/trace.test: * tests/upvar.test, tests/winConsole.test, tests/winFCmd.test: * tools/tclZIC.tcl: * generic/tclParse.c (Tcl_ParseCommand): Replace {expand} with {*} officially (TIP #293). Leave -DALLOW_EXPAND=0|1 option to keep {expand} syntax for transition users. [Bug 1589629]
* | * generic/tclParse.c (Tcl_ParseCommand): also return an error ifMiguel Sofer2006-09-241-2/+2
| | | | | | | | start==NULL and numBytes<0. This is coverity's bug #20
* | * generic/tclParseExpr.c: Completely new expression parserdgp2006-07-051-16/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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:
* | ANSIfy; generic/*.c now all done except for test codedkf2005-11-021-111/+110
| |
* | * generic/tclParse.c (Tcl_ParseCommand): add code that recognizeshobbs2005-10-041-15/+23
| | | | | | | | | | {} in addition to {expand} for word expansion (make with -DALLOW_EMPTY_EXPAND).
* | Systematizing the formattingdkf2005-07-211-808/+869
| |
* | Merged kennykb-numerics-branch back to the head; TIPs 132 and 232Kevin B Kenny2005-05-101-1/+1
| |
* | * doc/DString.3: Eliminated use of identifier "string" in Tcl'sdgp2005-05-031-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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`
* | * generic/tclBasic.c (Tcl_EvalEx): Restored recursion limitdgp2005-03-181-4/+11
| | | | | | | | | | | | | | | | * generic/tclParse.c (TclSubstTokens): testing in nested command * tests/basic.test (basic-46.4): substitutions within direct * tests/parse.test (parse-19.*): script evaluation (Tcl_EvalEx) that got lost in the parser reforms of Tcl 8.1. Added tests for correct behavior. [Bug 1115904]
* | * generic/tclParse.c (Tcl_SubstObj): Fix for failed subst-12.3 test.dgp2004-10-261-2/+2
| | | | | | | | * tests/subst.test (subst-12.3-5): More tests for Bug 1036649.
* | Braces round if bodies...dkf2004-10-061-2/+3
| |
* | * generic/tclParse.c (Tcl_SubstObj): leak fix by dgp, releaseMiguel Sofer2004-07-121-1/+2
| | | | | | | | result on error.
* | Patch 922727 committed. Implements three changes:dgp2004-04-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/tclParse.c (TclParseInit): Modified TclParseInit sodgp2004-03-081-8/+5
| | | | | | | | | | | | * generic/tclTest.c ([testexprparser]): that Tcl_Parse initialization conforms to documented promised about what fields will not be modified by what Tcl_Parse* routines. [Bug 910595]
* | * generic/tclInt.h (TclParseInit): Factored the common codedgp2004-03-041-15/+12
| | | | | | | | | | * generic/tclParse.c (TclParseInit): for initializing a Tcl_Parse * generic/tclParseExpr.c: struct into one routine.
* | * generic/tclParse.c (InitParse): Factored the common codedgp2004-03-041-45/+45
| | | | | | | | for initializing a Tcl_Parse struct into one routine.
* | All uses of 'panic' (the macro) changeddavygrvy2003-12-241-2/+2
| | | | | | | | | | | | | | to 'Tcl_Panic' (the function). The #define of panic in tcl.h clearly states it is deprecated in the comments. [Patch 865264]
* | * generic/tclParse.c: Corrected faulty check for trailing whitedgp2003-11-241-2/+4
| | | | | | | | | | space in {expand} parsing. Thanks Andreas Leitgeb. [Bug 848262]. * tests/parse.test: New tests for the bug.