summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y43
1 files changed, 17 insertions, 26 deletions
diff --git a/parse.y b/parse.y
index 04f72d1aeb..0dc04783b9 100644
--- a/parse.y
+++ b/parse.y
@@ -5232,6 +5232,8 @@ ripper_yylval_id(ID x)
#ifndef RIPPER
#define ripper_flush(p) (void)(p)
+#define dispatch_scan_event(t) ((void)0)
+#define dispatch_delayed_token(t) ((void)0)
#else
#define ripper_flush(p) ((p)->tokp = (p)->lex.pcur)
@@ -5274,6 +5276,7 @@ ripper_dispatch_ignored_scan_event(struct parser_params *parser, int t)
if (!ripper_has_scan_event(parser)) return;
(void)ripper_scan_event_val(parser, t);
}
+#define dispatch_scan_event(t) ripper_dispatch_ignored_scan_event(parser, t)
static void
ripper_dispatch_delayed_token(struct parser_params *parser, int t)
@@ -5288,6 +5291,7 @@ ripper_dispatch_delayed_token(struct parser_params *parser, int t)
ruby_sourceline = saved_line;
parser->tokp = saved_tokp;
}
+#define dispatch_delayed_token(t) ripper_dispatch_delayed_token(parser, t)
#endif /* RIPPER */
#include "ruby/regex.h"
@@ -8031,15 +8035,10 @@ parser_yylex(struct parser_params *parser)
space_seen = 1;
break;
case '.': {
-#ifdef RIPPER
- ripper_dispatch_delayed_token(parser, tIGNORED_NL);
-#endif
- if ((c = nextc()) != '.') {
+ dispatch_delayed_token(tIGNORED_NL);
+ if (!peek('.')) {
pushback(c);
- pushback('.');
-#ifdef RIPPER
- ripper_dispatch_scan_event(parser, tSP);
-#endif
+ dispatch_scan_event(tSP);
goto retry;
}
}
@@ -8127,35 +8126,29 @@ parser_yylex(struct parser_params *parser)
if (was_bol()) {
/* skip embedded rd document */
if (strncmp(lex_p, "begin", 5) == 0 && ISSPACE(lex_p[5])) {
-#ifdef RIPPER
- int first_p = TRUE;
+ int first_p = TRUE;
- lex_goto_eol(parser);
- ripper_dispatch_scan_event(parser, tEMBDOC_BEG);
-#endif
+ lex_goto_eol(parser);
+ dispatch_scan_event(tEMBDOC_BEG);
for (;;) {
lex_goto_eol(parser);
-#ifdef RIPPER
- if (!first_p) {
- ripper_dispatch_scan_event(parser, tEMBDOC);
- }
- first_p = FALSE;
-#endif
+ if (!first_p) {
+ dispatch_scan_event(tEMBDOC);
+ }
+ first_p = FALSE;
c = nextc();
if (c == -1) {
compile_error(PARSER_ARG "embedded document meets end of file");
return 0;
}
if (c != '=') continue;
- if (strncmp(lex_p, "end", 3) == 0 &&
+ if (c == '=' && strncmp(lex_p, "end", 3) == 0 &&
(lex_p + 3 == lex_pend || ISSPACE(lex_p[3]))) {
break;
}
}
lex_goto_eol(parser);
-#ifdef RIPPER
- ripper_dispatch_scan_event(parser, tEMBDOC_END);
-#endif
+ dispatch_scan_event(tEMBDOC_END);
goto retry;
}
}
@@ -8559,9 +8552,7 @@ parser_yylex(struct parser_params *parser)
c = nextc();
if (c == '\n') {
space_seen = 1;
-#ifdef RIPPER
- ripper_dispatch_scan_event(parser, tSP);
-#endif
+ dispatch_scan_event(tSP);
goto retry; /* skip \\n */
}
pushback(c);