Fix parsing of single hex-digits.
This commit is contained in:
@@ -112,7 +112,7 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> {
|
||||
.ignore_then(
|
||||
one_of("0123456789abcdefABCDEF")
|
||||
.repeated()
|
||||
.at_least(2)
|
||||
.at_least(1)
|
||||
.collect::<String>(),
|
||||
)
|
||||
.validate(|value: String, span, emit| {
|
||||
|
||||
@@ -11,6 +11,18 @@ fn format_comment_at_end_of_file() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_single_hex_digit() {
|
||||
assert_format!(
|
||||
r#"
|
||||
const a = 0xa
|
||||
const b = 0x0f
|
||||
const c = 0x0000000f
|
||||
const d = 0x123
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn format_simple_module() {
|
||||
assert_format!(
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
source: crates/aiken-lang/src/tests/format.rs
|
||||
description: "Code:\n\nconst a = 0xa\nconst b = 0x0f\nconst c = 0x0000000f\nconst d = 0x123\n"
|
||||
---
|
||||
const a = 0xa
|
||||
|
||||
const b = 0xf
|
||||
|
||||
const c = 0xf
|
||||
|
||||
const d = 0x123
|
||||
Reference in New Issue
Block a user