Skip to content

Commit 3e9c684

Browse files
committed
[PRISM] Allow space before encoding comment
1 parent 86e0d83 commit 3e9c684

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

prism/prism.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19359,6 +19359,11 @@ pm_parser_init(pm_parser_t *parser, const uint8_t *source, size_t size, const pm
1935919359
pm_newline_list_clear(&parser->newline_list);
1936019360
}
1936119361
}
19362+
19363+
// The encoding comment can start after any amount of inline whitespace, so
19364+
// here we'll advance it to the first non-inline-whitespace character so
19365+
// that it is ready for future comparisons.
19366+
parser->encoding_comment_start += pm_strspn_inline_whitespace(parser->encoding_comment_start, parser->end - parser->encoding_comment_start);
1936219367
}
1936319368

1936419369
/**

spec/prism.mspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ MSpec.register(:exclude, "A Symbol literal raises an SyntaxError at parse time w
2929
## Core
3030
MSpec.register(:exclude, "IO.popen with a leading Array argument accepts a trailing Hash of Process.exec options")
3131
MSpec.register(:exclude, "IO.popen with a leading Array argument accepts an IO mode argument following the Array")
32-
MSpec.register(:exclude, "Kernel#eval with a magic encoding comment allows spaces before the magic encoding comment")
33-
MSpec.register(:exclude, "Kernel#eval with a magic encoding comment allows a shebang line and some spaces before the magic encoding comment")
3432
MSpec.register(:exclude, "TracePoint#eval_script is the evald source code")
3533
MSpec.register(:exclude, "TracePoint#event returns the type of event")
3634
MSpec.register(:exclude, "TracePoint#inspect returns a String showing the event, method, path and line for a :return event")

0 commit comments

Comments
 (0)