-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
Add !
suffix to parser
#6586
Add !
suffix to parser
#6586
Conversation
!
suffix to parser
if state.bytes().starts_with(b"!") { | ||
( | ||
progress, | ||
Loc::at(expr.region, Expr::Suffixed(arena.alloc(expr.value))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really unsure about this. My concern is the that Loc in expr
here points to just the ident and doesn't include the !
in it. I'm not sure if that is an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If so, we'll see this in error messages when we get to testing those - the red underline either will or won't include the !
depending on this. That might actually be what we want in some cases, but maybe not others!
loc_possibly_negative_or_negated_term(options).parse(arena, state, min_indent)?; | ||
let (_, expr, state) = loc_possibly_negative_or_negated_term(options) | ||
.parse(arena, state, min_indent) | ||
.map(|(progress, expr, state)| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this wouldn't be needed as the map in parse_expr_end
would wrap the expressions in Suffix, but the loc_possibly_negative_or_negated_term
parser doesn't seem to catch everything.
@@ -619,6 +619,7 @@ pub fn desugar_expr<'a>( | |||
}) | |||
} | |||
LowLevelDbg(_, _, _) => unreachable!("Only exists after desugaring"), | |||
Suffixed(_) => todo!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be completed in follow up PRs. One for each flavour of sugar.
# and modify it, and it will modify all the fixture tests. | ||
# | ||
# If this file is in the fixtures/ directory, on the other hand, then | ||
# it is gitignored and will be overwritten the next time tests run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, according to this comment, this file should be gitignored... 🤨
Seems like we might not be doing this correctly, although I didn't set up the fixture system and I'm not sure how it's supposed to work. 😅
Looks good overall! 😍 I'd like to get clarification from someone who knows how the fixtures are supposed to work before merging though, in case those are things we shouldn't be checking in (which seems to be the case, based on the comment at the top, but that comment also says they should be gitignored...so I'm not sure what's correct!) |
d5f43fe
to
f48ac46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic, thanks so much @lukewilliamboswell! 😍
This PR;
!
for idents e.g.foo! (bar! baz) (blah stuff)
as described in chaining syntax proposal