summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-08-18 22:27:42 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-08-18 22:28:46 -0700
commit8c6b0c7d731fcf4b323b159e772b5fee09f791f3 (patch)
treeaa7554f35ef94837158a63b16d7fdff51f6ee249
parent71fff7cb10b725e79df67426713d410d321f773b (diff)
downloadperl-8c6b0c7d731fcf4b323b159e772b5fee09f791f3.tar.gz
toke.c: Introduce peekspace()
This should make the sites that use LEX_NO_INCLINE a bit less arcane. This has nothing to do with the erstwhile PEEKSPACE macro that existed for MADness’ sake.
-rw-r--r--toke.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index cc728288ba..2da8366203 100644
--- a/toke.c
+++ b/toke.c
@@ -1805,13 +1805,18 @@ S_update_debugger_info(pTHX_ SV *orig_sv, const char *const buf, STRLEN len)
}
/*
- * S_skipspace
+ * skipspace
* Called to gobble the appropriate amount and type of whitespace.
* Skips comments as well.
* Returns the next character after the whitespace that is skipped.
+ *
+ * peekspace
+ * Same thing, but look ahead without incrementing line numbers or
+ * adjusting PL_linestart.
*/
#define skipspace(s) skipspace_flags(s, 0)
+#define peekspace(s) skipspace_flags(s, LEX_NO_INCLINE)
STATIC char *
S_skipspace_flags(pTHX_ char *s, U32 flags)
@@ -6896,7 +6901,7 @@ Perl_yylex(pTHX)
bool arrow;
STRLEN bufoff = PL_bufptr - SvPVX(PL_linestr);
STRLEN soff = s - SvPVX(PL_linestr);
- s = skipspace_flags(s, LEX_NO_INCLINE);
+ s = peekspace(s);
arrow = *s == '=' && s[1] == '>';
PL_bufptr = SvPVX(PL_linestr) + bufoff;
s = SvPVX(PL_linestr) + soff;
@@ -9127,7 +9132,7 @@ S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni)
if ((skip = s < PL_bufend && isSPACE(*s)))
/* Avoid incrementing line numbers or resetting PL_linestart,
in case we have to back up. */
- s2 = skipspace_flags(s, LEX_NO_INCLINE);
+ s2 = peekspace(s);
else
s2 = s;