Fix more parser bugs
This commit is contained in:
parent
fc463d3807
commit
9c0f60b6ce
@ -470,7 +470,7 @@ peg::parser! {
|
|||||||
bin_literal() / hex_literal() / unmarked_literal()
|
bin_literal() / hex_literal() / unmarked_literal()
|
||||||
|
|
||||||
rule unmarked_literal() -> ExpressionKind =
|
rule unmarked_literal() -> ExpressionKind =
|
||||||
digits:digits() { ExpressionKind::NatLiteral(digits.parse().unwrap()) }
|
digits:digits() { let n = digits.chars().filter(|ch| *ch != '_').collect::<String>().parse().unwrap(); ExpressionKind::NatLiteral(n) }
|
||||||
|
|
||||||
rule bin_literal() -> ExpressionKind =
|
rule bin_literal() -> ExpressionKind =
|
||||||
"0b" digits:bin_digits() {? parse_binary(digits).map(ExpressionKind::NatLiteral) }
|
"0b" digits:bin_digits() {? parse_binary(digits).map(ExpressionKind::NatLiteral) }
|
||||||
|
@ -1383,7 +1383,6 @@ fn blocks() {
|
|||||||
|
|
||||||
assert_block!("{}", vec![].into());
|
assert_block!("{}", vec![].into());
|
||||||
|
|
||||||
//TODO this case is broken in the peg version
|
|
||||||
let source = r#"{
|
let source = r#"{
|
||||||
|
|
||||||
//hella
|
//hella
|
||||||
@ -1391,11 +1390,8 @@ fn blocks() {
|
|||||||
11; /*chutney*/0xf
|
11; /*chutney*/0xf
|
||||||
}"#;
|
}"#;
|
||||||
|
|
||||||
let mut parser = Parser::new();
|
assert_block!(
|
||||||
let block = parser.block_comb(source);
|
source,
|
||||||
|
|
||||||
assert_eq!(
|
|
||||||
block.unwrap(),
|
|
||||||
vec![
|
vec![
|
||||||
Statement {
|
Statement {
|
||||||
id: Default::default(),
|
id: Default::default(),
|
||||||
|
Loading…
Reference in New Issue
Block a user