Merge pull request #12 from neuschaefer/dev
Don't parse _123 as a decimal number
This commit is contained in:
commit
007caeb23f
|
@ -148,8 +148,8 @@ body_bin = @{ (ASCII_BIN_DIGIT | "_")+ }
|
|||
immediate_hex = ${ "0x" ~ body_hex }
|
||||
body_hex = @{ (ASCII_HEX_DIGIT | "_")+ }
|
||||
|
||||
immediate_dec = ${ body_dec }
|
||||
body_dec = @{ (ASCII_DIGIT | "_")+ }
|
||||
immediate_dec = ${ ASCII_DIGIT ~ body_dec }
|
||||
body_dec = @{ (ASCII_DIGIT | "_")* }
|
||||
|
||||
immediate_char = ${ "'" ~ body_char ~ "'" }
|
||||
body_char = @{ '\x00'..'\x7F' }
|
||||
|
|
|
@ -805,8 +805,8 @@ fn parse_operand(mut pair: pest::iterators::Pair<Rule>, is_pointer: bool) -> Ast
|
|||
immediate_to_astnode(immediate, size, is_pointer)
|
||||
}
|
||||
Rule::immediate_dec => {
|
||||
let body_dec_str = operand_value_pair.into_inner().next().unwrap().as_str();
|
||||
let immediate = remove_underscores(body_dec_str).parse::<u32>().unwrap();
|
||||
let dec_str = operand_value_pair.as_span().as_str();
|
||||
let immediate = remove_underscores(dec_str).parse::<u32>().unwrap();
|
||||
immediate_to_astnode(immediate, size, is_pointer)
|
||||
}
|
||||
Rule::immediate_char => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user