summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorJosh Cheek <josh.cheek@gmail.com>2019-02-05 22:11:30 -0600
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-15 11:25:13 +0900
commit5af5dd463929837f7684d1e0865ac2d9394e19a5 (patch)
tree27866e2ecb28ed4c8ca856b615f835fdad6671d7 /parse.y
parente6aefe2a135102095bcaec379251dff2f4e843d6 (diff)
Omg, it works!
I'll rename it and squash this commit later, just wanted to make sure I couldn't lose it (took a long time to come up with).
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y9
1 files changed, 8 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index ff0afed99e..2b7ff111ac 100644
--- a/parse.y
+++ b/parse.y
@@ -91,6 +91,7 @@ enum lex_state_bits {
EXPR_LABEL_bit, /* flag bit, label is allowed. */
EXPR_LABELED_bit, /* flag bit, just after a label. */
EXPR_FITEM_bit, /* symbol literal as FNAME. */
+ EXPR_LINEND_bit,
EXPR_MAX_STATE
};
/* examine combinations */
@@ -109,6 +110,7 @@ enum lex_state_e {
DEF_EXPR(LABEL),
DEF_EXPR(LABELED),
DEF_EXPR(FITEM),
+ DEF_EXPR(LINEND),
EXPR_VALUE = EXPR_BEG,
EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS),
EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
@@ -8654,6 +8656,7 @@ parser_yylex(struct parser_params *p)
set_file_encoding(p, p->lex.pcur, p->lex.pend);
}
}
+
lex_goto_eol(p);
dispatch_scan_event(p, tCOMMENT);
fallthru = TRUE;
@@ -8678,6 +8681,10 @@ parser_yylex(struct parser_params *p)
case '\13': /* '\v' */
space_seen = 1;
break;
+ case '#':
+ SET_LEX_STATE(EXPR_LINEND);
+ pushback(p, c);
+ goto retry;
case '|':
case '&':
case '.': {
@@ -10016,7 +10023,7 @@ new_regexp(struct parser_params *p, VALUE re, VALUE opt, const YYLTYPE *loc)
static const char rb_parser_lex_state_names[][13] = {
"EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG",
"EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS",
- "EXPR_LABEL", "EXPR_LABELED","EXPR_FITEM",
+ "EXPR_LABEL", "EXPR_LABELED","EXPR_FITEM", "EXPR_LINEND",
};
static VALUE