update dependencies

This commit is contained in:
2022-02-24 23:59:14 +01:00
parent 132aea3996
commit f433948d4e
4 changed files with 35 additions and 37 deletions

12
Cargo.lock generated
View File

@@ -34,9 +34,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chumsky" name = "chumsky"
version = "0.5.0" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2d3efff85e8572b1c3fa0127706af58c4fff8458f8d9436d54b1e97573c7a3f" checksum = "8d02796e4586c6c41aeb68eae9bfb4558a522c35f1430c14b40136c3706e09e4"
dependencies = [ dependencies = [
"ahash", "ahash",
] ]
@@ -139,18 +139,18 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]] [[package]]
name = "wasm-encoder" name = "wasm-encoder"
version = "0.8.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db0c351632e46cc06a58a696a6c11e4cf90cad4b9f8f07a0b59128d616c29bb0" checksum = "aa9d9bf45fc46f71c407837c9b30b1e874197f2dc357588430b21e5017d290ab"
dependencies = [ dependencies = [
"leb128", "leb128",
] ]
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
version = "0.81.0" version = "0.83.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98930446519f63d00a836efdc22f67766ceae8dbcc1571379f2bcabc6b2b9abc" checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a"
[[package]] [[package]]
name = "yansi" name = "yansi"

View File

@@ -7,9 +7,9 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
wasmparser = "0.81" wasmparser = "0.83"
wasm-encoder = "0.8" wasm-encoder = "0.10"
anyhow = "1" anyhow = "1"
chumsky = "0.5" chumsky = "0.8"
ariadne = "0.1" ariadne = "0.1"
pico-args = "0.4" pico-args = "0.4"

View File

@@ -464,7 +464,7 @@ fn emit_expression<'a>(ctx: &mut FunctionContext<'a>, expr: &'a ast::Expression)
(I32, Or) => Instruction::I32Or, (I32, Or) => Instruction::I32Or,
(I32, Xor) => Instruction::I32Xor, (I32, Xor) => Instruction::I32Xor,
(I32, Eq) => Instruction::I32Eq, (I32, Eq) => Instruction::I32Eq,
(I32, Ne) => Instruction::I32Neq, (I32, Ne) => Instruction::I32Ne,
(I32, Lt) => Instruction::I32LtS, (I32, Lt) => Instruction::I32LtS,
(I32, LtU) => Instruction::I32LtU, (I32, LtU) => Instruction::I32LtU,
(I32, Le) => Instruction::I32LeS, (I32, Le) => Instruction::I32LeS,
@@ -488,7 +488,7 @@ fn emit_expression<'a>(ctx: &mut FunctionContext<'a>, expr: &'a ast::Expression)
(I64, Or) => Instruction::I64Or, (I64, Or) => Instruction::I64Or,
(I64, Xor) => Instruction::I64Xor, (I64, Xor) => Instruction::I64Xor,
(I64, Eq) => Instruction::I64Eq, (I64, Eq) => Instruction::I64Eq,
(I64, Ne) => Instruction::I64Neq, (I64, Ne) => Instruction::I64Ne,
(I64, Lt) => Instruction::I64LtS, (I64, Lt) => Instruction::I64LtS,
(I64, LtU) => Instruction::I64LtU, (I64, LtU) => Instruction::I64LtU,
(I64, Le) => Instruction::I64LeS, (I64, Le) => Instruction::I64LeS,
@@ -510,7 +510,7 @@ fn emit_expression<'a>(ctx: &mut FunctionContext<'a>, expr: &'a ast::Expression)
DivU | Rem | RemU | And | Or | Xor | Shl | ShrU | ShrS | LtU | LeU | GtU | GeU, DivU | Rem | RemU | And | Or | Xor | Shl | ShrU | ShrS | LtU | LeU | GtU | GeU,
) => unreachable!(), ) => unreachable!(),
(F32, Eq) => Instruction::F32Eq, (F32, Eq) => Instruction::F32Eq,
(F32, Ne) => Instruction::F32Neq, (F32, Ne) => Instruction::F32Ne,
(F32, Lt) => Instruction::F32Lt, (F32, Lt) => Instruction::F32Lt,
(F32, Le) => Instruction::F32Le, (F32, Le) => Instruction::F32Le,
(F32, Gt) => Instruction::F32Gt, (F32, Gt) => Instruction::F32Gt,
@@ -525,7 +525,7 @@ fn emit_expression<'a>(ctx: &mut FunctionContext<'a>, expr: &'a ast::Expression)
DivU | Rem | RemU | And | Or | Xor | Shl | ShrU | ShrS | LtU | LeU | GtU | GeU, DivU | Rem | RemU | And | Or | Xor | Shl | ShrU | ShrS | LtU | LeU | GtU | GeU,
) => unreachable!(), ) => unreachable!(),
(F64, Eq) => Instruction::F64Eq, (F64, Eq) => Instruction::F64Eq,
(F64, Ne) => Instruction::F64Neq, (F64, Ne) => Instruction::F64Ne,
(F64, Lt) => Instruction::F64Lt, (F64, Lt) => Instruction::F64Lt,
(F64, Le) => Instruction::F64Le, (F64, Le) => Instruction::F64Le,
(F64, Gt) => Instruction::F64Gt, (F64, Gt) => Instruction::F64Gt,

View File

@@ -138,7 +138,7 @@ fn report_errors(errors: Vec<Simple<String>>, source: &str) {
} else { } else {
error error
.expected() .expected()
.map(|x| x.to_string()) .map(|x| x.as_deref().unwrap_or("EOF"))
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(", ") .join(", ")
} }
@@ -168,7 +168,7 @@ fn report_errors(errors: Vec<Simple<String>>, source: &str) {
fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> { fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> {
let float64 = text::int(10) let float64 = text::int(10)
.chain::<char, _, _>(just('.').chain(text::digits(10))) .chain::<char, _, _>(just('.').chain(text::digits(10)))
.then_ignore(seq::<_, _, Simple<char>>("f64".chars())) .then_ignore(just("f64"))
.collect::<String>() .collect::<String>()
.map(Token::Float64); .map(Token::Float64);
@@ -177,7 +177,7 @@ fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> {
.collect::<String>() .collect::<String>()
.map(Token::Float); .map(Token::Float);
let integer = seq::<_, _, Simple<char>>("0x".chars()) let integer = just::<_, _, Simple<char>>("0x")
.ignore_then(text::int(16)) .ignore_then(text::int(16))
.try_map(|n, span| { .try_map(|n, span| {
u64::from_str_radix(&n, 16).map_err(|err| Simple::custom(span, err.to_string())) u64::from_str_radix(&n, 16).map_err(|err| Simple::custom(span, err.to_string()))
@@ -190,7 +190,7 @@ fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> {
let int64 = integer let int64 = integer
.clone() .clone()
.then_ignore(seq::<_, _, Simple<char>>("i64".chars())) .then_ignore(just("i64"))
.map(|n| Token::Int64(n as i64)); .map(|n| Token::Int64(n as i64));
let int = integer.try_map(|n, span| { let int = integer.try_map(|n, span| {
@@ -205,14 +205,14 @@ fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> {
.collect::<String>() .collect::<String>()
.map(Token::Str); .map(Token::Str);
let op = one_of("+-*/%&^|<=>#".chars()) let op = one_of("+-*/%&^|<=>#")
.repeated() .repeated()
.at_least(1) .at_least(1)
.or(just(':').chain(just('='))) .or(just(':').chain(just('=')))
.collect::<String>() .collect::<String>()
.map(Token::Op); .map(Token::Op);
let ctrl = one_of("(){};,:?!$".chars()).map(Token::Ctrl); let ctrl = one_of("(){};,:?!$").map(Token::Ctrl);
fn ident() -> impl Parser<char, String, Error = Simple<char>> + Copy + Clone { fn ident() -> impl Parser<char, String, Error = Simple<char>> + Copy + Clone {
filter(|c: &char| c.is_ascii_alphabetic() || *c == '_') filter(|c: &char| c.is_ascii_alphabetic() || *c == '_')
@@ -242,11 +242,9 @@ fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = Simple<char>> {
_ => Token::Ident(ident), _ => Token::Ident(ident),
}); });
let single_line = let single_line = just("//").then_ignore(take_until(text::newline()));
seq::<_, _, Simple<char>>("//".chars()).then_ignore(take_until(text::newline()));
let multi_line = let multi_line = just("/*").then_ignore(take_until(just("*/")));
seq::<_, _, Simple<char>>("/*".chars()).then_ignore(take_until(seq("*/".chars())));
let comment = single_line.or(multi_line); let comment = single_line.or(multi_line);
@@ -412,7 +410,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.then(expression.clone()) .then(expression.clone())
.then_ignore(just(Token::Ctrl(','))) .then_ignore(just(Token::Ctrl(',')))
.then(expression.clone()) .then(expression.clone())
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.map(|((condition, if_true), if_false)| ast::Expr::Select { .map(|((condition, if_true), if_false)| ast::Expr::Select {
condition: Box::new(condition), condition: Box::new(condition),
@@ -426,7 +424,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
expression expression
.clone() .clone()
.separated_by(just(Token::Ctrl(','))) .separated_by(just(Token::Ctrl(',')))
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.map(|(name, params)| ast::Expr::FuncCall { name, params }) .map(|(name, params)| ast::Expr::FuncCall { name, params })
.boxed(); .boxed();
@@ -451,7 +449,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.map_with_span(|expr, span| expr.with_span(span)) .map_with_span(|expr, span| expr.with_span(span))
.or(expression .or(expression
.clone() .clone()
.delimited_by(Token::Ctrl('('), Token::Ctrl(')'))) .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))))
.or(block) .or(block)
.recover_with(nested_delimiters( .recover_with(nested_delimiters(
Token::Ctrl('('), Token::Ctrl('('),
@@ -720,7 +718,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
} }
.with_span(span) .with_span(span)
}) })
.delimited_by(Token::Ctrl('{'), Token::Ctrl('}')) .delimited_by(just(Token::Ctrl('{')), just(Token::Ctrl('}')))
.boxed() .boxed()
}); });
@@ -731,7 +729,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.ignore_then( .ignore_then(
integer integer
.clone() .clone()
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.map(|min_size| ast::ImportType::Memory(min_size as u32)) .map(|min_size| ast::ImportType::Memory(min_size as u32))
.boxed(); .boxed();
@@ -753,7 +751,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.then( .then(
type_parser() type_parser()
.separated_by(just(Token::Ctrl(','))) .separated_by(just(Token::Ctrl(',')))
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.then( .then(
just(Token::Op("->".to_string())) just(Token::Op("->".to_string()))
@@ -793,7 +791,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.then( .then(
parameter parameter
.separated_by(just(Token::Ctrl(','))) .separated_by(just(Token::Ctrl(',')))
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.then( .then(
just(Token::Op("->".to_string())) just(Token::Op("->".to_string()))
@@ -843,7 +841,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
expression expression
.clone() .clone()
.separated_by(just(Token::Ctrl(','))) .separated_by(just(Token::Ctrl(',')))
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.map(|(type_, values)| ast::DataValues::Array { type_, values }); .map(|(type_, values)| ast::DataValues::Array { type_, values });
@@ -853,7 +851,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.ignore_then( .ignore_then(
string string
.clone() .clone()
.delimited_by(Token::Ctrl('('), Token::Ctrl(')')), .delimited_by(just(Token::Ctrl('(')), just(Token::Ctrl(')'))),
) )
.map(|s| ast::DataValues::File { .map(|s| ast::DataValues::File {
path: s.into(), path: s.into(),
@@ -867,7 +865,7 @@ fn script_parser() -> impl Parser<Token, ast::Script, Error = Simple<Token>> + C
.or(data_string) .or(data_string)
.or(data_file) .or(data_file)
.repeated() .repeated()
.delimited_by(Token::Ctrl('{'), Token::Ctrl('}')), .delimited_by(just(Token::Ctrl('{')), just(Token::Ctrl('}'))),
) )
.map(|(offset, data)| { .map(|(offset, data)| {
ast::TopLevelItem::Data(ast::Data { ast::TopLevelItem::Data(ast::Data {
@@ -908,10 +906,10 @@ fn type_parser() -> impl Parser<Token, ast::Type, Error = Simple<Token>> + Clone
_ => Err(Simple::expected_input_found( _ => Err(Simple::expected_input_found(
span, span,
vec![ vec![
Token::Ident("i32".into()), Some(Token::Ident("i32".into())),
Token::Ident("i64".into()), Some(Token::Ident("i64".into())),
Token::Ident("f32".into()), Some(Token::Ident("f32".into())),
Token::Ident("f64".into()), Some(Token::Ident("f64".into())),
], ],
Some(tok), Some(tok),
)), )),