In perl.git, the branch sprout/parser has been created
<http://perl5.git.perl.org/perl.git/commitdiff/9c16692ae587e5bd78e85eea162d6b05be41001f?hp=0000000000000000000000000000000000000000>
at 9c16692ae587e5bd78e85eea162d6b05be41001f (commit)
- Log -----------------------------------------------------------------
commit 9c16692ae587e5bd78e85eea162d6b05be41001f
Author: Father Chrysostomos <[email protected]>
Date: Fri Aug 15 22:17:20 2014 -0700
Use YYEMIT for rightbracket
NOTE: This is currently causing test failures because, for some
unknown reason some syntax errors have been reworded:
# got "syntax error at - line 12, near \"used\"\nsyntax error at -
line 12, next char ;\nUnmatched right curly bracket at - line 14, at end of
line\nExecution of - aborted due to compilation errors."
# expected "syntax error at - line 12, near \"used\"\nsyntax error at -
line 12, near \"used}\"\nUnmatched right curly bracket at - line 14, at end of
line\nExecution of - aborted due to compilation errors."
Presumably the value of PL_bufptr changed. Need to look into this.
----------------------
The code in toke.c under the ârightbracketâ label is more straight-
forward now. The tokens are emitted in the order they appear in the
code, so you donât have to tie your brain in knots to understand it.
I had to tweak the setting of PL_expect (aka PL_parser->expect) to
keep things working.
As it worked before, the parser (perly.y) would set PL_expect to
XSTATE after encountering a statement-terminating semicolon, which
would then be overridden by the the following '}' token (force_next
remembers the current value of PL_expect and it is set to that when
the next token is emitted).
If we are not using force_next, then YYEMIT(';') will make the parser
set PL_expect before we emit the '}', so the value yylex just set it
to will be clobbered.
It turns out that having the parser set it to XSTATE just makes things
more complicated. We can instead have the lexer set it to XSTATE by
default when emitting an explicit semicolon. (It was setting it to
XTERM.) The parser can set it to XTERM in the only place that mat-
ters; viz., the header of a for-loop.
As a result, op.c:Perl_package and Perl_utilize no longer need to set
PL_expect at all.
M op.c
M perly.act
M perly.h
M perly.tab
M perly.y
M toke.c
commit ed02f4153f1d7db0002e4339c97d02409be4e39e
Author: Father Chrysostomos <[email protected]>
Date: Fri Aug 15 22:18:18 2014 -0700
Revert a premature hunk from prev. commit
causes test failures; needs debugging
M toke.c
commit 436e20b1e7e1e7bc8ffc1a014e82d06c847fe671
Author: Father Chrysostomos <[email protected]>
Date: Fri Aug 15 18:08:52 2014 -0700
toke.c: Some conversions from force_next to YYEMIT
M toke.c
commit f0a96564b982f5cea70058d5bd3b8825e3972475
Author: Father Chrysostomos <[email protected]>
Date: Thu Aug 14 17:54:19 2014 -0700
Allow yylex to call the parser
yylex is expected to return exactly one token each time it is called.
Sometimes, it needs to remember a sequence of tokens, so these tokens
are stashed away in the parser struct and then emitted on the next
call (or next few calls) to yylex.
This makes yylex a lot more complicated than it would be if it could
call the parser and feed several tokens into it in a row.
This commit introduces a new parser function, yyemit, that is
intended to allow that. As of yet, nothing calls it, so the mechan-
ism is untested.
M embed.fnc
M embed.h
M perly.c
M proto.h
M toke.c
-----------------------------------------------------------------------
--
Perl5 Master Repository