Fix parsing of single hex-digits.

This commit is contained in:
KtorZ 2024-05-30 17:19:48 +02:00
parent 5694d9f9cb
commit 649e5163fc
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
4 changed files with 29 additions and 1 deletions

View File

@ -6,6 +6,11 @@
- **aiken-lang**: the keyword `fail` on property-based test semantic has changed and now consider a test to succeed only if **every** execution of the test failed (instead of just one). The previous behavior can be recovered by adding the keyword `once` after `fail`. @KtorZ - **aiken-lang**: the keyword `fail` on property-based test semantic has changed and now consider a test to succeed only if **every** execution of the test failed (instead of just one). The previous behavior can be recovered by adding the keyword `once` after `fail`. @KtorZ
### Fixed
- **aiken-lang**: fixed the number of 'after x tests' number reported on property test failure, which was off by one. @KtorZ
- **aiken-lang**: fixed parsing of single hex digits. @KtorZ
## v1.0.28-alpha - 2024-05-23 ## v1.0.28-alpha - 2024-05-23
### Added ### Added

View File

@ -112,7 +112,7 @@ pub fn lexer() -> impl Parser<char, Vec<(Token, Span)>, Error = ParseError> {
.ignore_then( .ignore_then(
one_of("0123456789abcdefABCDEF") one_of("0123456789abcdefABCDEF")
.repeated() .repeated()
.at_least(2) .at_least(1)
.collect::<String>(), .collect::<String>(),
) )
.validate(|value: String, span, emit| { .validate(|value: String, span, emit| {

View File

@ -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] #[test]
fn format_simple_module() { fn format_simple_module() {
assert_format!( assert_format!(

View File

@ -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