- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 125
 
Open
Labels
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
 - I have searched the existing issues of tree-sitter-rust
 
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
}