This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add lex_stuff_pvs()
authorZefram <zefram@fysh.org>
Sun, 15 Aug 2010 20:36:11 +0000 (21:36 +0100)
committerFlorian Ragwitz <rafl@debian.org>
Sun, 22 Aug 2010 03:19:34 +0000 (05:19 +0200)
New macro lex_stuff_pvs(), wrapping lex_stuff_pvn() for literal strings.

ext/XS-APItest-KeywordRPN/KeywordRPN.xs
handy.h

index adb7e6b..a5dfcd9 100644 (file)
@@ -166,7 +166,7 @@ static OP *THX_parse_keyword_stufftest(pTHX)
        } else if(c != /*{*/'}') {
                croak("syntax error");
        }
-       if(do_stuff) lex_stuff_pvn(" ", 1, 0);
+       if(do_stuff) lex_stuff_pvs(" ", 0);
        return newOP(OP_NULL, 0);
 }
 #define parse_keyword_stufftest() THX_parse_keyword_stufftest(aTHX)
diff --git a/handy.h b/handy.h
index d6205c5..bbeb1ff 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -314,6 +314,13 @@ Like C<hv_fetch>, but takes a literal string instead of a string/length pair.
 Like C<hv_store>, but takes a literal string instead of a string/length pair
 and omits the hash parameter.
 
+=head1 Lexer interface
+
+=for apidoc Amx|void|lex_stuff_pvs|const char *pv|U32 flags
+
+Like L</lex_stuff_pvn>, but takes a literal string instead of a
+string/length pair.
+
 =cut
 */
 
@@ -344,6 +351,8 @@ and omits the hash parameter.
   ((SV **)Perl_hv_common(aTHX_ (hv), NULL, STR_WITH_LEN(key), 0,       \
                         (HV_FETCH_ISSTORE|HV_FETCH_JUST_SV), (val), 0))
 
+#define lex_stuff_pvs(pv,flags) Perl_lex_stuff_pvn(aTHX_ STR_WITH_LEN(pv), flags)
+
 #define get_cvs(str, flags)                                    \
        Perl_get_cvn_flags(aTHX_ STR_WITH_LEN(str), (flags))