diff --git a/src/lenient_parse.gleam b/src/lenient_parse.gleam index 13f1621..7675264 100644 --- a/src/lenient_parse.gleam +++ b/src/lenient_parse.gleam @@ -28,5 +28,5 @@ pub fn to_int_with_base( text |> tokenizer.tokenize_int - |> parser.parse_int_tokens(base: base) + |> parser.parse_int_tokens(base:) } diff --git a/src/lenient_parse/internal/build.gleam b/src/lenient_parse/internal/build.gleam index 18409ef..eecb22e 100644 --- a/src/lenient_parse/internal/build.gleam +++ b/src/lenient_parse/internal/build.gleam @@ -37,8 +37,8 @@ pub fn float_value( let decimal = pilkku.new_bigint( - sign: sign, - coefficient: coefficient, + sign:, + coefficient:, exponent: bigi.from_int(-exponent), ) diff --git a/src/lenient_parse/internal/convert.gleam b/src/lenient_parse/internal/convert.gleam index d330e32..dba548c 100644 --- a/src/lenient_parse/internal/convert.gleam +++ b/src/lenient_parse/internal/convert.gleam @@ -3,7 +3,7 @@ import gleam/list import lenient_parse/internal/base_constants.{base_10} pub fn digits_to_int(digits digits: Deque(Int)) -> Int { - digits_to_int_with_base(digits: digits, base: base_10) + digits_to_int_with_base(digits:, base: base_10) } pub fn digits_to_int_with_base(digits digits: Deque(Int), base base: Int) -> Int { diff --git a/src/lenient_parse/internal/parser.gleam b/src/lenient_parse/internal/parser.gleam index 20f5ee1..61a406a 100644 --- a/src/lenient_parse/internal/parser.gleam +++ b/src/lenient_parse/internal/parser.gleam @@ -104,9 +104,9 @@ pub fn parse_float_tokens( Some(_), True -> Error(WhitespaceOnlyString) _, _ -> Ok(build.float_value( - is_positive: is_positive, - whole_digits: whole_digits, - fractional_digits: fractional_digits, + is_positive:, + whole_digits:, + fractional_digits:, scale_factor: exponent, )) } @@ -173,7 +173,7 @@ pub fn parse_int_tokens( Error(BasePrefixOnly(index_range, prefix)) Some(_), _, True -> Error(WhitespaceOnlyString) _, _, _ -> { - let value = digits |> digits_to_int_with_base(base: base) + let value = digits |> digits_to_int_with_base(base:) let value = case is_positive { True -> value False -> -value @@ -187,7 +187,7 @@ fn parse_whitespace( tokens tokens: List(Token), index index: Int, ) -> Result(ParseData(Option(String)), ParseError) { - do_parse_whitespace(tokens: tokens, index: index, acc: "") + do_parse_whitespace(tokens:, index:, acc: "") } fn do_parse_whitespace( @@ -210,7 +210,7 @@ fn do_parse_whitespace( _ -> Some(acc) } - Ok(ParseData(data: data, next_index: index, tokens: tokens)) + Ok(ParseData(data:, next_index: index, tokens:)) } } } @@ -224,7 +224,7 @@ fn parse_sign( [Sign(index, _, is_positive), ..rest] -> Ok(ParseData(data: is_positive, next_index: index + 1, tokens: rest)) _ -> { - Ok(ParseData(data: True, next_index: index, tokens: tokens)) + Ok(ParseData(data: True, next_index: index, tokens:)) } } } @@ -243,40 +243,22 @@ fn parse_base_prefix( Ok(Digit(_, specifier, _)) if { base == base_0 || base == base_2 } && { specifier == "b" || specifier == "B" } - -> - Ok(base_prefix_data( - tokens: rest, - index: index, - specifier: specifier, - base: base_2, - )) + -> Ok(base_prefix_data(tokens: rest, index:, specifier:, base: base_2)) Ok(Digit(_, specifier, _)) if { base == base_0 || base == base_8 } && { specifier == "o" || specifier == "O" } - -> - Ok(base_prefix_data( - tokens: rest, - index: index, - specifier: specifier, - base: base_8, - )) + -> Ok(base_prefix_data(tokens: rest, index:, specifier:, base: base_8)) Ok(Digit(_, specifier, _)) if { base == base_0 || base == base_16 } && { specifier == "x" || specifier == "X" } - -> - Ok(base_prefix_data( - tokens: rest, - index: index, - specifier: specifier, - base: base_16, - )) + -> Ok(base_prefix_data(tokens: rest, index:, specifier:, base: base_16)) Ok(Digit(index, character, _)) if base == base_0 -> { Error(UnknownCharacter(index, character)) } - _ -> Ok(ParseData(data: None, next_index: index, tokens: tokens)) + _ -> Ok(ParseData(data: None, next_index: index, tokens:)) } } - _ -> Ok(ParseData(data: None, next_index: index, tokens: tokens)) + _ -> Ok(ParseData(data: None, next_index: index, tokens:)) } } @@ -301,7 +283,7 @@ fn parse_decimal_point( [Unknown(index, character), ..] -> Error(UnknownCharacter(index, character)) [DecimalPoint(index), ..rest] -> Ok(ParseData(data: True, next_index: index + 1, tokens: rest)) - _ -> Ok(ParseData(data: False, next_index: index, tokens: tokens)) + _ -> Ok(ParseData(data: False, next_index: index, tokens:)) } } @@ -317,7 +299,7 @@ fn parse_exponent_symbol( next_index: index + 1, tokens: rest, )) - _ -> Ok(ParseData(data: None, next_index: index, tokens: tokens)) + _ -> Ok(ParseData(data: None, next_index: index, tokens:)) } } @@ -328,12 +310,12 @@ fn parse_digits( has_base_prefix has_base_prefix: Bool, ) -> Result(ParseData(Deque(Int)), ParseError) { do_parse_digits( - tokens: tokens, - index: index, - base: base, + tokens:, + index:, + base:, acc: deque.new(), at_beginning: True, - has_base_prefix: has_base_prefix, + has_base_prefix:, ) } @@ -373,10 +355,10 @@ fn do_parse_digits( do_parse_digits( tokens: rest, index: index + 1, - base: base, - acc: acc, + base:, + acc:, at_beginning: False, - has_base_prefix: has_base_prefix, + has_base_prefix:, ) } [Digit(index, character, _), ..] if base == base_0 -> { @@ -385,15 +367,15 @@ fn do_parse_digits( [Digit(index, _, value), ..rest] if value < base -> { do_parse_digits( tokens: rest, - index: index, - base: base, + index:, + base:, acc: acc |> deque.push_back(value), at_beginning: False, - has_base_prefix: has_base_prefix, + has_base_prefix:, ) } [Digit(index, character, value), ..] -> Error(OutOfBaseRange(index, character, value, base)) - _ -> Ok(ParseData(data: acc, next_index: index, tokens: tokens)) + _ -> Ok(ParseData(data: acc, next_index: index, tokens:)) } } diff --git a/src/lenient_parse/internal/pilkku/pilkku.gleam b/src/lenient_parse/internal/pilkku/pilkku.gleam index 4625911..4c7d4d2 100644 --- a/src/lenient_parse/internal/pilkku/pilkku.gleam +++ b/src/lenient_parse/internal/pilkku/pilkku.gleam @@ -87,12 +87,7 @@ pub fn new_bigint( _ -> bigi.from_int(1) } - Decimal( - sign: sign, - coefficient: coefficient, - exponent: exponent, - flags: set.new(), - ) + Decimal(sign:, coefficient:, exponent:, flags: set.new()) } /// Cast the decimal into a float. diff --git a/src/lenient_parse/internal/scale.gleam b/src/lenient_parse/internal/scale.gleam index 7c0489b..7f69f63 100644 --- a/src/lenient_parse/internal/scale.gleam +++ b/src/lenient_parse/internal/scale.gleam @@ -36,8 +36,8 @@ pub fn deques( pub fn float(factor: Float, exponent: Int) -> Float { do_float( - factor: factor, - exponent: exponent, + factor:, + exponent:, scale_factor: 1, exponent_is_positive: exponent >= 0, ) diff --git a/src/lenient_parse/internal/tokenizer.gleam b/src/lenient_parse/internal/tokenizer.gleam index ea37233..810fbf9 100644 --- a/src/lenient_parse/internal/tokenizer.gleam +++ b/src/lenient_parse/internal/tokenizer.gleam @@ -37,8 +37,8 @@ fn do_tokenize_float( _ -> common_token( character: first, - index: index, - whitespace_character_dict: whitespace_character_dict, + index:, + whitespace_character_dict:, tokenize_character_as_digit: fn(digit_value) { digit_value < base_10 }, @@ -47,7 +47,7 @@ fn do_tokenize_float( do_tokenize_float( characters: rest, index: index + 1, - whitespace_character_dict: whitespace_character_dict, + whitespace_character_dict:, acc: [token, ..acc], ) } @@ -79,15 +79,15 @@ fn do_tokenize_int( let token = common_token( character: first, - index: index, + index:, tokenize_character_as_digit: fn(_) { True }, - whitespace_character_dict: whitespace_character_dict, + whitespace_character_dict:, ) do_tokenize_int( characters: rest, index: index + 1, - whitespace_character_dict: whitespace_character_dict, + whitespace_character_dict:, acc: [token, ..acc], ) } diff --git a/test/data/float/invalid_float_data.gleam b/test/data/float/invalid_float_data.gleam index add9793..7de568d 100644 --- a/test/data/float/invalid_float_data.gleam +++ b/test/data/float/invalid_float_data.gleam @@ -24,8 +24,8 @@ fn float_test_data( let printable_text = input |> helpers.to_printable_text FloatTestData( - input: input, - expected_program_output: expected_program_output, + input:, + expected_program_output:, expected_python_output: Error(python_error_function(printable_text)), ) } diff --git a/test/data/integer/invalid_integer_data.gleam b/test/data/integer/invalid_integer_data.gleam index 2ca2d8f..71b95e5 100644 --- a/test/data/integer/invalid_integer_data.gleam +++ b/test/data/integer/invalid_integer_data.gleam @@ -39,9 +39,9 @@ fn integer_test_data( let printable_text = input |> helpers.to_printable_text IntegerTestData( - input: input, - base: base, - expected_program_output: expected_program_output, + input:, + base:, + expected_program_output:, expected_python_output: Error(python_error_function(printable_text, base)), ) } diff --git a/test/helpers.gleam b/test/helpers.gleam index 28df2a8..486e5ca 100644 --- a/test/helpers.gleam +++ b/test/helpers.gleam @@ -35,7 +35,7 @@ fn do_to_printable_text( do_to_printable_text( characters: rest, - whitespace_character_dict: whitespace_character_dict, + whitespace_character_dict:, acc: acc <> printable, ) } diff --git a/test/to_int_parse_test.gleam b/test/to_int_parse_test.gleam index c8da7f7..e234aba 100644 --- a/test/to_int_parse_test.gleam +++ b/test/to_int_parse_test.gleam @@ -43,7 +43,7 @@ pub fn to_int_tests() { use <- it(message) input - |> lenient_parse.to_int_with_base(base: base) + |> lenient_parse.to_int_with_base(base:) |> expect.to_equal(expected_program_output) }), )