mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-18 23:02:35 +03:00
fix bugs
This commit is contained in:
parent
a230bd1477
commit
3b62e3cc97
@ -69,7 +69,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
|||||||
self.reducer.reduce_group_value(group_value, new)
|
self.reducer.reduce_group_value(group_value, new)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reduce_string(&mut self, string: &String, span: &Span) -> Result<Expression> {
|
pub fn reduce_string(&mut self, string: &str, span: &Span) -> Result<Expression> {
|
||||||
self.reducer.reduce_string(string, span)
|
self.reducer.reduce_string(string, span)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ pub trait ReconstructingReducer {
|
|||||||
Ok(new)
|
Ok(new)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reduce_string(&mut self, string: &String, span: &Span) -> Result<Expression> {
|
fn reduce_string(&mut self, string: &str, span: &Span) -> Result<Expression> {
|
||||||
Ok(Expression::Value(ValueExpression::String(string.clone(), *span)))
|
Ok(Expression::Value(ValueExpression::String(string.to_string(), *span)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reduce_value(&mut self, _value: &ValueExpression, new: Expression) -> Result<Expression> {
|
fn reduce_value(&mut self, _value: &ValueExpression, new: Expression) -> Result<Expression> {
|
||||||
|
@ -184,26 +184,33 @@ impl Token {
|
|||||||
return Ok((1, Token::WhiteSpace));
|
return Ok((1, Token::WhiteSpace));
|
||||||
}
|
}
|
||||||
Some('"') => {
|
Some('"') => {
|
||||||
let mut string = String::from("\"");
|
let mut string = String::new();
|
||||||
input.next();
|
input.next();
|
||||||
|
|
||||||
let mut ended = false;
|
let mut ended = false;
|
||||||
while let Some(c) = input.next() {
|
while let Some(c) = input.next() {
|
||||||
|
|
||||||
|
// Check for illegal characters.
|
||||||
if is_bidi_override(c) {
|
if is_bidi_override(c) {
|
||||||
return Err(ParserError::lexer_bidi_override().into());
|
return Err(ParserError::lexer_bidi_override().into());
|
||||||
}
|
}
|
||||||
string.push(c);
|
|
||||||
|
// Check for end string quotation mark.
|
||||||
if c == '"' {
|
if c == '"' {
|
||||||
|
input.next();
|
||||||
ended = true;
|
ended = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
string.push(c);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ended {
|
if !ended {
|
||||||
return Err(ParserError::lexer_string_not_closed(string).into());
|
return Err(ParserError::lexer_string_not_closed(string).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ok((string.len(), Token::StaticString(string)));
|
// + 2 to account for parsing quotation marks.
|
||||||
|
return Ok((string.len() + 2, Token::StaticString(string)));
|
||||||
}
|
}
|
||||||
Some(x) if x.is_ascii_digit() => {
|
Some(x) if x.is_ascii_digit() => {
|
||||||
return Self::eat_integer(&mut input);
|
return Self::eat_integer(&mut input);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
function main(a: u8, b: u8) -> u8 {
|
function main() -> bool {
|
||||||
return a + b;
|
console.log("hello world");
|
||||||
|
return true;
|
||||||
}
|
}
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 6b9e5227fdce9f916cd2398ea85c2d7e7b2f7d706bfa730b8cd1acdeb3f168cd
|
- initial_input_ast: 6b9e5227fdce9f916cd2398ea85c2d7e7b2f7d706bfa730b8cd1acdeb3f168cd
|
||||||
initial_ast: 0ae1ebc0e62265d17e6b569f2f8ac5b6ce6514b9403c68ab581c44f1cfbe9c31
|
initial_ast: 924990af41e1da41be7f17b864973f578151d4b1dd88faa87ebe7323556c831a
|
||||||
symbol_table: 96b1b61a449645b155fdf9499ec0dfe7281795ae5bde4a57d081bdf4021bb72b
|
symbol_table: d46f6eb98259f34d32a60788aa178efa34166bcc6ba1058e2ff5f8327a129b9c
|
||||||
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 89959164cbf734ac0d261c7459b9c1214eb2f4b3ab9ec57a0b22db487d6537e4
|
- initial_input_ast: 89959164cbf734ac0d261c7459b9c1214eb2f4b3ab9ec57a0b22db487d6537e4
|
||||||
initial_ast: f3a9cc35481db214372f311df86bdeff108ced2951f36c35bc5e3f4cf874b9fd
|
initial_ast: f1a229d14ad73df0116cc855e95de9541c02bb1fb7d4c89cd06cec83e6f1753f
|
||||||
symbol_table: f09a4b65028c90ac4d6b84d217b187e692ac65ff713943b27f6ad44c2d154b45
|
symbol_table: 559484bc163178bf54b169f5dd573167771566aa993055b6a28f0c1a759339bc
|
||||||
|
@ -5,5 +5,5 @@ outputs:
|
|||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 4132cf36ac66f6b23e249f81b5c2aafa58e4e5e945920cc29752edc5d6d8057f
|
- initial_input_ast: 4132cf36ac66f6b23e249f81b5c2aafa58e4e5e945920cc29752edc5d6d8057f
|
||||||
- initial_input_ast: 586ed72429932a1aafcd0f8eed983a4babff8eada9c028b88bbeef24dab1cbc0
|
- initial_input_ast: 586ed72429932a1aafcd0f8eed983a4babff8eada9c028b88bbeef24dab1cbc0
|
||||||
initial_ast: 3b169c5b325765b378d7ea1a131c22d6581a5678c7612dd89d5b65dc9ea741c5
|
initial_ast: 53036a75738a88cc07bb04b89ae2fb6e47d1708cfd5bbaa4e1db76c199a56666
|
||||||
symbol_table: 1d675fa8a7bd7ce83ba28eb5421a5455d633b4a79ab0332df2c6e2f51ed8da4e
|
symbol_table: 560afbb790df70bfc770d5c2f966428a37baf94a5c0f5312ad445456d33a2cd9
|
||||||
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 5411bd17943bb0aa7b0bb27e8b38f57fd27f06f2080b13a32eee50c53de66f6c
|
- initial_input_ast: 5411bd17943bb0aa7b0bb27e8b38f57fd27f06f2080b13a32eee50c53de66f6c
|
||||||
initial_ast: 6ac72cc3fb0f49ffb8b5e19ad7199fbefc43b4fda14bc81e72b9a8158da4c488
|
initial_ast: ac6dc96d7e614d76dbfa8bf6e20ee3a61c843f556d1de6931bc58420cb8dd4e7
|
||||||
symbol_table: f4cde37b60d4f9dd3f9c6d68adcd775a4a658aa0230638ae719c530e73a50aa1
|
symbol_table: 720c2aafae77c261ed1640d4080f9a73657638baa30e54a5e10e2323b6f6eca0
|
||||||
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: 18e8a4118829470d3150268bbf8d298954e1f566ea2d42ed9f3660dc25c23fcc
|
- initial_input_ast: 18e8a4118829470d3150268bbf8d298954e1f566ea2d42ed9f3660dc25c23fcc
|
||||||
initial_ast: d2b0bcc028f1faca5015149527326b012acae44c7f4eccedd2bb4e6ddd60d458
|
initial_ast: a48e48fd664a54e925727534bb291ef8984144452a39989bdeeaabedaebe1b95
|
||||||
symbol_table: b95e9b9a3c056c2b908593687e5e196733d23ff345a18ec0c71db9be3f79fed6
|
symbol_table: e5159343ab03573032873783b28058a482dd401d534a0d3af03790a5286ba470
|
||||||
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: caa45de3b412d749048b9be732a4593f3094c671701093103f580817a741acbb
|
- initial_input_ast: caa45de3b412d749048b9be732a4593f3094c671701093103f580817a741acbb
|
||||||
initial_ast: 85fd5d2885d1f52b613acce71636df9549406c4b65e716cabf207a84123ebc7e
|
initial_ast: 27d216bcee7da7cc78788a88bfb7a9f546eb4e13387685aace9e849d5e327f09
|
||||||
symbol_table: 030ff41534ded0e7779554395f177c9a10bc1775954a48b97c410fbb0271eaf9
|
symbol_table: 757bb967973b87466c01be1a9dc78d30701964e0d234e0e65d1bbcbd3072370f
|
||||||
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: a610c3b16aefb8d1dcf55aa316fadd3da191a4045279d74de5667b795a079ba4
|
- initial_input_ast: a610c3b16aefb8d1dcf55aa316fadd3da191a4045279d74de5667b795a079ba4
|
||||||
initial_ast: b3b74914a19f82eb0c7dd69a9bfa2323f65c0c1de2dfc8788e166c46af7e1b3b
|
initial_ast: 601019380a091c4752e8b010cb5f0902b0c436b6f1b31ebb04d6250014138b9f
|
||||||
symbol_table: 24bb3b7964ed9b1a081d18e792ff976523146390accc79275998448ac3c9a510
|
symbol_table: 3b68eff86b45e4f940b0a1031e19a64178b0bf802acb59f3b743e664f3010876
|
||||||
|
@ -4,5 +4,5 @@ expectation: Pass
|
|||||||
outputs:
|
outputs:
|
||||||
- output:
|
- output:
|
||||||
- initial_input_ast: ab788992b0e08b3ba20bde1db2c473a4e006f06adefcddca936b148efff76b89
|
- initial_input_ast: ab788992b0e08b3ba20bde1db2c473a4e006f06adefcddca936b148efff76b89
|
||||||
initial_ast: 27eed50a20003ec963a52eb683c3795ee289b3cb71626aab64a9279a98261966
|
initial_ast: 64526d163b440348895219c405c6aeca8e41d671883ab07c9a202f4a1ffd51ec
|
||||||
symbol_table: e76eaaeb156f8c53fdb8f478f7ca9705c62075adc8b1bba7583da100bad2b6c6
|
symbol_table: 14140f05d5fb8a85352940a67860fd36ed597f93ac882fdb76ef3d1ed89b5031
|
||||||
|
Loading…
Reference in New Issue
Block a user