Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
No response
Describe the bug
Literal expressions can have any suffix. https://doc.rust-lang.org/reference/expressions/literal-expr.html
For example, this is valid Rust:
fn main() {
assert_eq!(100d + 11h + 8m + 7s, DURATION);
}
The culit makes use of this feature to let users define custom literals.
We should have a separate node for the suffix and the body, so we can color the suffix differently, e.g. 100years with 100 being color A and years being color B
String literals, char literals, float literals, integer literals support custom suffixes.
Steps To Reproduce/Bad Parse Tree
For 100d + 100h I got:
(binary_expression
left: (integer_literal)
(ERROR
(identifier)) "+"
right: (integer_literal))
(ERROR
(identifier))
Expected Behavior/Parse Tree
but I expected something like:
(binary_expression
left: (integer_literal (suffix)) "+"
right: (integer_literal (suffix)))
Repro
fn main() {
100d + 100h
}
Did you check existing issues?
Tree-Sitter CLI Version, if relevant (output of
tree-sitter --version)No response
Describe the bug
Literal expressions can have any suffix. https://doc.rust-lang.org/reference/expressions/literal-expr.html
For example, this is valid Rust:
The
culitmakes use of this feature to let users define custom literals.We should have a separate node for the suffix and the body, so we can color the suffix differently, e.g.
100yearswith100being color A andyearsbeing color BString literals, char literals, float literals, integer literals support custom suffixes.
Steps To Reproduce/Bad Parse Tree
For
100d + 100hI got:Expected Behavior/Parse Tree
but I expected something like:
Repro