feat: support negation of int
* add unary op * parse, typecheck, and code gen it * express boolean not as unary op as well, previously called negate Co-authored-by: rvcas <x@rvcas.dev>
This commit is contained in:
@@ -9,13 +9,9 @@ use super::{error::ParseError, token::Token};
|
||||
pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> {
|
||||
let int = choice((
|
||||
text::int(10),
|
||||
text::int(16),
|
||||
just("-")
|
||||
.ignore_then(text::int(10))
|
||||
.map(|value: String| format!("-{}", &value)),
|
||||
just("-")
|
||||
.ignore_then(text::int(16))
|
||||
.map(|value: String| format!("-{}", &value)),
|
||||
))
|
||||
.map(|value| Token::Int { value });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user