Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: refmt3 with unary -. in labelled arguments #1642

Merged
merged 1 commit into from
Nov 15, 2017

Conversation

anmonteiro
Copy link
Member

fixes #1580

@chenglou
Copy link
Member

cc @IwanKaramazow @jordwalke

@jordwalke
Copy link
Member

jordwalke commented Nov 15, 2017

Great fix! Thank you.
(Iwan, let us know if anything looks off and we can fix)

@jordwalke jordwalke merged commit 985f281 into reasonml:master Nov 15, 2017
chenglou added a commit that referenced this pull request Nov 15, 2017
chenglou added a commit that referenced this pull request Nov 15, 2017
@anmonteiro anmonteiro deleted the gh-1580 branch November 15, 2017 18:56
@IwanKaramazow
Copy link
Contributor

Looks good, nice job!
There might be another trick to solve this without modifying the parser:
set_lexeme_length

If you add a rule:

| "=-"  {
  set_lexeme_length lexbuf 1;
  EQUAL
}

This trick lets you implement look-ahead: you match a longer string which is not completely consumed. The lexer will resume lexing at "-" and should return MINUS or whatever token is matched in combination with MINUS.

anmonteiro added a commit to anmonteiro/reason that referenced this pull request May 20, 2018
This is a follow-up to reasonml#1642 employing the strategy highlighted in the following
comment: reasonml#1642 (comment)

It removes the special case around `LABEL_WITH_EQUAL`, making other valid inputs
parseable too.
anmonteiro added a commit to anmonteiro/reason that referenced this pull request May 28, 2018
This is a follow-up to reasonml#1642 employing the strategy highlighted in the following
comment: reasonml#1642 (comment)

It removes the special case around `LABEL_WITH_EQUAL`, making other valid inputs
parseable too.
anmonteiro added a commit to anmonteiro/reason that referenced this pull request May 30, 2018
This is a follow-up to reasonml#1642 employing the strategy highlighted in the following
comment: reasonml#1642 (comment)

It removes the special case around `LABEL_WITH_EQUAL`, making other valid inputs
parseable too.
chenglou pushed a commit that referenced this pull request May 30, 2018
* Fix syntax error when parsing `let x=-.1;` and co.

This is a follow-up to #1642 employing the strategy highlighted in the following
comment: #1642 (comment)

It removes the special case around `LABEL_WITH_EQUAL`, making other valid inputs
parseable too.

* Fix infix operators that start with equals sign (e.g. `=+`)

also add regression tests for these cases

* check in generated error messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refmt3 with unary -. in labelled arguments
5 participants