summaryrefslogtreecommitdiff
path: root/embed.fnc
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-08-21 18:54:04 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2010-09-06 23:25:34 +0200
commit28ac2b49dea6847c95a32afde577935fec51650f (patch)
tree2af2b2eb45e3584e390fddcc564587e2c2286f4a /embed.fnc
parent544cdeac5a054fa1c1b543769d0076fa6c3faf68 (diff)
downloadperl-28ac2b49dea6847c95a32afde577935fec51650f.tar.gz
function interface to parse Perl statement
yyparse() becomes reentrant. The yacc stack and related resources are allocated in yyparse(), rather than in lex_start(), and they are localised to yyparse(), preserving their values from any outer parser. yyparse() now takes a parameter which determines which production it will parse at the top level. New API function parse_fullstmt() uses this facility to parse just a single statement. The top-level single-statement production that is used for this then messes with the parser's head so that the parsing stops without seeing EOF, and any lookahead token seen after the statement is pushed back to the lexer.
Diffstat (limited to 'embed.fnc')
-rw-r--r--embed.fnc7
1 files changed, 5 insertions, 2 deletions
diff --git a/embed.fnc b/embed.fnc
index 63269f0f7e..ecb6e71f8c 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -622,6 +622,8 @@ AMpd |bool |lex_next_chunk |U32 flags
AMpd |I32 |lex_peek_unichar|U32 flags
AMpd |I32 |lex_read_unichar|U32 flags
AMpd |void |lex_read_space |U32 flags
+: Public parser API
+AMpd |OP* |parse_fullstmt |U32 flags
: Used in various files
Ap |void |op_null |NN OP* o
: FIXME. Used by Data::Alias
@@ -1326,8 +1328,9 @@ p |void |write_to_stderr|NN SV* msv
p |int |yyerror |NN const char *const s
: Used in perly.y, and by Data::Alias
EXp |int |yylex
+p |void |yyunlex
: Used in perl.c, pp_ctl.c
-p |int |yyparse
+p |int |yyparse |int gramtype
: Only used in scope.c
p |void |parser_free |NN const yy_parser *parser
#if defined(PERL_IN_TOKE_C)
@@ -2341,7 +2344,7 @@ s |void |start_force |int where
s |void |curmad |char slot|NULLOK SV *sv
# endif
Mp |int |madlex
-Mp |int |madparse
+Mp |int |madparse |int gramtype
#endif
#if !defined(HAS_SIGNBIT)
AMdnoP |int |Perl_signbit |NV f