h1: make ' and ? only allowed as suffixes in identifiers
This commit is contained in:
parent
e31dde1048
commit
69cc34d07e
1 changed files with 8 additions and 1 deletions
|
@ -57,7 +57,11 @@ fn one_or_two(l: &mut Lexer<'_>, kind1: TokenKind, c2: char, kind2: TokenKind) -
|
|||
}
|
||||
|
||||
fn is_ident_char(c: char) -> bool {
|
||||
matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' | '\'' | '?')
|
||||
matches!(c, 'a'..='z' | 'A'..='Z' | '0'..='9' | '_')
|
||||
}
|
||||
|
||||
fn is_ident_extra_char(c: char) -> bool {
|
||||
matches!(c, '\'' | '?')
|
||||
}
|
||||
|
||||
fn ident(l: &mut Lexer<'_>) -> TokenKind {
|
||||
|
@ -65,6 +69,9 @@ fn ident(l: &mut Lexer<'_>) -> TokenKind {
|
|||
while is_ident_char(l.current()) {
|
||||
l.advance();
|
||||
}
|
||||
while is_ident_extra_char(l.current()) {
|
||||
l.advance();
|
||||
}
|
||||
let end = l.position;
|
||||
|
||||
match Span::new(start, end).slice(l.input) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue