rhaiscript / lsp

Language server for Rhai.
Apache License 2.0
43 stars 4 forks source link

Check parse rules for identifiers and numbers #55

Closed schungx closed 2 years ago

schungx commented 2 years ago

Rhai identifiers are slightly different from Rust. For example, the first non-underscore character must be a letter and not a digit, so _0X is not allowed as an identifier.

Also, numbers cannot start with an underscore, so _10 is a syntax error. Otherwise it is too easy to confuse with -10.

A number's decimal point cannot be followed immediately by a _. Therefore, 10._1 is not allowed, but 10_.1 is OK.

NOTE: Your Rhai panel with the parse tree works wonders in finding out these issues.