summaryrefslogtreecommitdiff
path: root/regen_perly.pl
Commit message (Collapse)AuthorAgeFilesLines
* Remove MAD.Jarkko Hietaniemi2014-06-131-1/+1
| | | | | | MAD = Misc Attribute Decoration; unmaintained attempt at preserving the Perl parse tree more faithfully so that automatic conversion to Perl 6 would have been easier.
* Improve the logic in regen_perly.pl for manually generating token macros.Nicholas Clark2013-05-061-3/+8
| | | | | | | | | | | | | Without this fixup the build breaks on Win32. Previously it was enabled using a second regular expression to parse the bison version string. This effectively duplicates the first regular expression that parses the bison version string to determine if the version of bison found can be used. The second regular expression could get missed when changing the first, as happened with commit f5cf236ddbe8e24e. So refactor the code to extract the bison version once, and then use this later as a simple numeric comparison. With this change, we can actually use bison 2.7 to regenerate perly.*
* update regen_perly.pl to recognise bison 2.7Ruslan Zakirov2013-03-031-3/+3
|
* fix regen_perly.pl for bison 2.6Jesse Luehrs2012-09-251-3/+7
|
* Prevent double frees/crashes with format syntax errsFather Chrysostomos2012-08-081-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was brought up in ticket #43425. The new slab allocator for ops (8be227ab5e) makes a CV responsible for cleaning up its ops if it is freed prematurely (before the root is attached). Certain syntax errors involving formats can cause the parser to free the CV owning an op when that op is on the PL_nextval stack. This happens in these cases: format = @ use; format strict . format = @ ;use strict . format foo require bar In the first two cases it is the line containing ‘strict’ that is being interpreted as a format picture line and being fed through force_next by S_scan_formline. Then the error condition kicks in after the force, causing a LEAVE_SCOPE in the parser (perly.c) which frees the sub owning the const op for the format picture. Then a token with a freed op is fed to the parser. To make this clearer, when the second case above is parsed, the tokens produced are as follows: format = [;] [formline] "@\n" [,] ; use [<word>] [;] [formline] <freed> [;] . Notice how there is an implicit semicolon before each (implicit) formline. Notice also how there is an implicit semicolon before the final dot. The <freed> thing represents the "strict\n" constant after it has been freed. (-DT displays it as THING(opval=op_freed).) When the implicit semicolon is emitted before a formline, the next two tokens (formline and the string constant for this format picture line) are put on to the PL_nextval stack via force_next. It is when the implicit semicolon before "strict\n" is emitted that the parser sees the error (there is only one path through the gram- mar that uses the USE token, and it must have two WORDs following it; therefore a semicolon after one WORD is an immediate error), calling LEAVE_SCOPE, which frees the sub created by ‘use’, which owns the const op on the PL_nextval stack containing the word "strict" and con- sequently frees it. I thought I could fix this by putting an implicit do { ... } around the argument line. (This would fix another bug, whereby the argument line in a format can ‘leak out’ of the formline(...).) But this does not solve anything, as we end up with four tokens ( } ; formline const ) on the PL_nextval stack when we emit the implicit semicolon after ‘use’, instead of two. format= @ ;use strict . will turn into format = [;] [formline] "@\n" [,] [do] [{] ; use [<word>] [;] [}] [;] [formline] "strict\n"/<freed> [;] . It is when the lexer reaches "strict" that it will emit the semicolon after the use. So we will be in the same situation as before. So fixing the fact that the argument line can ‘leak out’ of the formline and start a new statement won’t solve this particu- lar problem. I tried eliminating the LEAVE_SCOPE. (See <https://rt.perl.org/rt3/Ticket/Display.html?id=43425#txn-273447> where Dave Mitchell explains that the LEAVE_SCOPE is not strictly nec- essary, but it is ‘still good to ensure that the savestack gets cor- rectly popped during error recovery’.) That does not help, because the lexer itself does ENTER/LEAVE to make sure form_lex_state and lex_formbrack get restored properly after the lexer exits the format (see 583c9d5cccf and 64a408986cf). So when the final dot is reached, the ‘use’ CV is freed. Then an op tree that includes the now-freed "strict\n" const op is passed to newFORM, which tries to do op_free(block) (as of 3 commits ago; before that the errors were more catastrophic), and ends up freeing an op belonging to a freed slab. Removing LEAVE_SCOPE did actually fix ‘format foo require bar’, because there is no ENTER/LEAVE involved there, as the = (ENTER) has not been reached yet. It was failing because ‘require bar’ would call force_next for "bar", and then feed a REQUIRE token to the parser, which would immediately see the error and call LEAVE_SCOPE (free- ing the format), with the "bar" (belonging to the format’s slab) still pending. The final solution I came up with was to reuse an mechanism I came up with earlier. Since the savestack may cause ops to outlive their CVs due to SAVEFREEOP, opslab_force_free (called when an incomplete CV is freed prematurely) will skip any op with o->op_savestack set. The nextval stack can use the same flag. To make sure nothing goes awry (we don’t want the same op on the nextval stack and the savestack at the same time), I added a few assertions.
* regen_perly.pl: support latest bison-2.5.1Reini Urban2012-06-271-5/+5
| | | | | bison-2.5.1 adds less superfluous semicolons at the end of action blocks, but works fine.
* Avoid braces warning in regen_perly.plDavid Mitchell2012-06-131-1/+1
|
* Bump several file copyright datesSteffen Schwigon2012-01-191-1/+1
| | | | | | | Sync copyright dates with actual changes according to git history. [Plus run regen_perly.h to update the SHA-256 checksums, and regen/regcharclass.pl to update regcharclass.h]
* Add an optional third argument to open_new(), to invoke read_only_top() with.Nicholas Clark2011-05-191-8/+5
| | | | Merge together many calls to open_new() and read_only_top().
* Rename safer_open() to open_new(), and eliminate the first parameter.Nicholas Clark2011-05-191-3/+3
| | | | Update the SHA256s where necessary in the generated files.
* Store the SHA-256 of the source in files generated by regen_perly.plNicholas Clark2011-01-231-3/+3
| | | | | | | bison isn't available everywhere, so we can't simply re-run regen_perly.pl to verify that perly.{act,h,tab} are up to date. So instead store the SHA-256 of the input files, and extend t/porting/regen.t to check that the input files haven't been changed subsequently.
* Output "read only" editor blocks from regen_perly.plNicholas Clark2011-01-231-29/+23
| | | | | | | | | Use safer_open() and read_only_bottom_close_and_rename() from regen_lib.pl Consistently use 3 argument open and lexical file handles. A side effect of this change is that the generated files are no longer made read-only on disk - if this is desirable, then probably better to change regen_lib.pl so that all generated files are made read-only.
* Fix typos (spelling errors) in misc. files.Peter J. Acklam) (via RT2011-01-071-1/+1
| | | | | | | | | # New Ticket Created by (Peter J. Acklam) # Please include the string: [perl #81894] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81894 > Signed-off-by: Abigail <abigail@abigail.be>
* af00134636ffe4172cbffeaed3bbad802e58d8a0 broke regen_perly.Zefram2010-10-131-1/+1
|
* avoid unnecessarily changing timestamp on perly.hZefram2010-08-281-10/+17
| | | | | Make regen_perly.pl use rename_if_different() to avoid overwriting files that aren't actually changing.
* Give an error message if bison is not found at allLeon Brocard2010-05-041-0/+4
|
* Update the version requirement message in regen_perly.plVincent Pit2009-03-241-2/+2
|
* Make regen_perly.pl compatible with bison 2.4Vincent Pit2009-03-241-3/+25
|
* merge the four parser stacks into oneDave Mitchell2006-12-171-0/+5
| | | p4raw-id: //depot/perl@29569
* remove extraneous declaration prom perly.tabDave Mitchell2006-12-161-1/+0
| | | p4raw-id: //depot/perl@29564
* misc MAD coredump fixes and parser leak fixesDave Mitchell2006-12-131-0/+4
| | | | | | | | | - fix MAD coredump in tr/// - fix mad coredump in multi-line string literals - kill some MAD uninit value warnings - don't allow assignment to $n in perly.y - make op_dump handle op_latefree flags p4raw-id: //depot/perl@29548
* parser: expand yy_is_opval[] to include all value typesDave Mitchell2006-12-101-19/+62
| | | | | | and rename to yy_type_tab[]. Then use this table to improve stack dumping with -Dpv p4raw-id: //depot/perl@29500
* another fix for bison 2.3Dave Mitchell2006-12-041-0/+3
| | | p4raw-id: //depot/perl@29449
* add support for bison 2.3Dave Mitchell2006-12-031-2/+4
| | | p4raw-id: //depot/perl@29443
* Avoid an error that VC++'s resource compiler seems to haveSteve Hay2006-07-171-2/+3
| | | | | | | | with a reference to "perly.y" in "perly.h" See the thread here for details: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-07/msg00460.html p4raw-id: //depot/perl@28593
* stop OPs leaking in eval "syntax error"Dave Mitchell2006-05-271-0/+42
| | | | | | | | When bison pops states during error recovery, any states holding an OP would leak the OP. Create an extra YY table that tells us which states are of type opval, and when popping one of those, free the op. p4raw-id: //depot/perl@28315
* Fix the last 2 perly.y specific parts of regen_perly.pl, and makeNicholas Clark2006-03-111-2/+2
| | | | | the regen_perly target call it for both perly.y and madly.y. p4raw-id: //depot/perl@27479
* The new REQUIRE token introduced by change 25599 must beRafael Garcia-Suarez2005-10-131-5/+3
| | | | | | | nonassoc, just like the UNIOP token it's patterned after. (While we're at it, allow to use bison 2.1 to regenerate the parser files.) p4raw-id: //depot/perl@25746
* Re: [perl #37039] perlref documentation about optional -> is too vagueYitzchak Scott-Thoennes2005-09-041-1/+1
| | | | | | | Message-Id: <20050902004136.GA2656@efn.org> Allow any variant of bison 1.875 to be used p4raw-id: //depot/perl@25353
* add 1.875c to the list of supported bisonsDave Mitchell2005-05-071-1/+1
| | | p4raw-id: //depot/perl@24411
* Update copyrights.Rafael Garcia-Suarez2005-03-301-5/+1
| | | p4raw-id: //depot/perl@24106
* regen_perly.pl runs fine with bison 2.0.Marcus Holland-Moritz2005-02-101-3/+5
| | | p4raw-id: //depot/perl@23959
* Switch from byacc to bison and simplify the perly.* regenerationDave Mitchell2004-02-141-0/+188
process p4raw-id: //depot/perl@22302