Reserve |> and <| symbols.

This commit is contained in:
Stephen Chung 2022-08-18 16:59:54 +08:00
parent b35a9762fb
commit 1bba34b9b7
2 changed files with 13 additions and 1 deletions

View File

@ -65,6 +65,7 @@ Enhancements
* The code base is cleaner by running it through Clippy. * The code base is cleaner by running it through Clippy.
* `ParseError::err_type` and `ParseError::position` are added for convenience. * `ParseError::err_type` and `ParseError::position` are added for convenience.
* The source of an `AST` compiled from a script file is set to the file's path. * The source of an `AST` compiled from a script file is set to the file's path.
* `|>` and `<|` are now reserved symbols.
Version 1.8.0 Version 1.8.0

View File

@ -2036,6 +2036,10 @@ fn get_next_token_inner(
start_pos, start_pos,
)); ));
} }
('<', '|') => {
eat_next(stream, pos);
return Some((Token::Reserved("<|".into()), start_pos));
}
('<', ..) => return Some((Token::LessThan, start_pos)), ('<', ..) => return Some((Token::LessThan, start_pos)),
('>', '=') => { ('>', '=') => {
@ -2067,7 +2071,10 @@ fn get_next_token_inner(
return Some((Token::NotEqualsTo, start_pos)); return Some((Token::NotEqualsTo, start_pos));
} }
('!', '.') => return Some((Token::Reserved("!.".into()), start_pos)), ('!', '.') => {
eat_next(stream, pos);
return Some((Token::Reserved("!.".into()), start_pos));
}
('!', ..) => return Some((Token::Bang, start_pos)), ('!', ..) => return Some((Token::Bang, start_pos)),
('|', '|') => { ('|', '|') => {
@ -2078,6 +2085,10 @@ fn get_next_token_inner(
eat_next(stream, pos); eat_next(stream, pos);
return Some((Token::OrAssign, start_pos)); return Some((Token::OrAssign, start_pos));
} }
('|', '>') => {
eat_next(stream, pos);
return Some((Token::Reserved("|>".into()), start_pos));
}
('|', ..) => return Some((Token::Pipe, start_pos)), ('|', ..) => return Some((Token::Pipe, start_pos)),
('&', '&') => { ('&', '&') => {