Skip to content

Commit

Permalink
Only warn for unary + on spcarg
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Feb 1, 2024
1 parent 787a987 commit db0e5ce
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -9128,12 +9128,10 @@ parser_lex(pm_parser_t *parser) {
LEX(PM_TOKEN_PLUS_EQUAL);
}

bool spcarg = lex_state_spcarg_p(parser, space_seen);
if (spcarg) {
pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS);
}

if (lex_state_beg_p(parser) || spcarg) {
if (
lex_state_beg_p(parser) ||
(lex_state_spcarg_p(parser, space_seen) ? (pm_parser_warn_token(parser, &parser->current, PM_WARN_AMBIGUOUS_FIRST_ARGUMENT_PLUS), true) : false)
) {
lex_state_set(parser, PM_LEX_STATE_BEG);

if (pm_char_is_decimal_digit(peek(parser))) {
Expand Down

0 comments on commit db0e5ce

Please sign in to comment.