├── .github └── workflows │ └── test.yml ├── .gitignore ├── CHANGELOG.md ├── LICENCE ├── README.md ├── birdie_snapshots ├── add_mult.accepted ├── add_mult_block.accepted ├── addint.accepted ├── addint2.accepted ├── alias_fn.accepted ├── alias_hole.accepted ├── alias_named.accepted ├── alias_qualified_named.accepted ├── alias_tuple.accepted ├── alias_variable.accepted ├── aliased_import.accepted ├── and.accepted ├── and2.accepted ├── assert.accepted ├── assert_location.accepted ├── assert_message_location.accepted ├── assert_precedence_with_todo.accepted ├── assert_with_compound_message.accepted ├── assert_with_message.accepted ├── assignment.accepted ├── assignment_pattern.accepted ├── assignment_pattern_location.accepted ├── attributes.accepted ├── attributes_no_paren.accepted ├── binary_operator_location.accepted ├── bit_array_location.accepted ├── bit_array_pattern_location.accepted ├── bit_string_empty.accepted ├── bit_string_numbers.accepted ├── bit_string_others.accepted ├── bit_string_pattern.accepted ├── bit_string_sizes.accepted ├── bit_string_units.accepted ├── bit_string_value_sizes.accepted ├── block_location.accepted ├── box.accepted ├── call.accepted ├── call_field.accepted ├── call_labelled.accepted ├── call_location.accepted ├── call_recursive.accepted ├── call_shorthand.accepted ├── case.accepted ├── case_alternatives.accepted ├── case_clauses.accepted ├── case_location.accepted ├── case_multi.accepted ├── comment_discarding.accepted ├── comments.accepted ├── concatenate_discard_pattern.accepted ├── concatenate_pattern.accepted ├── concatenate_pattern_assignment_location.accepted ├── concatenate_pattern_discard_location.accepted ├── concatenate_pattern_location.accepted ├── concatenate_pattern_with_prefix_assignment.accepted ├── const_record_shorthand.accepted ├── constant_annotated_int.accepted ├── constant_bit_string.accepted ├── constant_constructor.accepted ├── constant_empty_list.accepted ├── constant_empty_tuple.accepted ├── constant_enum_constructor.accepted ├── constant_float.accepted ├── constant_int.accepted ├── constant_labelled_constructor.accepted ├── constant_list.accepted ├── constant_list_trailing_comma.accepted ├── constant_location.accepted ├── constant_pub_int.accepted ├── constant_qualified_enum_constructor.accepted ├── constant_string.accepted ├── constant_tuple.accepted ├── constant_tuple_trailing_comma.accepted ├── constant_variable.accepted ├── constructor_pattern.accepted ├── constructor_pattern_args.accepted ├── constructor_pattern_labels.accepted ├── constructor_pattern_location.accepted ├── constructor_pattern_qualified.accepted ├── constructor_pattern_spread.accepted ├── constuctorless_type.accepted ├── crash.accepted ├── custom_type_location.accepted ├── deprecated_constructor.accepted ├── discard_list_rest.accepted ├── discard_pattern.accepted ├── discard_pattern_location.accepted ├── echo.accepted ├── echo_location.accepted ├── echo_pipeline.accepted ├── empty_block.accepted ├── empty_fields_list.accepted ├── empty_list_rest_pattern.accepted ├── empty_parameter_list.accepted ├── empty_unqualified.accepted ├── expression_block.accepted ├── expression_empty_list_prefix.accepted ├── expression_float.accepted ├── expression_fn.accepted ├── expression_fn_annotated_parens.accepted ├── expression_fn_discard.accepted ├── expression_fn_return.accepted ├── expression_int.accepted ├── expression_list.accepted ├── expression_list_prefix.accepted ├── expression_list_trailing_comma.accepted ├── expression_negate_bool.accepted ├── expression_negate_int.accepted ├── expression_panic.accepted ├── expression_panic_message.accepted ├── expression_string.accepted ├── expression_todo.accepted ├── expression_todo_message.accepted ├── expression_tuple.accepted ├── expression_tuple_trailing_comma.accepted ├── expression_variable.accepted ├── external_attribute.accepted ├── external_function_location.accepted ├── external_function_with_return_location.accepted ├── external_type_location.accepted ├── external_type_with_parameters_location.accepted ├── field_access.accepted ├── field_access_location.accepted ├── field_access_recursive.accepted ├── field_access_upper.accepted ├── fields_trailing_comma.accepted ├── float_location.accepted ├── float_pattern.accepted ├── float_pattern_location.accepted ├── fn_location.accepted ├── function_capture_after.accepted ├── function_capture_after_trailing_comma.accepted ├── function_capture_before.accepted ├── function_capture_both.accepted ├── function_capture_immediate_call.accepted ├── function_capture_location.accepted ├── function_capture_pointless.accepted ├── function_capture_shorthand.accepted ├── function_location.accepted ├── function_main.accepted ├── function_parameters.accepted ├── function_return_annotation.accepted ├── guard.accepted ├── import.accepted ├── import_alias_discard_location.accepted ├── import_alias_location.accepted ├── import_location.accepted ├── import_nested_location.accepted ├── import_unqualified_location.accepted ├── import_with_underscore_alias.accepted ├── int_location.accepted ├── int_pattern.accepted ├── int_pattern_location.accepted ├── label_capture.accepted ├── labelled_fields.accepted ├── let_annotation.accepted ├── let_assert.accepted ├── let_assert_location.accepted ├── let_assert_message_location.accepted ├── let_assert_todo_precedence.accepted ├── let_assert_with_compound_message.accepted ├── let_assert_with_message.accepted ├── let_location.accepted ├── list_location.accepted ├── list_pattern.accepted ├── list_pattern_location.accepted ├── list_pattern_spread_location.accepted ├── list_rest_pattern.accepted ├── list_spread_location.accepted ├── mult_add.accepted ├── multiple_field_call.accepted ├── multiple_field_record_update.accepted ├── multiple_fields.accepted ├── negate_int_location.accepted ├── negative_float_bug.accepted ├── negative_float_location.accepted ├── negative_int_bug.accepted ├── nested_import.accepted ├── nil.accepted ├── no_shorthand_in_constructors.accepted ├── opaque.accepted ├── or.accepted ├── panic_as.accepted ├── panic_as_block.accepted ├── panic_location.accepted ├── panic_message_location.accepted ├── pattern_shorthand.accepted ├── phantom.accepted ├── phantom_multiple.accepted ├── phantom_trailing_comma.accepted ├── pipe.accepted ├── private_enum.accepted ├── private_function_main.accepted ├── public_constant_location.accepted ├── public_enum.accepted ├── public_external_type_location.accepted ├── public_function_location.accepted ├── public_type_alias_location.accepted ├── record_partial_destructure_trailing_comma.accepted ├── record_shorthand.accepted ├── record_update.accepted ├── record_update_empty.accepted ├── record_update_empty_trailing_comma.accepted ├── record_update_location.accepted ├── record_update_qualified.accepted ├── record_update_shorthand.accepted ├── record_update_trailing_comma.accepted ├── string_location.accepted ├── string_pattern.accepted ├── string_pattern_location.accepted ├── todo_as.accepted ├── todo_as_block.accepted ├── todo_location.accepted ├── todo_message_location.accepted ├── trailing_comma_in_parameters.accepted ├── tuple_index.accepted ├── tuple_index_location.accepted ├── tuple_location.accepted ├── tuple_pattern.accepted ├── tuple_pattern_location.accepted ├── tuple_pattern_trailing_comma.accepted ├── type_alias_location.accepted ├── unqualified.accepted ├── unqualified_aliased.accepted ├── unqualified_type.accepted ├── use.accepted ├── use_location.accepted ├── use_multiple.accepted ├── use_none.accepted ├── use_with_annotations.accepted ├── variable_location.accepted ├── variable_pattern_location.accepted └── variant_pattern_location.accepted ├── gleam.toml ├── manifest.toml ├── src └── glance.gleam └── test ├── birdie.gleam ├── birdie └── internal │ ├── diff.gleam │ ├── project.gleam │ └── titles.gleam └── glance_test.gleam /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: erlef/setup-beam@v1 15 | with: 16 | otp-version: "27" 17 | gleam-version: "1.10.0" 18 | rebar3-version: "3" 19 | - run: gleam test 20 | - run: gleam format --check src test 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.beam 2 | *.ez 3 | build 4 | erl_crash.dump 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## v5.0.0 - 2025-05-24 4 | 5 | - All expressions have a location span as their first field. 6 | - All patterns have a location span as their first field. 7 | - The `Constant` definition now has a location span as its first field. 8 | - Fixed a bug where some location spans would be wrong. 9 | 10 | ## v4.0.0 - 2025-05-21 11 | 12 | - All definitions have a location span as their first field. 13 | - All types have a location span as their first field. 14 | - The `Assert` variant has been renamed to `LetAssert`. 15 | - The `let assert ... as message` syntax is now supported. 16 | - Attributes on individual variant constructors is now supported. 17 | - The `echo` expression is now supported. 18 | - The `assert` expression is now supported. 19 | - The `elems` labels have been changed to `elements`. 20 | - The `PatternConstructor` variant has been renamed to `PatternVariant` 21 | - Type annotations in `use` expressions are now supported. 22 | - The `patterns` field of the `Use` variant is now a `List(UsePattern)`, which 23 | also contains an optional type annotation. 24 | 25 | ## v3.0.0 - 2025-02-21 26 | 27 | - The `"prefix" as prefix name <> rest ->` pattern syntax is now supported. 28 | 29 | ## v2.0.1 - 2025-02-12 30 | 31 | - Fixed attributes with no parens failing to parse. 32 | 33 | ## v2.0.0 - 2024-12-09 34 | 35 | - Added support for label shorthand syntax. 36 | - `Field` now has two variants; `LabelledField` and `ShorthandField`. 37 | - `Variant` now uses a new `VariantField` type instead of `Field(Type)`. 38 | - `RecordUpdate` variant of `Expression` now uses a new `RecordUpdateField` 39 | type instead of `#(String, Expression)`. 40 | 41 | ## v1.1.0 - 2024-12-04 42 | 43 | - Updated to glexer v2.0.0 44 | 45 | ## v1.0.0 - 2024-09-30 46 | 47 | - Added support for `bits` and `bytes` bit string options. 48 | - `BinaryOption` has been renamed `BytesOption`. 49 | - `BitStringOption` has been renamed `BitsOption`. 50 | 51 | ## v0.11.0 - 2024-04-25 52 | 53 | - The `Panic` and `Todo` AST nodes have been updated to take expressions as the 54 | error message, to match current Gleam. 55 | - Support for the old `panic("reason")` and `todo("reason")` syntax has been 56 | removed. These now parse as function calls. 57 | - Added support for type holes. 58 | - Fixed a bug where negative floats would parse as `NegateInt` of a float. 59 | 60 | ## v0.10.0 - 2024-04-20 61 | 62 | - Added support for module alias discarded name. This is a breaking change as 63 | the import data structure has been changed to hold this information. 64 | 65 | ## v0.9.0 - 2024-04-10 66 | 67 | - Remove `external fn` and `external type` syntax. Unsupported in Gleam since 0.31.0. 68 | - Add support for list with spread operator and no fixed elements, i.e. `[..]` 69 | - Fixed a typo so `FunctionType.paramters` is now called `FunctionType.parameters`. 70 | 71 | ## v0.8.2 - 2024-01-20 72 | 73 | - Fixed a bug where record constructor patterns with a `..` and a trailing comma 74 | would fail to parse. 75 | 76 | ## v0.8.1 - 2023-12-05 77 | 78 | - Fixed a bug where the parser could crash on some incomplete inputs. 79 | 80 | ## v0.8.0 - 2023-11-02 81 | 82 | - Updated for Gleam v0.32.0. 83 | 84 | ## v0.7.1 - 2023-09-27 85 | 86 | - Fixed a bug where use expressions with a zero arity callback would fail to 87 | parse. 88 | 89 | ## v0.7.0 - 2023-09-15 90 | 91 | - Added support for the `pub type TypeName` syntax. 92 | - Added support for the `@external(target, "module", "function")` syntax. 93 | 94 | ## v0.6.2 - 2023-09-07 95 | 96 | - Fixed a bug where assignment type annotations would fail to parse. 97 | 98 | ## v0.6.1 - 2023-07-05 99 | 100 | - Added support for parsing function captures that use a label with the `_` 101 | argument. 102 | 103 | ## v0.6.0 - 2023-06-29 104 | 105 | - Added support for the `todo as "..."` and `panic as "..."` syntaxes. 106 | 107 | ## v0.5.2 - 2023-06-24 108 | 109 | - Fixed a bug where `||` would fail to parse. 110 | 111 | ## v0.5.1 - 2023-06-21 112 | 113 | - The `Definition` type gains the `definition` label. 114 | 115 | ## v0.5.0 - 2023-06-21 116 | 117 | - Functions now include their location in the source code. 118 | 119 | ## v0.4.1 - 2023-06-20 120 | 121 | - Fixed a bug where list patterns with a discarded remainder would fail to 122 | parse. 123 | 124 | ## v0.4.0 - 2023-06-20 125 | 126 | - All Gleam code can now be parsed. 127 | 128 | ## 0.3.0 - 2023-05-23 129 | 130 | - External types can now be parsed. 131 | - External functions can now be parsed. 132 | 133 | ## 0.2.0 - 2023-05-19 134 | 135 | - Constant defintions can now be parsed. Bit string segments are currently 136 | discarded. 137 | 138 | ## 0.1.0 - 2023-05-12 139 | 140 | - Initial release, with support for parsing custom types, imports, and type 141 | aliases. 142 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # glance 2 | 3 | [![Package Version](https://img.shields.io/hexpm/v/glance)](https://hex.pm/packages/glance) 4 | [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/glance/) 5 | 6 | A Gleam source code parser, in Gleam! 7 | 8 | Glance attempts to be permissive with regards to what it will parse and so it is 9 | able to parse some code that the Gleam compiler will reject as invalid. 10 | 11 | ## Usage 12 | 13 | Add the package to your Gleam project: 14 | 15 | ```sh 16 | gleam add glance 17 | ``` 18 | 19 | Then get parsing! 20 | 21 | ```gleam 22 | import glance 23 | import gleam/io 24 | 25 | const code = " 26 | pub type Cardinal { 27 | North 28 | East 29 | South 30 | West 31 | } 32 | " 33 | 34 | pub fn main() { 35 | let assert Ok(parsed) = glance.module(code) 36 | io.debug(parsed.custom_types) 37 | } 38 | ``` 39 | 40 | This program print this to the console: 41 | 42 | ```gleam 43 | [ 44 | Definition( 45 | [], 46 | CustomType( 47 | name: "Cardinal", 48 | publicity: Public, 49 | parameters: [], 50 | variants: [ 51 | Variant("North", []), 52 | Variant("East", []), 53 | Variant("South", []), 54 | Variant("West", []), 55 | ], 56 | ), 57 | ), 58 | ] 59 | ``` 60 | 61 | API documentation can be found at . 62 | -------------------------------------------------------------------------------- /birdie_snapshots/add_mult.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: add_mult 4 | file: ./test/glance_test.gleam 5 | test_name: add_mult_test 6 | --- 7 | pub fn main() { x + y * z } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 25), 28 | AddInt, 29 | Variable(Span(16, 17), "x"), 30 | BinaryOperator( 31 | Span(20, 25), 32 | MultInt, 33 | Variable( 34 | Span(20, 21), 35 | "y", 36 | ), 37 | Variable( 38 | Span(24, 25), 39 | "z", 40 | ), 41 | ), 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/add_mult_block.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: add_mult_block 4 | file: ./test/glance_test.gleam 5 | test_name: add_mult_block_test 6 | --- 7 | pub fn main() { { x + y } * z } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 31), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 29), 28 | MultInt, 29 | Block( 30 | Span(16, 25), 31 | [ 32 | Expression(BinaryOperator( 33 | Span(18, 23), 34 | AddInt, 35 | Variable( 36 | Span(18, 19), 37 | "x", 38 | ), 39 | Variable( 40 | Span(22, 23), 41 | "y", 42 | ), 43 | )), 44 | ], 45 | ), 46 | Variable(Span(28, 29), "z"), 47 | )), 48 | ], 49 | ), 50 | ), 51 | ], 52 | ) -------------------------------------------------------------------------------- /birdie_snapshots/addint.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: addint 4 | file: ./test/glance_test.gleam 5 | test_name: addint_test 6 | --- 7 | pub fn main() { x + y } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 23), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 21), 28 | AddInt, 29 | Variable(Span(16, 17), "x"), 30 | Variable(Span(20, 21), "y"), 31 | )), 32 | ], 33 | ), 34 | ), 35 | ], 36 | ) -------------------------------------------------------------------------------- /birdie_snapshots/addint2.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: addint2 4 | file: ./test/glance_test.gleam 5 | test_name: addint2_test 6 | --- 7 | pub fn main() { x + y + z } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 25), 28 | AddInt, 29 | BinaryOperator( 30 | Span(16, 21), 31 | AddInt, 32 | Variable( 33 | Span(16, 17), 34 | "x", 35 | ), 36 | Variable( 37 | Span(20, 21), 38 | "y", 39 | ), 40 | ), 41 | Variable(Span(24, 25), "z"), 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/alias_fn.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: alias_fn 4 | file: ./test/glance_test.gleam 5 | test_name: alias_fn_test 6 | --- 7 | pub type X = fn(A, B) -> C 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [ 15 | Definition( 16 | [], 17 | TypeAlias( 18 | Span(0, 26), 19 | "X", 20 | Public, 21 | [], 22 | FunctionType( 23 | Span(13, 26), 24 | [ 25 | NamedType( 26 | Span(16, 17), 27 | "A", 28 | None, 29 | [], 30 | ), 31 | NamedType( 32 | Span(19, 20), 33 | "B", 34 | None, 35 | [], 36 | ), 37 | ], 38 | NamedType( 39 | Span(25, 26), 40 | "C", 41 | None, 42 | [], 43 | ), 44 | ), 45 | ), 46 | ), 47 | ], 48 | [], 49 | [], 50 | ) -------------------------------------------------------------------------------- /birdie_snapshots/alias_hole.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: alias_hole 4 | file: ./test/glance_test.gleam 5 | test_name: alias_hole_test 6 | --- 7 | pub type X = _whatever 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [ 15 | Definition( 16 | [], 17 | TypeAlias( 18 | Span(0, 22), 19 | "X", 20 | Public, 21 | [], 22 | HoleType( 23 | Span(13, 22), 24 | "whatever", 25 | ), 26 | ), 27 | ), 28 | ], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/alias_named.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: alias_named 4 | file: ./test/glance_test.gleam 5 | test_name: alias_named_test 6 | --- 7 | pub type X = Y 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [ 15 | Definition( 16 | [], 17 | TypeAlias( 18 | Span(0, 14), 19 | "X", 20 | Public, 21 | [], 22 | NamedType( 23 | Span(13, 14), 24 | "Y", 25 | None, 26 | [], 27 | ), 28 | ), 29 | ), 30 | ], 31 | [], 32 | [], 33 | ) -------------------------------------------------------------------------------- /birdie_snapshots/alias_qualified_named.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: alias_qualified_named 4 | file: ./test/glance_test.gleam 5 | test_name: alias_qualified_named_test 6 | --- 7 | pub type X = wibble.Y 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [ 15 | Definition( 16 | [], 17 | TypeAlias( 18 | Span(0, 21), 19 | "X", 20 | Public, 21 | [], 22 | NamedType( 23 | Span(13, 21), 24 | "Y", 25 | Some("wibble"), 26 | [], 27 | ), 28 | ), 29 | ), 30 | ], 31 | [], 32 | [], 33 | ) -------------------------------------------------------------------------------- /birdie_snapshots/alias_tuple.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: alias_tuple 4 | file: ./test/glance_test.gleam 5 | test_name: alias_tuple_test 6 | --- 7 | pub type X = #(A, B) 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [ 15 | Definition( 16 | [], 17 | TypeAlias( 18 | Span(0, 20), 19 | "X", 20 | Public, 21 | [], 22 | TupleType( 23 | Span(13, 20), 24 | [ 25 | NamedType( 26 | Span(15, 16), 27 | "A", 28 | None, 29 | [], 30 | ), 31 | NamedType( 32 | Span(18, 19), 33 | "B", 34 | None, 35 | [], 36 | ), 37 | ], 38 | ), 39 | ), 40 | ), 41 | ], 42 | [], 43 | [], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/alias_variable.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: alias_variable 4 | file: ./test/glance_test.gleam 5 | test_name: alias_variable_test 6 | --- 7 | pub type X = a 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [ 15 | Definition( 16 | [], 17 | TypeAlias( 18 | Span(0, 14), 19 | "X", 20 | Public, 21 | [], 22 | VariableType(Span(13, 14), "a"), 23 | ), 24 | ), 25 | ], 26 | [], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/aliased_import.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: aliased_import 4 | file: ./test/glance_test.gleam 5 | test_name: aliased_import_test 6 | --- 7 | import one/two/three as four 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 28), 17 | "one/two/three", 18 | Some(Named("four")), 19 | [], 20 | [], 21 | ), 22 | ), 23 | ], 24 | [], 25 | [], 26 | [], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/and.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: and 4 | file: ./test/glance_test.gleam 5 | test_name: and_test 6 | --- 7 | pub fn main() { x && y } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 24), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 22), 28 | And, 29 | Variable(Span(16, 17), "x"), 30 | Variable(Span(21, 22), "y"), 31 | )), 32 | ], 33 | ), 34 | ), 35 | ], 36 | ) -------------------------------------------------------------------------------- /birdie_snapshots/and2.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: and2 4 | file: ./test/glance_test.gleam 5 | test_name: and2_test 6 | --- 7 | pub fn main() { x && y && z } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 27), 28 | And, 29 | BinaryOperator( 30 | Span(16, 22), 31 | And, 32 | Variable( 33 | Span(16, 17), 34 | "x", 35 | ), 36 | Variable( 37 | Span(21, 22), 38 | "y", 39 | ), 40 | ), 41 | Variable(Span(26, 27), "z"), 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assert.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assert 4 | file: ./test/glance_test.gleam 5 | test_name: assert_test 6 | --- 7 | 8 | pub fn main() { 9 | assert is_even(10) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 39), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Assert( 31 | Span(19, 37), 32 | Call( 33 | Span(26, 37), 34 | Variable( 35 | Span(26, 33), 36 | "is_even", 37 | ), 38 | [ 39 | UnlabelledField(Int( 40 | Span(34, 36), 41 | "10", 42 | )), 43 | ], 44 | ), 45 | None, 46 | ), 47 | ], 48 | ), 49 | ), 50 | ], 51 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assert_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assert_location 4 | file: ./test/glance_test.gleam 5 | test_name: assert_location_test 6 | --- 7 | 8 | pub fn main() { 9 | assert a == b 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/assert_message_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assert_message_location 4 | file: ./test/glance_test.gleam 5 | test_name: assert_message_location_test 6 | --- 7 | 8 | pub fn main() { 9 | assert a == b as "Values are not equal" 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/assert_precedence_with_todo.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assert_precedence_with_todo 4 | file: ./test/glance_test.gleam 5 | test_name: assert_precedence_with_todo_test 6 | --- 7 | 8 | pub fn main() { 9 | assert todo as "todo message" 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 50), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Assert( 31 | Span(19, 48), 32 | Todo( 33 | Span(26, 48), 34 | Some(String( 35 | Span(34, 48), 36 | "todo message", 37 | )), 38 | ), 39 | None, 40 | ), 41 | ], 42 | ), 43 | ), 44 | ], 45 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assert_with_compound_message.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assert_with_compound_message 4 | file: ./test/glance_test.gleam 5 | test_name: assert_with_compound_message_test 6 | --- 7 | 8 | pub fn main() { 9 | assert lock(directory) as { some_message <> "!" } 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 70), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Assert( 31 | Span(19, 68), 32 | Call( 33 | Span(26, 41), 34 | Variable( 35 | Span(26, 30), 36 | "lock", 37 | ), 38 | [ 39 | UnlabelledField(Variable( 40 | Span(31, 40), 41 | "directory", 42 | )), 43 | ], 44 | ), 45 | Some(Block( 46 | Span(45, 68), 47 | [ 48 | Expression(BinaryOperator( 49 | Span(47, 66), 50 | Concatenate, 51 | Variable( 52 | Span(47, 59), 53 | "some_message", 54 | ), 55 | String( 56 | Span(63, 66), 57 | "!", 58 | ), 59 | )), 60 | ], 61 | )), 62 | ), 63 | ], 64 | ), 65 | ), 66 | ], 67 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assert_with_message.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assert_with_message 4 | file: ./test/glance_test.gleam 5 | test_name: assert_with_message_test 6 | --- 7 | 8 | pub fn main() { 9 | assert lock(directory) as "Failed to lock directory" 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 73), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Assert( 31 | Span(19, 71), 32 | Call( 33 | Span(26, 41), 34 | Variable( 35 | Span(26, 30), 36 | "lock", 37 | ), 38 | [ 39 | UnlabelledField(Variable( 40 | Span(31, 40), 41 | "directory", 42 | )), 43 | ], 44 | ), 45 | Some(String( 46 | Span(45, 71), 47 | "Failed to lock directory", 48 | )), 49 | ), 50 | ], 51 | ), 52 | ), 53 | ], 54 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assignment.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assignment 4 | file: ./test/glance_test.gleam 5 | test_name: assignment_test 6 | --- 7 | pub fn main() { let x = 1 2 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 25), 28 | Let, 29 | PatternVariable( 30 | Span(20, 21), 31 | "x", 32 | ), 33 | None, 34 | Int(Span(24, 25), "1"), 35 | ), 36 | Expression(Int( 37 | Span(26, 27), 38 | "2", 39 | )), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assignment_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assignment_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: assignment_pattern_test 6 | --- 7 | pub fn main() { let x as y = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 32), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 30), 28 | Let, 29 | PatternAssignment( 30 | Span(20, 26), 31 | PatternVariable( 32 | Span(20, 21), 33 | "x", 34 | ), 35 | "y", 36 | ), 37 | None, 38 | Int(Span(29, 30), "1"), 39 | ), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/assignment_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: assignment_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: assignment_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let 1 as x = todo 10 | ▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/attributes.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: attributes 4 | file: ./test/glance_test.gleam 5 | test_name: attributes_test 6 | --- 7 | 8 | @thingbobby(erlang, "one", "two") 9 | @thingbobby(javascript, "three", "four") 10 | pub fn main() { Nil } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [ 23 | Attribute( 24 | "thingbobby", 25 | [ 26 | Variable( 27 | Span(13, 19), 28 | "erlang", 29 | ), 30 | String(Span(21, 26), "one"), 31 | String(Span(28, 33), "two"), 32 | ], 33 | ), 34 | Attribute( 35 | "thingbobby", 36 | [ 37 | Variable( 38 | Span(47, 57), 39 | "javascript", 40 | ), 41 | String( 42 | Span(59, 66), 43 | "three", 44 | ), 45 | String(Span(68, 74), "four"), 46 | ], 47 | ), 48 | ], 49 | Function( 50 | Span(76, 97), 51 | "main", 52 | Public, 53 | [], 54 | None, 55 | [ 56 | Expression(Variable( 57 | Span(92, 95), 58 | "Nil", 59 | )), 60 | ], 61 | ), 62 | ), 63 | ], 64 | ) -------------------------------------------------------------------------------- /birdie_snapshots/attributes_no_paren.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: attributes_no_paren 4 | file: ./test/glance_test.gleam 5 | test_name: attributes_no_paren_test 6 | --- 7 | 8 | @thingbobby 9 | pub fn main() { Nil } 10 | 11 | 12 | --------------------------- 13 | 14 | Module( 15 | [], 16 | [], 17 | [], 18 | [], 19 | [ 20 | Definition( 21 | [Attribute("thingbobby", [])], 22 | Function( 23 | Span(13, 34), 24 | "main", 25 | Public, 26 | [], 27 | None, 28 | [ 29 | Expression(Variable( 30 | Span(29, 32), 31 | "Nil", 32 | )), 33 | ], 34 | ), 35 | ), 36 | ], 37 | ) -------------------------------------------------------------------------------- /birdie_snapshots/binary_operator_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: binary_operator_location 4 | file: ./test/glance_test.gleam 5 | test_name: binary_operator_location_test 6 | --- 7 | 8 | pub fn main() { 9 | 1 + 2 10 | ▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/bit_array_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_array_location 4 | file: ./test/glance_test.gleam 5 | test_name: bit_array_location_test 6 | --- 7 | 8 | pub fn main() { 9 | <<1, 2, 3, 4>> 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/bit_array_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_array_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: bit_array_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let <<1, 2, 3, rest:bits>> = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_empty.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_empty 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_empty_test 6 | --- 7 | pub fn main() { <<>> } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 22), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BitString( 27 | Span(16, 20), 28 | [], 29 | )), 30 | ], 31 | ), 32 | ), 33 | ], 34 | ) -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_numbers.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_numbers 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_numbers_test 6 | --- 7 | pub fn main() { <<1, 2, 3>> } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BitString( 27 | Span(16, 27), 28 | [ 29 | #( 30 | Int(Span(18, 19), "1"), 31 | [], 32 | ), 33 | #( 34 | Int(Span(21, 22), "2"), 35 | [], 36 | ), 37 | #( 38 | Int(Span(24, 25), "3"), 39 | [], 40 | ), 41 | ], 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_others.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_others 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_others_test 6 | --- 7 | pub fn main() { <<1, 2: 8 | bytes-binary-int-float-bits-bit_string-utf8-utf16-utf32-utf8_codepoint-utf16_codepoint-utf32_codepoint-signed-unsigned-big-little-native 9 | >> } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 165), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(BitString( 29 | Span(16, 163), 30 | [ 31 | #( 32 | Int(Span(18, 19), "1"), 33 | [], 34 | ), 35 | #( 36 | Int(Span(21, 22), "2"), 37 | [ 38 | BytesOption, 39 | BytesOption, 40 | IntOption, 41 | FloatOption, 42 | BitsOption, 43 | BitsOption, 44 | Utf8Option, 45 | Utf16Option, 46 | Utf32Option, 47 | Utf8CodepointOption, 48 | Utf16CodepointOption, 49 | Utf32CodepointOption, 50 | SignedOption, 51 | UnsignedOption, 52 | BigOption, 53 | LittleOption, 54 | NativeOption, 55 | ], 56 | ), 57 | ], 58 | )), 59 | ], 60 | ), 61 | ), 62 | ], 63 | ) -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_pattern_test 6 | --- 7 | pub fn main() { let <<1, 2:4>> = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 36), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 34), 28 | Let, 29 | PatternBitString( 30 | Span(20, 30), 31 | [ 32 | #( 33 | PatternInt( 34 | Span(22, 23), 35 | "1", 36 | ), 37 | [], 38 | ), 39 | #( 40 | PatternInt( 41 | Span(25, 26), 42 | "2", 43 | ), 44 | [SizeOption(4)], 45 | ), 46 | ], 47 | ), 48 | None, 49 | Int(Span(33, 34), "1"), 50 | ), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_sizes.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_sizes 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_sizes_test 6 | --- 7 | pub fn main() { <<1, 2:4, 5:8>> } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 33), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BitString( 27 | Span(16, 31), 28 | [ 29 | #( 30 | Int(Span(18, 19), "1"), 31 | [], 32 | ), 33 | #( 34 | Int(Span(21, 22), "2"), 35 | [SizeOption(4)], 36 | ), 37 | #( 38 | Int(Span(26, 27), "5"), 39 | [SizeOption(8)], 40 | ), 41 | ], 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_units.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_units 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_units_test 6 | --- 7 | pub fn main() { <<1, 2:unit(5), 5:unit(3)>> } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 45), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BitString( 27 | Span(16, 43), 28 | [ 29 | #( 30 | Int(Span(18, 19), "1"), 31 | [], 32 | ), 33 | #( 34 | Int(Span(21, 22), "2"), 35 | [UnitOption(5)], 36 | ), 37 | #( 38 | Int(Span(32, 33), "5"), 39 | [UnitOption(3)], 40 | ), 41 | ], 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/bit_string_value_sizes.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: bit_string_value_sizes 4 | file: ./test/glance_test.gleam 5 | test_name: bit_string_value_sizes_test 6 | --- 7 | pub fn main() { <<1, 2:size(5), 5:size(x)>> } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 45), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BitString( 27 | Span(16, 43), 28 | [ 29 | #( 30 | Int(Span(18, 19), "1"), 31 | [], 32 | ), 33 | #( 34 | Int(Span(21, 22), "2"), 35 | [ 36 | SizeValueOption(Int( 37 | Span(28, 29), 38 | "5", 39 | )), 40 | ], 41 | ), 42 | #( 43 | Int(Span(32, 33), "5"), 44 | [ 45 | SizeValueOption(Variable( 46 | Span(39, 40), 47 | "x", 48 | )), 49 | ], 50 | ), 51 | ], 52 | )), 53 | ], 54 | ), 55 | ), 56 | ], 57 | ) -------------------------------------------------------------------------------- /birdie_snapshots/block_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: block_location 4 | file: ./test/glance_test.gleam 5 | test_name: block_location_test 6 | --- 7 | 8 | pub fn main() { 9 | { 10 | ▔ 11 | something 12 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 13 | something_else 14 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 15 | } 16 | ▔▔▔ 17 | } 18 | -------------------------------------------------------------------------------- /birdie_snapshots/box.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: box 4 | file: ./test/glance_test.gleam 5 | test_name: box_test 6 | --- 7 | pub type Box(x) { 8 | Box(x) 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 32), 20 | "Box", 21 | Public, 22 | False, 23 | ["x"], 24 | [ 25 | Variant( 26 | "Box", 27 | [ 28 | UnlabelledVariantField(VariableType( 29 | Span(26, 27), 30 | "x", 31 | )), 32 | ], 33 | [], 34 | ), 35 | ], 36 | ), 37 | ), 38 | ], 39 | [], 40 | [], 41 | [], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/call.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: call 4 | file: ./test/glance_test.gleam 5 | test_name: call_test 6 | --- 7 | pub fn main() { wobble(1, 2, 3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 33), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 31), 28 | Variable( 29 | Span(16, 22), 30 | "wobble", 31 | ), 32 | [ 33 | UnlabelledField(Int( 34 | Span(23, 24), 35 | "1", 36 | )), 37 | UnlabelledField(Int( 38 | Span(26, 27), 39 | "2", 40 | )), 41 | UnlabelledField(Int( 42 | Span(29, 30), 43 | "3", 44 | )), 45 | ], 46 | )), 47 | ], 48 | ), 49 | ), 50 | ], 51 | ) -------------------------------------------------------------------------------- /birdie_snapshots/call_field.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: call_field 4 | file: ./test/glance_test.gleam 5 | test_name: call_field_test 6 | --- 7 | pub fn main() { wibble.wobble(1, 2, 3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 40), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 38), 28 | FieldAccess( 29 | Span(16, 29), 30 | Variable( 31 | Span(16, 22), 32 | "wibble", 33 | ), 34 | "wobble", 35 | ), 36 | [ 37 | UnlabelledField(Int( 38 | Span(30, 31), 39 | "1", 40 | )), 41 | UnlabelledField(Int( 42 | Span(33, 34), 43 | "2", 44 | )), 45 | UnlabelledField(Int( 46 | Span(36, 37), 47 | "3", 48 | )), 49 | ], 50 | )), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/call_labelled.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: call_labelled 4 | file: ./test/glance_test.gleam 5 | test_name: call_labelled_test 6 | --- 7 | pub fn main() { wobble(1, one: 2, two: 3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 43), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 41), 28 | Variable( 29 | Span(16, 22), 30 | "wobble", 31 | ), 32 | [ 33 | UnlabelledField(Int( 34 | Span(23, 24), 35 | "1", 36 | )), 37 | LabelledField( 38 | "one", 39 | Int(Span(31, 32), "2"), 40 | ), 41 | LabelledField( 42 | "two", 43 | Int(Span(39, 40), "3"), 44 | ), 45 | ], 46 | )), 47 | ], 48 | ), 49 | ), 50 | ], 51 | ) -------------------------------------------------------------------------------- /birdie_snapshots/call_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: call_location 4 | file: ./test/glance_test.gleam 5 | test_name: call_location_test 6 | --- 7 | 8 | pub fn main() { 9 | io.println("Hello!") 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/call_recursive.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: call_recursive 4 | file: ./test/glance_test.gleam 5 | test_name: call_recursive_test 6 | --- 7 | pub fn main() { wobble(1, 2, 3)()() } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 37), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 35), 28 | Call( 29 | Span(16, 33), 30 | Call( 31 | Span(16, 31), 32 | Variable( 33 | Span(16, 22), 34 | "wobble", 35 | ), 36 | [ 37 | UnlabelledField(Int( 38 | Span(23, 24), 39 | "1", 40 | )), 41 | UnlabelledField(Int( 42 | Span(26, 27), 43 | "2", 44 | )), 45 | UnlabelledField(Int( 46 | Span(29, 30), 47 | "3", 48 | )), 49 | ], 50 | ), 51 | [], 52 | ), 53 | [], 54 | )), 55 | ], 56 | ), 57 | ), 58 | ], 59 | ) -------------------------------------------------------------------------------- /birdie_snapshots/call_shorthand.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: call_shorthand 4 | file: ./test/glance_test.gleam 5 | test_name: call_shorthand_test 6 | --- 7 | 8 | pub fn wibble() { 9 | wobble(field:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 37), 25 | "wibble", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Call( 31 | Span(21, 35), 32 | Variable( 33 | Span(21, 27), 34 | "wobble", 35 | ), 36 | [ShorthandField("field")], 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/case.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: case 4 | file: ./test/glance_test.gleam 5 | test_name: case_test 6 | --- 7 | pub fn main() { case x { y -> 1 } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 35), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Case( 27 | Span(16, 33), 28 | [ 29 | Variable( 30 | Span(21, 22), 31 | "x", 32 | ), 33 | ], 34 | [ 35 | Clause( 36 | [ 37 | [ 38 | PatternVariable( 39 | Span(25, 26), 40 | "y", 41 | ), 42 | ], 43 | ], 44 | None, 45 | Int(Span(30, 31), "1"), 46 | ), 47 | ], 48 | )), 49 | ], 50 | ), 51 | ), 52 | ], 53 | ) -------------------------------------------------------------------------------- /birdie_snapshots/case_alternatives.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: case_alternatives 4 | file: ./test/glance_test.gleam 5 | test_name: case_alternatives_test 6 | --- 7 | pub fn main() { case x, y { a, b | c, d -> 1 } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 48), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Case( 27 | Span(16, 46), 28 | [ 29 | Variable( 30 | Span(21, 22), 31 | "x", 32 | ), 33 | Variable( 34 | Span(24, 25), 35 | "y", 36 | ), 37 | ], 38 | [ 39 | Clause( 40 | [ 41 | [ 42 | PatternVariable( 43 | Span(28, 29), 44 | "a", 45 | ), 46 | PatternVariable( 47 | Span(31, 32), 48 | "b", 49 | ), 50 | ], 51 | [ 52 | PatternVariable( 53 | Span(35, 36), 54 | "c", 55 | ), 56 | PatternVariable( 57 | Span(38, 39), 58 | "d", 59 | ), 60 | ], 61 | ], 62 | None, 63 | Int(Span(43, 44), "1"), 64 | ), 65 | ], 66 | )), 67 | ], 68 | ), 69 | ), 70 | ], 71 | ) -------------------------------------------------------------------------------- /birdie_snapshots/case_clauses.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: case_clauses 4 | file: ./test/glance_test.gleam 5 | test_name: case_clauses_test 6 | --- 7 | pub fn main() { case x, y { a, b | c, d -> 1 e, f -> 123 } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 60), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Case( 27 | Span(16, 58), 28 | [ 29 | Variable( 30 | Span(21, 22), 31 | "x", 32 | ), 33 | Variable( 34 | Span(24, 25), 35 | "y", 36 | ), 37 | ], 38 | [ 39 | Clause( 40 | [ 41 | [ 42 | PatternVariable( 43 | Span(28, 29), 44 | "a", 45 | ), 46 | PatternVariable( 47 | Span(31, 32), 48 | "b", 49 | ), 50 | ], 51 | [ 52 | PatternVariable( 53 | Span(35, 36), 54 | "c", 55 | ), 56 | PatternVariable( 57 | Span(38, 39), 58 | "d", 59 | ), 60 | ], 61 | ], 62 | None, 63 | Int(Span(43, 44), "1"), 64 | ), 65 | Clause( 66 | [ 67 | [ 68 | PatternVariable( 69 | Span(45, 46), 70 | "e", 71 | ), 72 | PatternVariable( 73 | Span(48, 49), 74 | "f", 75 | ), 76 | ], 77 | ], 78 | None, 79 | Int(Span(53, 56), "123"), 80 | ), 81 | ], 82 | )), 83 | ], 84 | ), 85 | ), 86 | ], 87 | ) -------------------------------------------------------------------------------- /birdie_snapshots/case_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: case_location 4 | file: ./test/glance_test.gleam 5 | test_name: case_location_test 6 | --- 7 | 8 | pub fn main() { 9 | case abc { 10 | ▔▔▔▔▔▔▔▔▔▔ 11 | 1 -> 2 12 | ▔▔▔▔▔▔▔▔▔▔ 13 | 3 -> 4 14 | ▔▔▔▔▔▔▔▔▔▔ 15 | _ -> 0 16 | ▔▔▔▔▔▔▔▔▔▔ 17 | } 18 | ▔▔▔ 19 | } 20 | -------------------------------------------------------------------------------- /birdie_snapshots/case_multi.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: case_multi 4 | file: ./test/glance_test.gleam 5 | test_name: case_multi_test 6 | --- 7 | pub fn main() { case x, y, z { a, b, c -> 1 } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 47), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Case( 27 | Span(16, 45), 28 | [ 29 | Variable( 30 | Span(21, 22), 31 | "x", 32 | ), 33 | Variable( 34 | Span(24, 25), 35 | "y", 36 | ), 37 | Variable( 38 | Span(27, 28), 39 | "z", 40 | ), 41 | ], 42 | [ 43 | Clause( 44 | [ 45 | [ 46 | PatternVariable( 47 | Span(31, 32), 48 | "a", 49 | ), 50 | PatternVariable( 51 | Span(34, 35), 52 | "b", 53 | ), 54 | PatternVariable( 55 | Span(37, 38), 56 | "c", 57 | ), 58 | ], 59 | ], 60 | None, 61 | Int(Span(42, 43), "1"), 62 | ), 63 | ], 64 | )), 65 | ], 66 | ), 67 | ), 68 | ], 69 | ) -------------------------------------------------------------------------------- /birdie_snapshots/comment_discarding.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: comment_discarding 4 | file: ./test/glance_test.gleam 5 | test_name: comment_discarding_test 6 | --- 7 | pub type 8 | // Comment! 9 | Spooky( 10 | // one 11 | t, u, 12 | // two 13 | ) { 14 | // three 15 | Spooky 16 | // four 17 | } 18 | 19 | --------------------------- 20 | 21 | Module( 22 | [], 23 | [ 24 | Definition( 25 | [], 26 | CustomType( 27 | Span(0, 117), 28 | "Spooky", 29 | Public, 30 | False, 31 | ["t", "u"], 32 | [Variant("Spooky", [], [])], 33 | ), 34 | ), 35 | ], 36 | [], 37 | [], 38 | [], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/comments.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: comments 4 | file: ./test/glance_test.gleam 5 | test_name: comments_test 6 | --- 7 | /// Module comment 8 | 9 | // Comment 10 | 11 | /// Doc comment 12 | pub fn main() { Nil } 13 | 14 | 15 | --------------------------- 16 | 17 | Module( 18 | [], 19 | [], 20 | [], 21 | [], 22 | [ 23 | Definition( 24 | [], 25 | Function( 26 | Span(48, 69), 27 | "main", 28 | Public, 29 | [], 30 | None, 31 | [ 32 | Expression(Variable( 33 | Span(64, 67), 34 | "Nil", 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/concatenate_discard_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: concatenate_discard_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: concatenate_discard_pattern_test 6 | --- 7 | pub fn main() { let "ok" <> _nah = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 38), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 36), 28 | Let, 29 | PatternConcatenate( 30 | Span(20, 32), 31 | "ok", 32 | None, 33 | Discarded("nah"), 34 | ), 35 | None, 36 | Int(Span(35, 36), "1"), 37 | ), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/concatenate_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: concatenate_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: concatenate_pattern_test 6 | --- 7 | pub fn main() { let "ok" <> yah = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 37), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 35), 28 | Let, 29 | PatternConcatenate( 30 | Span(20, 31), 31 | "ok", 32 | None, 33 | Named("yah"), 34 | ), 35 | None, 36 | Int(Span(34, 35), "1"), 37 | ), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/concatenate_pattern_assignment_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: concatenate_pattern_assignment_location 4 | file: ./test/glance_test.gleam 5 | test_name: concatenate_pattern_assignment_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let "prefix" as prefix <> suffix = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/concatenate_pattern_discard_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: concatenate_pattern_discard_location 4 | file: ./test/glance_test.gleam 5 | test_name: concatenate_pattern_discard_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let "prefix" <> _suffix = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/concatenate_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: concatenate_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: concatenate_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let "prefix" <> suffix = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/concatenate_pattern_with_prefix_assignment.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: concatenate_pattern_with_prefix_assignment 4 | file: ./test/glance_test.gleam 5 | test_name: concatenate_pattern_with_prefix_assignment_test 6 | --- 7 | pub fn main() { let "1" as x <> y = "" } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 40), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 38), 28 | Let, 29 | PatternConcatenate( 30 | Span(20, 33), 31 | "1", 32 | Some(Named("x")), 33 | Named("y"), 34 | ), 35 | None, 36 | String(Span(36, 38), ""), 37 | ), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/const_record_shorthand.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: const_record_shorthand 4 | file: ./test/glance_test.gleam 5 | test_name: const_record_shorthand_test 6 | --- 7 | 8 | const wibble = Wibble(field:) 9 | 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [ 18 | Definition( 19 | [], 20 | Constant( 21 | Span(1, 30), 22 | "wibble", 23 | Private, 24 | None, 25 | Call( 26 | Span(16, 30), 27 | Variable( 28 | Span(16, 22), 29 | "Wibble", 30 | ), 31 | [ShorthandField("field")], 32 | ), 33 | ), 34 | ), 35 | ], 36 | [], 37 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_annotated_int.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_annotated_int 4 | file: ./test/glance_test.gleam 5 | test_name: constant_annotated_int_test 6 | --- 7 | pub const x: Int = 123 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 22), 20 | "x", 21 | Public, 22 | Some(NamedType( 23 | Span(13, 16), 24 | "Int", 25 | None, 26 | [], 27 | )), 28 | Int(Span(19, 22), "123"), 29 | ), 30 | ), 31 | ], 32 | [], 33 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_bit_string.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_bit_string 4 | file: ./test/glance_test.gleam 5 | test_name: constant_bit_string_test 6 | --- 7 | const x = <<1:2, 2.0>> 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 22), 20 | "x", 21 | Private, 22 | None, 23 | BitString( 24 | Span(10, 22), 25 | [ 26 | #( 27 | Int(Span(12, 13), "1"), 28 | [SizeOption(2)], 29 | ), 30 | #( 31 | Float(Span(17, 20), "2.0"), 32 | [], 33 | ), 34 | ], 35 | ), 36 | ), 37 | ), 38 | ], 39 | [], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_constructor.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_constructor 4 | file: ./test/glance_test.gleam 5 | test_name: constant_constructor_test 6 | --- 7 | const x = Box(1, 2.0) 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 21), 20 | "x", 21 | Private, 22 | None, 23 | Call( 24 | Span(10, 21), 25 | Variable(Span(10, 13), "Box"), 26 | [ 27 | UnlabelledField(Int( 28 | Span(14, 15), 29 | "1", 30 | )), 31 | UnlabelledField(Float( 32 | Span(17, 20), 33 | "2.0", 34 | )), 35 | ], 36 | ), 37 | ), 38 | ), 39 | ], 40 | [], 41 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_empty_list.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_empty_list 4 | file: ./test/glance_test.gleam 5 | test_name: constant_empty_list_test 6 | --- 7 | const x = [] 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 12), 20 | "x", 21 | Private, 22 | None, 23 | List(Span(10, 12), [], None), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_empty_tuple.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_empty_tuple 4 | file: ./test/glance_test.gleam 5 | test_name: constant_empty_tuple_test 6 | --- 7 | const x = #() 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 13), 20 | "x", 21 | Private, 22 | None, 23 | Tuple(Span(10, 13), []), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_enum_constructor.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_enum_constructor 4 | file: ./test/glance_test.gleam 5 | test_name: constant_enum_constructor_test 6 | --- 7 | const x = Nil 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 13), 20 | "x", 21 | Private, 22 | None, 23 | Variable(Span(10, 13), "Nil"), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_float.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_float 4 | file: ./test/glance_test.gleam 5 | test_name: constant_float_test 6 | --- 7 | const x = 1.1 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 13), 20 | "x", 21 | Private, 22 | None, 23 | Float(Span(10, 13), "1.1"), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_int.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_int 4 | file: ./test/glance_test.gleam 5 | test_name: constant_int_test 6 | --- 7 | const x = 123 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 13), 20 | "x", 21 | Private, 22 | None, 23 | Int(Span(10, 13), "123"), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_labelled_constructor.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_labelled_constructor 4 | file: ./test/glance_test.gleam 5 | test_name: constant_labelled_constructor_test 6 | --- 7 | const x = Box(1, wobber: 2.0) 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 29), 20 | "x", 21 | Private, 22 | None, 23 | Call( 24 | Span(10, 29), 25 | Variable(Span(10, 13), "Box"), 26 | [ 27 | UnlabelledField(Int( 28 | Span(14, 15), 29 | "1", 30 | )), 31 | LabelledField( 32 | "wobber", 33 | Float(Span(25, 28), "2.0"), 34 | ), 35 | ], 36 | ), 37 | ), 38 | ), 39 | ], 40 | [], 41 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_list.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_list 4 | file: ./test/glance_test.gleam 5 | test_name: constant_list_test 6 | --- 7 | const x = [1, 2.0, 3] 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 21), 20 | "x", 21 | Private, 22 | None, 23 | List( 24 | Span(10, 21), 25 | [ 26 | Int(Span(11, 12), "1"), 27 | Float(Span(14, 17), "2.0"), 28 | Int(Span(19, 20), "3"), 29 | ], 30 | None, 31 | ), 32 | ), 33 | ), 34 | ], 35 | [], 36 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_list_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_list_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: constant_list_trailing_comma_test 6 | --- 7 | const x = [1, 2.0, 3,] 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 22), 20 | "x", 21 | Private, 22 | None, 23 | List( 24 | Span(10, 22), 25 | [ 26 | Int(Span(11, 12), "1"), 27 | Float(Span(14, 17), "2.0"), 28 | Int(Span(19, 20), "3"), 29 | ], 30 | None, 31 | ), 32 | ), 33 | ), 34 | ], 35 | [], 36 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_location 4 | file: ./test/glance_test.gleam 5 | test_name: constant_location_test 6 | --- 7 | 8 | const pi = 3.14 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/constant_pub_int.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_pub_int 4 | file: ./test/glance_test.gleam 5 | test_name: constant_pub_int_test 6 | --- 7 | pub const x = 123 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 17), 20 | "x", 21 | Public, 22 | None, 23 | Int(Span(14, 17), "123"), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_qualified_enum_constructor.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_qualified_enum_constructor 4 | file: ./test/glance_test.gleam 5 | test_name: constant_qualified_enum_constructor_test 6 | --- 7 | const x = wibble.Nil 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 20), 20 | "x", 21 | Private, 22 | None, 23 | FieldAccess( 24 | Span(10, 20), 25 | Variable( 26 | Span(10, 16), 27 | "wibble", 28 | ), 29 | "Nil", 30 | ), 31 | ), 32 | ), 33 | ], 34 | [], 35 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_string.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_string 4 | file: ./test/glance_test.gleam 5 | test_name: constant_string_test 6 | --- 7 | const x = "123" 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 15), 20 | "x", 21 | Private, 22 | None, 23 | String(Span(10, 15), "123"), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_tuple.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_tuple 4 | file: ./test/glance_test.gleam 5 | test_name: constant_tuple_test 6 | --- 7 | const x = #(1, 2.0, 3) 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 22), 20 | "x", 21 | Private, 22 | None, 23 | Tuple( 24 | Span(10, 22), 25 | [ 26 | Int(Span(12, 13), "1"), 27 | Float(Span(15, 18), "2.0"), 28 | Int(Span(20, 21), "3"), 29 | ], 30 | ), 31 | ), 32 | ), 33 | ], 34 | [], 35 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_tuple_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_tuple_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: constant_tuple_trailing_comma_test 6 | --- 7 | const x = #(1, 2.0, 3,) 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 23), 20 | "x", 21 | Private, 22 | None, 23 | Tuple( 24 | Span(10, 23), 25 | [ 26 | Int(Span(12, 13), "1"), 27 | Float(Span(15, 18), "2.0"), 28 | Int(Span(20, 21), "3"), 29 | ], 30 | ), 31 | ), 32 | ), 33 | ], 34 | [], 35 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constant_variable.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constant_variable 4 | file: ./test/glance_test.gleam 5 | test_name: constant_variable_test 6 | --- 7 | const x = y 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | Constant( 19 | Span(0, 11), 20 | "x", 21 | Private, 22 | None, 23 | Variable(Span(10, 11), "y"), 24 | ), 25 | ), 26 | ], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constructor_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constructor_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: constructor_pattern_test 6 | --- 7 | pub fn main() { let None = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 30), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 28), 28 | Let, 29 | PatternVariant( 30 | Span(20, 24), 31 | None, 32 | "None", 33 | [], 34 | False, 35 | ), 36 | None, 37 | Variable(Span(27, 28), "x"), 38 | ), 39 | ], 40 | ), 41 | ), 42 | ], 43 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constructor_pattern_args.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constructor_pattern_args 4 | file: ./test/glance_test.gleam 5 | test_name: constructor_pattern_args_test 6 | --- 7 | pub fn main() { let Thing(1, 2) = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 37), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 35), 28 | Let, 29 | PatternVariant( 30 | Span(20, 31), 31 | None, 32 | "Thing", 33 | [ 34 | UnlabelledField(PatternInt( 35 | Span(26, 27), 36 | "1", 37 | )), 38 | UnlabelledField(PatternInt( 39 | Span(29, 30), 40 | "2", 41 | )), 42 | ], 43 | False, 44 | ), 45 | None, 46 | Variable(Span(34, 35), "x"), 47 | ), 48 | ], 49 | ), 50 | ), 51 | ], 52 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constructor_pattern_labels.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constructor_pattern_labels 4 | file: ./test/glance_test.gleam 5 | test_name: constructor_pattern_labels_test 6 | --- 7 | pub fn main() { let Thing(1, x: 2, ..) = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 44), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 42), 28 | Let, 29 | PatternVariant( 30 | Span(20, 38), 31 | None, 32 | "Thing", 33 | [ 34 | UnlabelledField(PatternInt( 35 | Span(26, 27), 36 | "1", 37 | )), 38 | LabelledField( 39 | "x", 40 | PatternInt( 41 | Span(32, 33), 42 | "2", 43 | ), 44 | ), 45 | ], 46 | True, 47 | ), 48 | None, 49 | Variable(Span(41, 42), "x"), 50 | ), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constructor_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constructor_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: constructor_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let Wibble(x, wobble:, ..) = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/constructor_pattern_qualified.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constructor_pattern_qualified 4 | file: ./test/glance_test.gleam 5 | test_name: constructor_pattern_qualified_test 6 | --- 7 | pub fn main() { let wobble.Thing(1, x: 2, ..) = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 51), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 49), 28 | Let, 29 | PatternVariant( 30 | Span(20, 45), 31 | Some("wobble"), 32 | "Thing", 33 | [ 34 | UnlabelledField(PatternInt( 35 | Span(33, 34), 36 | "1", 37 | )), 38 | LabelledField( 39 | "x", 40 | PatternInt( 41 | Span(39, 40), 42 | "2", 43 | ), 44 | ), 45 | ], 46 | True, 47 | ), 48 | None, 49 | Variable(Span(48, 49), "x"), 50 | ), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constructor_pattern_spread.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constructor_pattern_spread 4 | file: ./test/glance_test.gleam 5 | test_name: constructor_pattern_spread_test 6 | --- 7 | pub fn main() { let Thing(1, 2, ..) = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 41), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 39), 28 | Let, 29 | PatternVariant( 30 | Span(20, 35), 31 | None, 32 | "Thing", 33 | [ 34 | UnlabelledField(PatternInt( 35 | Span(26, 27), 36 | "1", 37 | )), 38 | UnlabelledField(PatternInt( 39 | Span(29, 30), 40 | "2", 41 | )), 42 | ], 43 | True, 44 | ), 45 | None, 46 | Variable(Span(38, 39), "x"), 47 | ), 48 | ], 49 | ), 50 | ), 51 | ], 52 | ) -------------------------------------------------------------------------------- /birdie_snapshots/constuctorless_type.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: constuctorless_type 4 | file: ./test/glance_test.gleam 5 | test_name: constuctorless_type_test 6 | --- 7 | 8 | pub type X 9 | 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(1, 11), 20 | "X", 21 | Public, 22 | False, 23 | [], 24 | [], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/crash.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: crash 4 | file: ./test/glance_test.gleam 5 | test_name: crash_test 6 | --- 7 | pub fn main() { 8 | wibble(x: _, ) 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 34), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(FnCapture( 29 | Span(18, 32), 30 | Some("x"), 31 | Variable( 32 | Span(18, 24), 33 | "wibble", 34 | ), 35 | [], 36 | [], 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/custom_type_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: custom_type_location 4 | file: ./test/glance_test.gleam 5 | test_name: custom_type_location_test 6 | --- 7 | 8 | type Result(v, e) { 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | Ok(v) 11 | ▔▔▔▔▔▔▔ 12 | Error(e) 13 | ▔▔▔▔▔▔▔▔▔▔ 14 | } 15 | ▔ 16 | -------------------------------------------------------------------------------- /birdie_snapshots/deprecated_constructor.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: deprecated_constructor 4 | file: ./test/glance_test.gleam 5 | test_name: deprecated_constructor_test 6 | --- 7 | 8 | pub type HashAlgorithm { 9 | @deprecated("Please upgrade to another algorithm") 10 | Md5 11 | Sha224 12 | Sha512 13 | } 14 | 15 | 16 | --------------------------- 17 | 18 | Module( 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | CustomType( 24 | Span(1, 104), 25 | "HashAlgorithm", 26 | Public, 27 | False, 28 | [], 29 | [ 30 | Variant( 31 | "Md5", 32 | [], 33 | [ 34 | Attribute( 35 | "deprecated", 36 | [ 37 | String( 38 | Span(40, 77), 39 | "Please upgrade to another algorithm", 40 | ), 41 | ], 42 | ), 43 | ], 44 | ), 45 | Variant("Sha224", [], []), 46 | Variant("Sha512", [], []), 47 | ], 48 | ), 49 | ), 50 | ], 51 | [], 52 | [], 53 | [], 54 | ) -------------------------------------------------------------------------------- /birdie_snapshots/discard_list_rest.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: discard_list_rest 4 | file: ./test/glance_test.gleam 5 | test_name: discard_list_rest_test 6 | --- 7 | pub fn main() { case x { [x, ..] -> Nil } } 8 | 9 | 10 | --------------------------- 11 | 12 | Module( 13 | [], 14 | [], 15 | [], 16 | [], 17 | [ 18 | Definition( 19 | [], 20 | Function( 21 | Span(0, 43), 22 | "main", 23 | Public, 24 | [], 25 | None, 26 | [ 27 | Expression(Case( 28 | Span(16, 41), 29 | [ 30 | Variable( 31 | Span(21, 22), 32 | "x", 33 | ), 34 | ], 35 | [ 36 | Clause( 37 | [ 38 | [ 39 | PatternList( 40 | Span(25, 32), 41 | [ 42 | PatternVariable( 43 | Span(26, 27), 44 | "x", 45 | ), 46 | ], 47 | Some(PatternDiscard( 48 | Span(29, 30), 49 | "", 50 | )), 51 | ), 52 | ], 53 | ], 54 | None, 55 | Variable( 56 | Span(36, 39), 57 | "Nil", 58 | ), 59 | ), 60 | ], 61 | )), 62 | ], 63 | ), 64 | ), 65 | ], 66 | ) -------------------------------------------------------------------------------- /birdie_snapshots/discard_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: discard_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: discard_pattern_test 6 | --- 7 | pub fn main() { let _nah = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 30), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 28), 28 | Let, 29 | PatternDiscard( 30 | Span(20, 24), 31 | "nah", 32 | ), 33 | None, 34 | Int(Span(27, 28), "1"), 35 | ), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/discard_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: discard_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: discard_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let _ignored = todo 10 | ▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/echo.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: echo 4 | file: ./test/glance_test.gleam 5 | test_name: echo_test 6 | --- 7 | 8 | pub fn main() { 9 | echo 10 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 28), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Echo( 31 | Span(19, 26), 32 | Some(Int(Span(24, 26), "10")), 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/echo_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: echo_location 4 | file: ./test/glance_test.gleam 5 | test_name: echo_location_test 6 | --- 7 | 8 | pub fn main() { 9 | echo some_variable 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/echo_pipeline.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: echo_pipeline 4 | file: ./test/glance_test.gleam 5 | test_name: echo_pipeline_test 6 | --- 7 | 8 | pub fn main() { 9 | 10 |> echo 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 31), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(BinaryOperator( 31 | Span(19, 29), 32 | Pipe, 33 | Int(Span(19, 21), "10"), 34 | Echo(Span(25, 29), None), 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/empty_block.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: empty_block 4 | file: ./test/glance_test.gleam 5 | test_name: empty_block_test 6 | --- 7 | 8 | pub fn main() { 9 | {} 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 23), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Block( 31 | Span(19, 21), 32 | [], 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/empty_fields_list.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: empty_fields_list 4 | file: ./test/glance_test.gleam 5 | test_name: empty_fields_list_test 6 | --- 7 | pub type Box { 8 | Box() 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 28), 20 | "Box", 21 | Public, 22 | False, 23 | [], 24 | [Variant("Box", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/empty_list_rest_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: empty_list_rest_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: empty_list_rest_pattern_test 6 | --- 7 | pub fn main() { let [..] = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 30), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 28), 28 | Let, 29 | PatternList( 30 | Span(20, 24), 31 | [], 32 | Some(PatternDiscard( 33 | Span(21, 22), 34 | "", 35 | )), 36 | ), 37 | None, 38 | Variable(Span(27, 28), "x"), 39 | ), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/empty_parameter_list.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: empty_parameter_list 4 | file: ./test/glance_test.gleam 5 | test_name: empty_parameter_list_test 6 | --- 7 | pub type Box() { 8 | Box 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 28), 20 | "Box", 21 | Public, 22 | False, 23 | [], 24 | [Variant("Box", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/empty_unqualified.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: empty_unqualified 4 | file: ./test/glance_test.gleam 5 | test_name: empty_unqualified_test 6 | --- 7 | import one/two/three.{} as four 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 31), 17 | "one/two/three", 18 | Some(Named("four")), 19 | [], 20 | [], 21 | ), 22 | ), 23 | ], 24 | [], 25 | [], 26 | [], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_block.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_block 4 | file: ./test/glance_test.gleam 5 | test_name: expression_block_test 6 | --- 7 | pub fn main() { { x y z } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Block( 27 | Span(16, 25), 28 | [ 29 | Expression(Variable( 30 | Span(18, 19), 31 | "x", 32 | )), 33 | Expression(Variable( 34 | Span(20, 21), 35 | "y", 36 | )), 37 | Expression(Variable( 38 | Span(22, 23), 39 | "z", 40 | )), 41 | ], 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_empty_list_prefix.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_empty_list_prefix 4 | file: ./test/glance_test.gleam 5 | test_name: expression_empty_list_prefix_test 6 | --- 7 | pub fn main() { [..x] } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 23), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(List( 27 | Span(16, 21), 28 | [], 29 | Some(Variable( 30 | Span(19, 20), 31 | "x", 32 | )), 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_float.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_float 4 | file: ./test/glance_test.gleam 5 | test_name: expression_float_test 6 | --- 7 | pub fn main() { 1.0 2.0 3.0 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Float( 27 | Span(16, 19), 28 | "1.0", 29 | )), 30 | Expression(Float( 31 | Span(20, 23), 32 | "2.0", 33 | )), 34 | Expression(Float( 35 | Span(24, 27), 36 | "3.0", 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_fn.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_fn 4 | file: ./test/glance_test.gleam 5 | test_name: expression_fn_test 6 | --- 7 | pub fn main() { fn(x) { x } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Fn( 27 | Span(16, 27), 28 | [ 29 | FnParameter( 30 | Named("x"), 31 | None, 32 | ), 33 | ], 34 | None, 35 | [ 36 | Expression(Variable( 37 | Span(24, 25), 38 | "x", 39 | )), 40 | ], 41 | )), 42 | ], 43 | ), 44 | ), 45 | ], 46 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_fn_annotated_parens.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_fn_annotated_parens 4 | file: ./test/glance_test.gleam 5 | test_name: expression_fn_annotated_parens_test 6 | --- 7 | pub fn main() { fn(x: a) { x } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 32), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Fn( 27 | Span(16, 30), 28 | [ 29 | FnParameter( 30 | Named("x"), 31 | Some(VariableType( 32 | Span(22, 23), 33 | "a", 34 | )), 35 | ), 36 | ], 37 | None, 38 | [ 39 | Expression(Variable( 40 | Span(27, 28), 41 | "x", 42 | )), 43 | ], 44 | )), 45 | ], 46 | ), 47 | ), 48 | ], 49 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_fn_discard.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_fn_discard 4 | file: ./test/glance_test.gleam 5 | test_name: expression_fn_discard_test 6 | --- 7 | pub fn main() { fn(_x: a) { 1 } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 33), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Fn( 27 | Span(16, 31), 28 | [ 29 | FnParameter( 30 | Discarded("x"), 31 | Some(VariableType( 32 | Span(23, 24), 33 | "a", 34 | )), 35 | ), 36 | ], 37 | None, 38 | [ 39 | Expression(Int( 40 | Span(28, 29), 41 | "1", 42 | )), 43 | ], 44 | )), 45 | ], 46 | ), 47 | ), 48 | ], 49 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_fn_return.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_fn_return 4 | file: ./test/glance_test.gleam 5 | test_name: expression_fn_return_test 6 | --- 7 | pub fn main() { fn(x) -> a { 1 x } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 36), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Fn( 27 | Span(16, 34), 28 | [ 29 | FnParameter( 30 | Named("x"), 31 | None, 32 | ), 33 | ], 34 | Some(VariableType( 35 | Span(25, 26), 36 | "a", 37 | )), 38 | [ 39 | Expression(Int( 40 | Span(29, 30), 41 | "1", 42 | )), 43 | Expression(Variable( 44 | Span(31, 32), 45 | "x", 46 | )), 47 | ], 48 | )), 49 | ], 50 | ), 51 | ), 52 | ], 53 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_int.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_int 4 | file: ./test/glance_test.gleam 5 | test_name: expression_int_test 6 | --- 7 | pub fn main() { 1 2 3 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 23), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Int( 27 | Span(16, 17), 28 | "1", 29 | )), 30 | Expression(Int( 31 | Span(18, 19), 32 | "2", 33 | )), 34 | Expression(Int( 35 | Span(20, 21), 36 | "3", 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_list.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_list 4 | file: ./test/glance_test.gleam 5 | test_name: expression_list_test 6 | --- 7 | pub fn main() { [1, 2, 3] } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(List( 27 | Span(16, 25), 28 | [ 29 | Int(Span(17, 18), "1"), 30 | Int(Span(20, 21), "2"), 31 | Int(Span(23, 24), "3"), 32 | ], 33 | None, 34 | )), 35 | ], 36 | ), 37 | ), 38 | ], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_list_prefix.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_list_prefix 4 | file: ./test/glance_test.gleam 5 | test_name: expression_list_prefix_test 6 | --- 7 | pub fn main() { [1, 2, 3, ..x] } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 32), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(List( 27 | Span(16, 30), 28 | [ 29 | Int(Span(17, 18), "1"), 30 | Int(Span(20, 21), "2"), 31 | Int(Span(23, 24), "3"), 32 | ], 33 | Some(Variable( 34 | Span(28, 29), 35 | "x", 36 | )), 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_list_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_list_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: expression_list_trailing_comma_test 6 | --- 7 | pub fn main() { [1, 2, 3, ] } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(List( 27 | Span(16, 27), 28 | [ 29 | Int(Span(17, 18), "1"), 30 | Int(Span(20, 21), "2"), 31 | Int(Span(23, 24), "3"), 32 | ], 33 | None, 34 | )), 35 | ], 36 | ), 37 | ), 38 | ], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_negate_bool.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_negate_bool 4 | file: ./test/glance_test.gleam 5 | test_name: expression_negate_bool_test 6 | --- 7 | pub fn main() { !x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 20), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(NegateBool( 27 | Span(16, 18), 28 | Variable(Span(17, 18), "x"), 29 | )), 30 | ], 31 | ), 32 | ), 33 | ], 34 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_negate_int.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_negate_int 4 | file: ./test/glance_test.gleam 5 | test_name: expression_negate_int_test 6 | --- 7 | pub fn main() { -x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 20), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(NegateInt( 27 | Span(16, 18), 28 | Variable(Span(17, 18), "x"), 29 | )), 30 | ], 31 | ), 32 | ), 33 | ], 34 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_panic.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_panic 4 | file: ./test/glance_test.gleam 5 | test_name: expression_panic_test 6 | --- 7 | pub fn main() { panic panic } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Panic( 27 | Span(16, 21), 28 | None, 29 | )), 30 | Expression(Panic( 31 | Span(22, 27), 32 | None, 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_panic_message.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_panic_message 4 | file: ./test/glance_test.gleam 5 | test_name: expression_panic_message_test 6 | --- 7 | pub fn main() { panic("huh") } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 30), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 28), 28 | Panic(Span(16, 21), None), 29 | [ 30 | UnlabelledField(String( 31 | Span(22, 27), 32 | "huh", 33 | )), 34 | ], 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_string.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_string 4 | file: ./test/glance_test.gleam 5 | test_name: expression_string_test 6 | --- 7 | pub fn main() { "10" "20" "30" } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 32), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(String( 27 | Span(16, 20), 28 | "10", 29 | )), 30 | Expression(String( 31 | Span(21, 25), 32 | "20", 33 | )), 34 | Expression(String( 35 | Span(26, 30), 36 | "30", 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_todo.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_todo 4 | file: ./test/glance_test.gleam 5 | test_name: expression_todo_test 6 | --- 7 | pub fn main() { todo } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 22), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Todo( 27 | Span(16, 20), 28 | None, 29 | )), 30 | ], 31 | ), 32 | ), 33 | ], 34 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_todo_message.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_todo_message 4 | file: ./test/glance_test.gleam 5 | test_name: expression_todo_message_test 6 | --- 7 | pub fn main() { todo("huh") } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 27), 28 | Todo(Span(16, 20), None), 29 | [ 30 | UnlabelledField(String( 31 | Span(21, 26), 32 | "huh", 33 | )), 34 | ], 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_tuple.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_tuple 4 | file: ./test/glance_test.gleam 5 | test_name: expression_tuple_test 6 | --- 7 | pub fn main() { #(1, 2, 3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 28), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Tuple( 27 | Span(16, 26), 28 | [ 29 | Int(Span(18, 19), "1"), 30 | Int(Span(21, 22), "2"), 31 | Int(Span(24, 25), "3"), 32 | ], 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_tuple_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_tuple_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: expression_tuple_trailing_comma_test 6 | --- 7 | pub fn main() { #(1, 2, 3, ) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 30), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Tuple( 27 | Span(16, 28), 28 | [ 29 | Int(Span(18, 19), "1"), 30 | Int(Span(21, 22), "2"), 31 | Int(Span(24, 25), "3"), 32 | ], 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/expression_variable.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: expression_variable 4 | file: ./test/glance_test.gleam 5 | test_name: expression_variable_test 6 | --- 7 | pub fn main() { x y z } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 23), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Variable( 27 | Span(16, 17), 28 | "x", 29 | )), 30 | Expression(Variable( 31 | Span(18, 19), 32 | "y", 33 | )), 34 | Expression(Variable( 35 | Span(20, 21), 36 | "z", 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/external_attribute.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: external_attribute 4 | file: ./test/glance_test.gleam 5 | test_name: external_attribute_test 6 | --- 7 | 8 | @external(erlang, "gb_trees", "empty") 9 | @external(javascript, "./gb_trees.js", "empty") 10 | pub fn new_gb_tree() -> GbTree(k, v) 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [ 23 | Attribute( 24 | "external", 25 | [ 26 | Variable( 27 | Span(11, 17), 28 | "erlang", 29 | ), 30 | String( 31 | Span(19, 29), 32 | "gb_trees", 33 | ), 34 | String( 35 | Span(31, 38), 36 | "empty", 37 | ), 38 | ], 39 | ), 40 | Attribute( 41 | "external", 42 | [ 43 | Variable( 44 | Span(50, 60), 45 | "javascript", 46 | ), 47 | String( 48 | Span(62, 77), 49 | "./gb_trees.js", 50 | ), 51 | String( 52 | Span(79, 86), 53 | "empty", 54 | ), 55 | ], 56 | ), 57 | ], 58 | Function( 59 | Span(88, 124), 60 | "new_gb_tree", 61 | Public, 62 | [], 63 | Some(NamedType( 64 | Span(112, 124), 65 | "GbTree", 66 | None, 67 | [ 68 | VariableType( 69 | Span(119, 120), 70 | "k", 71 | ), 72 | VariableType( 73 | Span(122, 123), 74 | "v", 75 | ), 76 | ], 77 | )), 78 | [], 79 | ), 80 | ), 81 | ], 82 | ) -------------------------------------------------------------------------------- /birdie_snapshots/external_function_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: external_function_location 4 | file: ./test/glance_test.gleam 5 | test_name: external_function_location_test 6 | --- 7 | 8 | fn something_external(args) 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/external_function_with_return_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: external_function_with_return_location 4 | file: ./test/glance_test.gleam 5 | test_name: external_function_with_return_location_test 6 | --- 7 | 8 | fn something_external(args) -> ReturnType 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/external_type_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: external_type_location 4 | file: ./test/glance_test.gleam 5 | test_name: external_type_location_test 6 | --- 7 | 8 | type Wibble 9 | ▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/external_type_with_parameters_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: external_type_with_parameters_location 4 | file: ./test/glance_test.gleam 5 | test_name: external_type_with_parameters_location_test 6 | --- 7 | 8 | type Dict(key, value) 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/field_access.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: field_access 4 | file: ./test/glance_test.gleam 5 | test_name: field_access_test 6 | --- 7 | pub fn main() { wobble.wibble } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 31), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FieldAccess( 27 | Span(16, 29), 28 | Variable( 29 | Span(16, 22), 30 | "wobble", 31 | ), 32 | "wibble", 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/field_access_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: field_access_location 4 | file: ./test/glance_test.gleam 5 | test_name: field_access_location_test 6 | --- 7 | 8 | pub fn main() { 9 | something.wibble 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/field_access_recursive.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: field_access_recursive 4 | file: ./test/glance_test.gleam 5 | test_name: field_access_recursive_test 6 | --- 7 | pub fn main() { one.two.three.four } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 36), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FieldAccess( 27 | Span(16, 34), 28 | FieldAccess( 29 | Span(16, 29), 30 | FieldAccess( 31 | Span(16, 23), 32 | Variable( 33 | Span(16, 19), 34 | "one", 35 | ), 36 | "two", 37 | ), 38 | "three", 39 | ), 40 | "four", 41 | )), 42 | ], 43 | ), 44 | ), 45 | ], 46 | ) -------------------------------------------------------------------------------- /birdie_snapshots/field_access_upper.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: field_access_upper 4 | file: ./test/glance_test.gleam 5 | test_name: field_access_upper_test 6 | --- 7 | pub fn main() { wobble.Wibble } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 31), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FieldAccess( 27 | Span(16, 29), 28 | Variable( 29 | Span(16, 22), 30 | "wobble", 31 | ), 32 | "Wibble", 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/fields_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: fields_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: fields_trailing_comma_test 6 | --- 7 | pub type Box(a) { 8 | Box(a,) 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 33), 20 | "Box", 21 | Public, 22 | False, 23 | ["a"], 24 | [ 25 | Variant( 26 | "Box", 27 | [ 28 | UnlabelledVariantField(VariableType( 29 | Span(26, 27), 30 | "a", 31 | )), 32 | ], 33 | [], 34 | ), 35 | ], 36 | ), 37 | ), 38 | ], 39 | [], 40 | [], 41 | [], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/float_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: float_location 4 | file: ./test/glance_test.gleam 5 | test_name: float_location_test 6 | --- 7 | 8 | pub fn main() { 9 | 3.1415 10 | ▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/float_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: float_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: float_pattern_test 6 | --- 7 | pub fn main() { let 1.3 = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 27), 28 | Let, 29 | PatternFloat( 30 | Span(20, 23), 31 | "1.3", 32 | ), 33 | None, 34 | Int(Span(26, 27), "1"), 35 | ), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/float_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: float_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: float_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let 1.4e19 = todo 10 | ▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/fn_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: fn_location 4 | file: ./test/glance_test.gleam 5 | test_name: fn_location_test 6 | --- 7 | 8 | pub fn main() { 9 | fn(arg) { 10 | ▔▔▔▔▔▔▔▔▔ 11 | arg + 1 12 | ▔▔▔▔▔▔▔▔▔▔▔ 13 | } 14 | ▔▔▔ 15 | } 16 | -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_after.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_after 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_after_test 6 | --- 7 | pub fn main() { wibble(_,1,2,3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 33), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FnCapture( 27 | Span(16, 31), 28 | None, 29 | Variable( 30 | Span(16, 22), 31 | "wibble", 32 | ), 33 | [], 34 | [ 35 | UnlabelledField(Int( 36 | Span(25, 26), 37 | "1", 38 | )), 39 | UnlabelledField(Int( 40 | Span(27, 28), 41 | "2", 42 | )), 43 | UnlabelledField(Int( 44 | Span(29, 30), 45 | "3", 46 | )), 47 | ], 48 | )), 49 | ], 50 | ), 51 | ), 52 | ], 53 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_after_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_after_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_after_trailing_comma_test 6 | --- 7 | pub fn main() { wibble(_,1,2,3,) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 34), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FnCapture( 27 | Span(16, 32), 28 | None, 29 | Variable( 30 | Span(16, 22), 31 | "wibble", 32 | ), 33 | [], 34 | [ 35 | UnlabelledField(Int( 36 | Span(25, 26), 37 | "1", 38 | )), 39 | UnlabelledField(Int( 40 | Span(27, 28), 41 | "2", 42 | )), 43 | UnlabelledField(Int( 44 | Span(29, 30), 45 | "3", 46 | )), 47 | ], 48 | )), 49 | ], 50 | ), 51 | ), 52 | ], 53 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_before.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_before 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_before_test 6 | --- 7 | pub fn main() { wibble(1,2,3,_) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 33), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FnCapture( 27 | Span(16, 31), 28 | None, 29 | Variable( 30 | Span(16, 22), 31 | "wibble", 32 | ), 33 | [ 34 | UnlabelledField(Int( 35 | Span(23, 24), 36 | "1", 37 | )), 38 | UnlabelledField(Int( 39 | Span(25, 26), 40 | "2", 41 | )), 42 | UnlabelledField(Int( 43 | Span(27, 28), 44 | "3", 45 | )), 46 | ], 47 | [], 48 | )), 49 | ], 50 | ), 51 | ), 52 | ], 53 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_both.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_both 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_both_test 6 | --- 7 | pub fn main() { wibble(1, 2, _, 3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 36), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FnCapture( 27 | Span(16, 34), 28 | None, 29 | Variable( 30 | Span(16, 22), 31 | "wibble", 32 | ), 33 | [ 34 | UnlabelledField(Int( 35 | Span(23, 24), 36 | "1", 37 | )), 38 | UnlabelledField(Int( 39 | Span(26, 27), 40 | "2", 41 | )), 42 | ], 43 | [ 44 | UnlabelledField(Int( 45 | Span(32, 33), 46 | "3", 47 | )), 48 | ], 49 | )), 50 | ], 51 | ), 52 | ), 53 | ], 54 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_immediate_call.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_immediate_call 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_immediate_call_test 6 | --- 7 | pub fn main() { wibble(_)() } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Call( 27 | Span(16, 27), 28 | FnCapture( 29 | Span(16, 25), 30 | None, 31 | Variable( 32 | Span(16, 22), 33 | "wibble", 34 | ), 35 | [], 36 | [], 37 | ), 38 | [], 39 | )), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_location 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_location_test 6 | --- 7 | 8 | pub fn main() { 9 | add(_, 1) 10 | ▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_pointless.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_pointless 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_pointless_test 6 | --- 7 | pub fn main() { wibble(_) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(FnCapture( 27 | Span(16, 25), 28 | None, 29 | Variable( 30 | Span(16, 22), 31 | "wibble", 32 | ), 33 | [], 34 | [], 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_capture_shorthand.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_capture_shorthand 4 | file: ./test/glance_test.gleam 5 | test_name: function_capture_shorthand_test 6 | --- 7 | 8 | pub fn wibble() { 9 | wobble(_, field:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 40), 25 | "wibble", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(FnCapture( 31 | Span(21, 38), 32 | None, 33 | Variable( 34 | Span(21, 27), 35 | "wobble", 36 | ), 37 | [], 38 | [ShorthandField("field")], 39 | )), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_location 4 | file: ./test/glance_test.gleam 5 | test_name: function_location_test 6 | --- 7 | 8 | fn wibble(x) { x } 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/function_main.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_main 4 | file: ./test/glance_test.gleam 5 | test_name: function_main_test 6 | --- 7 | pub fn main() {} 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 16), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [], 26 | ), 27 | ), 28 | ], 29 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_parameters.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_parameters 4 | file: ./test/glance_test.gleam 5 | test_name: function_parameters_test 6 | --- 7 | fn main(a, b: #(), c d, e f: G, h _i, j _k: L) {} 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 49), 21 | "main", 22 | Private, 23 | [ 24 | FunctionParameter( 25 | None, 26 | Named("a"), 27 | None, 28 | ), 29 | FunctionParameter( 30 | None, 31 | Named("b"), 32 | Some(TupleType( 33 | Span(14, 17), 34 | [], 35 | )), 36 | ), 37 | FunctionParameter( 38 | Some("c"), 39 | Named("d"), 40 | None, 41 | ), 42 | FunctionParameter( 43 | Some("e"), 44 | Named("f"), 45 | Some(NamedType( 46 | Span(29, 30), 47 | "G", 48 | None, 49 | [], 50 | )), 51 | ), 52 | FunctionParameter( 53 | Some("h"), 54 | Discarded("i"), 55 | None, 56 | ), 57 | FunctionParameter( 58 | Some("j"), 59 | Discarded("k"), 60 | Some(NamedType( 61 | Span(44, 45), 62 | "L", 63 | None, 64 | [], 65 | )), 66 | ), 67 | ], 68 | None, 69 | [], 70 | ), 71 | ), 72 | ], 73 | ) -------------------------------------------------------------------------------- /birdie_snapshots/function_return_annotation.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: function_return_annotation 4 | file: ./test/glance_test.gleam 5 | test_name: function_return_annotation_test 6 | --- 7 | fn main() -> Nil {} 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 19), 21 | "main", 22 | Private, 23 | [], 24 | Some(NamedType( 25 | Span(13, 16), 26 | "Nil", 27 | None, 28 | [], 29 | )), 30 | [], 31 | ), 32 | ), 33 | ], 34 | ) -------------------------------------------------------------------------------- /birdie_snapshots/guard.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: guard 4 | file: ./test/glance_test.gleam 5 | test_name: guard_test 6 | --- 7 | pub fn main() { case x { y if z -> 1 } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 40), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Case( 27 | Span(16, 38), 28 | [ 29 | Variable( 30 | Span(21, 22), 31 | "x", 32 | ), 33 | ], 34 | [ 35 | Clause( 36 | [ 37 | [ 38 | PatternVariable( 39 | Span(25, 26), 40 | "y", 41 | ), 42 | ], 43 | ], 44 | Some(Variable( 45 | Span(30, 31), 46 | "z", 47 | )), 48 | Int(Span(35, 36), "1"), 49 | ), 50 | ], 51 | )), 52 | ], 53 | ), 54 | ), 55 | ], 56 | ) -------------------------------------------------------------------------------- /birdie_snapshots/import.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import 4 | file: ./test/glance_test.gleam 5 | test_name: import_test 6 | --- 7 | import one 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 10), 17 | "one", 18 | None, 19 | [], 20 | [], 21 | ), 22 | ), 23 | ], 24 | [], 25 | [], 26 | [], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/import_alias_discard_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import_alias_discard_location 4 | file: ./test/glance_test.gleam 5 | test_name: import_alias_discard_location_test 6 | --- 7 | 8 | import glance as _ignore 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/import_alias_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import_alias_location 4 | file: ./test/glance_test.gleam 5 | test_name: import_alias_location_test 6 | --- 7 | 8 | import glance.{Module} as parser 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/import_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import_location 4 | file: ./test/glance_test.gleam 5 | test_name: import_location_test 6 | --- 7 | 8 | import glance 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/import_nested_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import_nested_location 4 | file: ./test/glance_test.gleam 5 | test_name: import_nested_location_test 6 | --- 7 | 8 | import gleam/io 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/import_unqualified_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import_unqualified_location 4 | file: ./test/glance_test.gleam 5 | test_name: import_unqualified_location_test 6 | --- 7 | 8 | import glance.{Module} 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/import_with_underscore_alias.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: import_with_underscore_alias 4 | file: ./test/glance_test.gleam 5 | test_name: import_with_underscore_alias_test 6 | --- 7 | 8 | import gleam/list.{range} as _alias 9 | 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [ 15 | Definition( 16 | [], 17 | Import( 18 | Span(1, 36), 19 | "gleam/list", 20 | Some(Discarded("alias")), 21 | [], 22 | [ 23 | UnqualifiedImport( 24 | "range", 25 | None, 26 | ), 27 | ], 28 | ), 29 | ), 30 | ], 31 | [], 32 | [], 33 | [], 34 | [], 35 | ) -------------------------------------------------------------------------------- /birdie_snapshots/int_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: int_location 4 | file: ./test/glance_test.gleam 5 | test_name: int_location_test 6 | --- 7 | 8 | pub fn main() { 9 | 123_456 10 | ▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/int_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: int_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: int_pattern_test 6 | --- 7 | pub fn main() { let 123 = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 29), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 27), 28 | Let, 29 | PatternInt( 30 | Span(20, 23), 31 | "123", 32 | ), 33 | None, 34 | Int(Span(26, 27), "1"), 35 | ), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/int_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: int_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: int_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let 0xABCD = todo 10 | ▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/label_capture.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: label_capture 4 | file: ./test/glance_test.gleam 5 | test_name: label_capture_test 6 | --- 7 | pub fn main() { 8 | wibble(x: _) 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 32), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(FnCapture( 29 | Span(18, 30), 30 | Some("x"), 31 | Variable( 32 | Span(18, 24), 33 | "wibble", 34 | ), 35 | [], 36 | [], 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/labelled_fields.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: labelled_fields 4 | file: ./test/glance_test.gleam 5 | test_name: labelled_fields_test 6 | --- 7 | pub type Box(a) { 8 | Box(a: a, b: a) 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 41), 20 | "Box", 21 | Public, 22 | False, 23 | ["a"], 24 | [ 25 | Variant( 26 | "Box", 27 | [ 28 | LabelledVariantField( 29 | VariableType( 30 | Span(29, 30), 31 | "a", 32 | ), 33 | "a", 34 | ), 35 | LabelledVariantField( 36 | VariableType( 37 | Span(35, 36), 38 | "a", 39 | ), 40 | "b", 41 | ), 42 | ], 43 | [], 44 | ), 45 | ], 46 | ), 47 | ), 48 | ], 49 | [], 50 | [], 51 | [], 52 | ) -------------------------------------------------------------------------------- /birdie_snapshots/let_annotation.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_annotation 4 | file: ./test/glance_test.gleam 5 | test_name: let_annotation_test 6 | --- 7 | 8 | pub fn main() { 9 | let _money: Int = 1 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 40), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Assignment( 31 | Span(19, 38), 32 | Let, 33 | PatternDiscard( 34 | Span(23, 29), 35 | "money", 36 | ), 37 | Some(NamedType( 38 | Span(31, 34), 39 | "Int", 40 | None, 41 | [], 42 | )), 43 | Int(Span(37, 38), "1"), 44 | ), 45 | ], 46 | ), 47 | ), 48 | ], 49 | ) -------------------------------------------------------------------------------- /birdie_snapshots/let_assert.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_assert 4 | file: ./test/glance_test.gleam 5 | test_name: let_assert_test 6 | --- 7 | pub fn main() { let assert x = 1 2 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 36), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 32), 28 | LetAssert(None), 29 | PatternVariable( 30 | Span(27, 28), 31 | "x", 32 | ), 33 | None, 34 | Int(Span(31, 32), "1"), 35 | ), 36 | Expression(Int( 37 | Span(33, 34), 38 | "2", 39 | )), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/let_assert_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_assert_location 4 | file: ./test/glance_test.gleam 5 | test_name: let_assert_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let assert Ok(a) = b 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/let_assert_message_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_assert_message_location 4 | file: ./test/glance_test.gleam 5 | test_name: let_assert_message_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let assert Ok(a) = b as "Value was not Ok" 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/let_assert_todo_precedence.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_assert_todo_precedence 4 | file: ./test/glance_test.gleam 5 | test_name: let_assert_todo_precedence_test 6 | --- 7 | pub fn main() { let assert x = todo as "This is the todo message" } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 67), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 65), 28 | LetAssert(None), 29 | PatternVariable( 30 | Span(27, 28), 31 | "x", 32 | ), 33 | None, 34 | Todo( 35 | Span(31, 65), 36 | Some(String( 37 | Span(39, 65), 38 | "This is the todo message", 39 | )), 40 | ), 41 | ), 42 | ], 43 | ), 44 | ), 45 | ], 46 | ) -------------------------------------------------------------------------------- /birdie_snapshots/let_assert_with_compound_message.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_assert_with_compound_message 4 | file: ./test/glance_test.gleam 5 | test_name: let_assert_with_compound_message_test 6 | --- 7 | pub fn main() { let assert x = 1 as { "some" <> "message" } } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 61), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 59), 28 | LetAssert(Some(Block( 29 | Span(36, 59), 30 | [ 31 | Expression(BinaryOperator( 32 | Span(38, 57), 33 | Concatenate, 34 | String( 35 | Span(38, 44), 36 | "some", 37 | ), 38 | String( 39 | Span(48, 57), 40 | "message", 41 | ), 42 | )), 43 | ], 44 | ))), 45 | PatternVariable( 46 | Span(27, 28), 47 | "x", 48 | ), 49 | None, 50 | Int(Span(31, 32), "1"), 51 | ), 52 | ], 53 | ), 54 | ), 55 | ], 56 | ) -------------------------------------------------------------------------------- /birdie_snapshots/let_assert_with_message.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_assert_with_message 4 | file: ./test/glance_test.gleam 5 | test_name: let_assert_with_message_test 6 | --- 7 | pub fn main() { let assert x = 1 as "This shouldn't fail" } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 59), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 57), 28 | LetAssert(Some(String( 29 | Span(36, 57), 30 | "This shouldn't fail", 31 | ))), 32 | PatternVariable( 33 | Span(27, 28), 34 | "x", 35 | ), 36 | None, 37 | Int(Span(31, 32), "1"), 38 | ), 39 | ], 40 | ), 41 | ), 42 | ], 43 | ) -------------------------------------------------------------------------------- /birdie_snapshots/let_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: let_location 4 | file: ./test/glance_test.gleam 5 | test_name: let_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let a = b 10 | ▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/list_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: list_location 4 | file: ./test/glance_test.gleam 5 | test_name: list_location_test 6 | --- 7 | 8 | pub fn main() { 9 | [a, b, c] 10 | ▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/list_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: list_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: list_pattern_test 6 | --- 7 | pub fn main() { let [1, 2] = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 32), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 30), 28 | Let, 29 | PatternList( 30 | Span(20, 26), 31 | [ 32 | PatternInt( 33 | Span(21, 22), 34 | "1", 35 | ), 36 | PatternInt( 37 | Span(24, 25), 38 | "2", 39 | ), 40 | ], 41 | None, 42 | ), 43 | None, 44 | Variable(Span(29, 30), "x"), 45 | ), 46 | ], 47 | ), 48 | ), 49 | ], 50 | ) -------------------------------------------------------------------------------- /birdie_snapshots/list_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: list_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: list_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let [1, 2, x] = todo 10 | ▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/list_pattern_spread_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: list_pattern_spread_location 4 | file: ./test/glance_test.gleam 5 | test_name: list_pattern_spread_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let [1, 2, ..rest] = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/list_rest_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: list_rest_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: list_rest_pattern_test 6 | --- 7 | pub fn main() { let [1, 2, ..y] = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 37), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 35), 28 | Let, 29 | PatternList( 30 | Span(20, 31), 31 | [ 32 | PatternInt( 33 | Span(21, 22), 34 | "1", 35 | ), 36 | PatternInt( 37 | Span(24, 25), 38 | "2", 39 | ), 40 | ], 41 | Some(PatternVariable( 42 | Span(29, 30), 43 | "y", 44 | )), 45 | ), 46 | None, 47 | Variable(Span(34, 35), "x"), 48 | ), 49 | ], 50 | ), 51 | ), 52 | ], 53 | ) -------------------------------------------------------------------------------- /birdie_snapshots/list_spread_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: list_spread_location 4 | file: ./test/glance_test.gleam 5 | test_name: list_spread_location_test 6 | --- 7 | 8 | pub fn main() { 9 | [a, b, c, ..efg] 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/mult_add.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: mult_add 4 | file: ./test/glance_test.gleam 5 | test_name: mult_add_test 6 | --- 7 | pub fn main() { x * y + z } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 25), 28 | AddInt, 29 | BinaryOperator( 30 | Span(16, 21), 31 | MultInt, 32 | Variable( 33 | Span(16, 17), 34 | "x", 35 | ), 36 | Variable( 37 | Span(20, 21), 38 | "y", 39 | ), 40 | ), 41 | Variable(Span(24, 25), "z"), 42 | )), 43 | ], 44 | ), 45 | ), 46 | ], 47 | ) -------------------------------------------------------------------------------- /birdie_snapshots/multiple_field_call.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: multiple_field_call 4 | file: ./test/glance_test.gleam 5 | test_name: multiple_field_call_test 6 | --- 7 | 8 | pub fn wibble() { 9 | wobble(unlabelled, shorthand_mid:, non_shorthand: a, shorthand_end:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 91), 25 | "wibble", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Call( 31 | Span(21, 89), 32 | Variable( 33 | Span(21, 27), 34 | "wobble", 35 | ), 36 | [ 37 | UnlabelledField(Variable( 38 | Span(28, 38), 39 | "unlabelled", 40 | )), 41 | ShorthandField("shorthand_mid"), 42 | LabelledField( 43 | "non_shorthand", 44 | Variable( 45 | Span(71, 72), 46 | "a", 47 | ), 48 | ), 49 | ShorthandField("shorthand_end"), 50 | ], 51 | )), 52 | ], 53 | ), 54 | ), 55 | ], 56 | ) -------------------------------------------------------------------------------- /birdie_snapshots/multiple_field_record_update.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: multiple_field_record_update 4 | file: ./test/glance_test.gleam 5 | test_name: multiple_field_record_update_test 6 | --- 7 | 8 | pub fn wibble() { 9 | Wobble(..wobble, shorthand_mid:, non_shorthand: a, shorthand_end:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 89), 25 | "wibble", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(RecordUpdate( 31 | Span(21, 87), 32 | None, 33 | "Wobble", 34 | Variable( 35 | Span(30, 36), 36 | "wobble", 37 | ), 38 | [ 39 | RecordUpdateField( 40 | "shorthand_mid", 41 | None, 42 | ), 43 | RecordUpdateField( 44 | "non_shorthand", 45 | Some(Variable( 46 | Span(69, 70), 47 | "a", 48 | )), 49 | ), 50 | RecordUpdateField( 51 | "shorthand_end", 52 | None, 53 | ), 54 | ], 55 | )), 56 | ], 57 | ), 58 | ), 59 | ], 60 | ) -------------------------------------------------------------------------------- /birdie_snapshots/multiple_fields.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: multiple_fields 4 | file: ./test/glance_test.gleam 5 | test_name: multiple_fields_test 6 | --- 7 | pub type Box(x, y, z) { 8 | Box(x, y, z) 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 44), 20 | "Box", 21 | Public, 22 | False, 23 | ["x", "y", "z"], 24 | [ 25 | Variant( 26 | "Box", 27 | [ 28 | UnlabelledVariantField(VariableType( 29 | Span(32, 33), 30 | "x", 31 | )), 32 | UnlabelledVariantField(VariableType( 33 | Span(35, 36), 34 | "y", 35 | )), 36 | UnlabelledVariantField(VariableType( 37 | Span(38, 39), 38 | "z", 39 | )), 40 | ], 41 | [], 42 | ), 43 | ], 44 | ), 45 | ), 46 | ], 47 | [], 48 | [], 49 | [], 50 | ) -------------------------------------------------------------------------------- /birdie_snapshots/negate_int_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: negate_int_location 4 | file: ./test/glance_test.gleam 5 | test_name: negate_int_location_test 6 | --- 7 | 8 | pub fn main() { 9 | -123 10 | ▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/negative_float_bug.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: negative_float_bug 4 | file: ./test/glance_test.gleam 5 | test_name: negative_float_bug_test 6 | --- 7 | 8 | pub fn main() { 9 | -1.1 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 25), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Float( 31 | Span(19, 23), 32 | "-1.1", 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/negative_float_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: negative_float_location 4 | file: ./test/glance_test.gleam 5 | test_name: negative_float_location_test 6 | --- 7 | 8 | pub fn main() { 9 | -123.456 10 | ▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/negative_int_bug.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: negative_int_bug 4 | file: ./test/glance_test.gleam 5 | test_name: negative_int_bug_test 6 | --- 7 | 8 | pub fn main() { 9 | -11 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 24), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Int( 31 | Span(19, 22), 32 | "-11", 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/nested_import.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: nested_import 4 | file: ./test/glance_test.gleam 5 | test_name: nested_import_test 6 | --- 7 | import one/two/three 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 20), 17 | "one/two/three", 18 | None, 19 | [], 20 | [], 21 | ), 22 | ), 23 | ], 24 | [], 25 | [], 26 | [], 27 | [], 28 | ) -------------------------------------------------------------------------------- /birdie_snapshots/nil.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: nil 4 | file: ./test/glance_test.gleam 5 | test_name: nil_test 6 | --- 7 | pub fn main() { Nil } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 21), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(Variable( 27 | Span(16, 19), 28 | "Nil", 29 | )), 30 | ], 31 | ), 32 | ), 33 | ], 34 | ) -------------------------------------------------------------------------------- /birdie_snapshots/no_shorthand_in_constructors.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: no_shorthand_in_constructors 4 | file: ./test/glance_test.gleam 5 | test_name: no_shorthand_in_constructors_test 6 | --- 7 | 8 | pub type Wibble { 9 | Wobble(int:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Error(UnexpectedToken( 16 | RightParen, 17 | Position(32), 18 | )) -------------------------------------------------------------------------------- /birdie_snapshots/opaque.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: opaque 4 | file: ./test/glance_test.gleam 5 | test_name: opaque_test 6 | --- 7 | pub opaque type Box { 8 | Box() 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 35), 20 | "Box", 21 | Public, 22 | True, 23 | [], 24 | [Variant("Box", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/or.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: or 4 | file: ./test/glance_test.gleam 5 | test_name: or_test 6 | --- 7 | pub fn main() { 8 | x || y 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 26), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(BinaryOperator( 29 | Span(18, 24), 30 | Or, 31 | Variable(Span(18, 19), "x"), 32 | Variable(Span(23, 24), "y"), 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/panic_as.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: panic_as 4 | file: ./test/glance_test.gleam 5 | test_name: panic_as_test 6 | --- 7 | pub fn main() { 8 | panic as "oh no" 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 36), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(Panic( 29 | Span(18, 34), 30 | Some(String( 31 | Span(27, 34), 32 | "oh no", 33 | )), 34 | )), 35 | ], 36 | ), 37 | ), 38 | ], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/panic_as_block.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: panic_as_block 4 | file: ./test/glance_test.gleam 5 | test_name: panic_as_block_test 6 | --- 7 | pub fn main() { 8 | panic as { "oh no" } 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 40), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(Panic( 29 | Span(18, 38), 30 | Some(Block( 31 | Span(27, 38), 32 | [ 33 | Expression(String( 34 | Span(29, 36), 35 | "oh no", 36 | )), 37 | ], 38 | )), 39 | )), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/panic_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: panic_location 4 | file: ./test/glance_test.gleam 5 | test_name: panic_location_test 6 | --- 7 | 8 | pub fn main() { 9 | panic 10 | ▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/panic_message_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: panic_message_location 4 | file: ./test/glance_test.gleam 5 | test_name: panic_message_location_test 6 | --- 7 | 8 | pub fn main() { 9 | panic as "Crash" 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/pattern_shorthand.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: pattern_shorthand 4 | file: ./test/glance_test.gleam 5 | test_name: pattern_shorthand_test 6 | --- 7 | 8 | pub fn wibble() { 9 | case wobble { 10 | Wabble(field:) -> field 11 | } 12 | } 13 | 14 | 15 | --------------------------- 16 | 17 | Module( 18 | [], 19 | [], 20 | [], 21 | [], 22 | [ 23 | Definition( 24 | [], 25 | Function( 26 | Span(1, 68), 27 | "wibble", 28 | Public, 29 | [], 30 | None, 31 | [ 32 | Expression(Case( 33 | Span(21, 66), 34 | [ 35 | Variable( 36 | Span(26, 32), 37 | "wobble", 38 | ), 39 | ], 40 | [ 41 | Clause( 42 | [ 43 | [ 44 | PatternVariant( 45 | Span(39, 53), 46 | None, 47 | "Wabble", 48 | [ 49 | ShorthandField("field"), 50 | ], 51 | False, 52 | ), 53 | ], 54 | ], 55 | None, 56 | Variable( 57 | Span(57, 62), 58 | "field", 59 | ), 60 | ), 61 | ], 62 | )), 63 | ], 64 | ), 65 | ), 66 | ], 67 | ) -------------------------------------------------------------------------------- /birdie_snapshots/phantom.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: phantom 4 | file: ./test/glance_test.gleam 5 | test_name: phantom_test 6 | --- 7 | pub type Spooky(t) { 8 | Spooky 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 35), 20 | "Spooky", 21 | Public, 22 | False, 23 | ["t"], 24 | [Variant("Spooky", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/phantom_multiple.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: phantom_multiple 4 | file: ./test/glance_test.gleam 5 | test_name: phantom_multiple_test 6 | --- 7 | pub type Spooky(t, u) { 8 | Spooky 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 38), 20 | "Spooky", 21 | Public, 22 | False, 23 | ["t", "u"], 24 | [Variant("Spooky", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/phantom_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: phantom_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: phantom_trailing_comma_test 6 | --- 7 | pub type Spooky(t, u, ) { 8 | Spooky 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 40), 20 | "Spooky", 21 | Public, 22 | False, 23 | ["t", "u"], 24 | [Variant("Spooky", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/pipe.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: pipe 4 | file: ./test/glance_test.gleam 5 | test_name: pipe_test 6 | --- 7 | pub fn main() { x |> y(1) |> z(2, 3) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 38), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(BinaryOperator( 27 | Span(16, 36), 28 | Pipe, 29 | BinaryOperator( 30 | Span(16, 25), 31 | Pipe, 32 | Variable( 33 | Span(16, 17), 34 | "x", 35 | ), 36 | Call( 37 | Span(21, 25), 38 | Variable( 39 | Span(21, 22), 40 | "y", 41 | ), 42 | [ 43 | UnlabelledField(Int( 44 | Span(23, 24), 45 | "1", 46 | )), 47 | ], 48 | ), 49 | ), 50 | Call( 51 | Span(29, 36), 52 | Variable( 53 | Span(29, 30), 54 | "z", 55 | ), 56 | [ 57 | UnlabelledField(Int( 58 | Span(31, 32), 59 | "2", 60 | )), 61 | UnlabelledField(Int( 62 | Span(34, 35), 63 | "3", 64 | )), 65 | ], 66 | ), 67 | )), 68 | ], 69 | ), 70 | ), 71 | ], 72 | ) -------------------------------------------------------------------------------- /birdie_snapshots/private_enum.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: private_enum 4 | file: ./test/glance_test.gleam 5 | test_name: private_enum_test 6 | --- 7 | type Cardinal { 8 | North East South West 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 45), 20 | "Cardinal", 21 | Private, 22 | False, 23 | [], 24 | [ 25 | Variant("North", [], []), 26 | Variant("East", [], []), 27 | Variant("South", [], []), 28 | Variant("West", [], []), 29 | ], 30 | ), 31 | ), 32 | ], 33 | [], 34 | [], 35 | [], 36 | ) -------------------------------------------------------------------------------- /birdie_snapshots/private_function_main.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: private_function_main 4 | file: ./test/glance_test.gleam 5 | test_name: private_function_main_test 6 | --- 7 | fn main() {} 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 12), 21 | "main", 22 | Private, 23 | [], 24 | None, 25 | [], 26 | ), 27 | ), 28 | ], 29 | ) -------------------------------------------------------------------------------- /birdie_snapshots/public_constant_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: public_constant_location 4 | file: ./test/glance_test.gleam 5 | test_name: public_constant_location_test 6 | --- 7 | 8 | pub const pi = 3.14 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/public_enum.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: public_enum 4 | file: ./test/glance_test.gleam 5 | test_name: public_enum_test 6 | --- 7 | // comment 8 | pub type Cardinal { 9 | North East South West 10 | } 11 | 12 | --------------------------- 13 | 14 | Module( 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | CustomType( 20 | Span(13, 62), 21 | "Cardinal", 22 | Public, 23 | False, 24 | [], 25 | [ 26 | Variant("North", [], []), 27 | Variant("East", [], []), 28 | Variant("South", [], []), 29 | Variant("West", [], []), 30 | ], 31 | ), 32 | ), 33 | ], 34 | [], 35 | [], 36 | [], 37 | ) -------------------------------------------------------------------------------- /birdie_snapshots/public_external_type_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: public_external_type_location 4 | file: ./test/glance_test.gleam 5 | test_name: public_external_type_location_test 6 | --- 7 | 8 | pub type Wibble 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/public_function_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: public_function_location 4 | file: ./test/glance_test.gleam 5 | test_name: public_function_location_test 6 | --- 7 | 8 | pub fn wibble(x) { x } 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/public_type_alias_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: public_type_alias_location 4 | file: ./test/glance_test.gleam 5 | test_name: public_type_alias_location_test 6 | --- 7 | 8 | pub type Wibble = Wobble 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/record_partial_destructure_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_partial_destructure_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: record_partial_destructure_trailing_comma_test 6 | --- 7 | pub fn main(x) { let Wibble(y, ..,) = x } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 41), 21 | "main", 22 | Public, 23 | [ 24 | FunctionParameter( 25 | None, 26 | Named("x"), 27 | None, 28 | ), 29 | ], 30 | None, 31 | [ 32 | Assignment( 33 | Span(17, 39), 34 | Let, 35 | PatternVariant( 36 | Span(21, 35), 37 | None, 38 | "Wibble", 39 | [ 40 | UnlabelledField(PatternVariable( 41 | Span(28, 29), 42 | "y", 43 | )), 44 | ], 45 | True, 46 | ), 47 | None, 48 | Variable(Span(38, 39), "x"), 49 | ), 50 | ], 51 | ), 52 | ), 53 | ], 54 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_shorthand.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_shorthand 4 | file: ./test/glance_test.gleam 5 | test_name: record_shorthand_test 6 | --- 7 | 8 | pub fn wibble() { 9 | Wobble(field:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 37), 25 | "wibble", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(Call( 31 | Span(21, 35), 32 | Variable( 33 | Span(21, 27), 34 | "Wobble", 35 | ), 36 | [ShorthandField("field")], 37 | )), 38 | ], 39 | ), 40 | ), 41 | ], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_update.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_test 6 | --- 7 | pub fn main() { Wibble(..wibble, one: 1, two: 2) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 50), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(RecordUpdate( 27 | Span(16, 48), 28 | None, 29 | "Wibble", 30 | Variable( 31 | Span(25, 31), 32 | "wibble", 33 | ), 34 | [ 35 | RecordUpdateField( 36 | "one", 37 | Some(Int( 38 | Span(38, 39), 39 | "1", 40 | )), 41 | ), 42 | RecordUpdateField( 43 | "two", 44 | Some(Int( 45 | Span(46, 47), 46 | "2", 47 | )), 48 | ), 49 | ], 50 | )), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_update_empty.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update_empty 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_empty_test 6 | --- 7 | pub fn main() { Wibble(..wibble) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 34), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(RecordUpdate( 27 | Span(16, 32), 28 | None, 29 | "Wibble", 30 | Variable( 31 | Span(25, 31), 32 | "wibble", 33 | ), 34 | [], 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_update_empty_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update_empty_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_empty_trailing_comma_test 6 | --- 7 | pub fn main() { Wibble(..wibble,) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 35), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(RecordUpdate( 27 | Span(16, 33), 28 | None, 29 | "Wibble", 30 | Variable( 31 | Span(25, 31), 32 | "wibble", 33 | ), 34 | [], 35 | )), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_update_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update_location 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_location_test 6 | --- 7 | 8 | pub fn main() { 9 | Wibble(..w, wobble: 4) 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/record_update_qualified.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update_qualified 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_qualified_test 6 | --- 7 | pub fn main() { wobble.Wibble(..wibble, one: 1, two: 2) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 57), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(RecordUpdate( 27 | Span(16, 55), 28 | Some("wobble"), 29 | "Wibble", 30 | Variable( 31 | Span(32, 38), 32 | "wibble", 33 | ), 34 | [ 35 | RecordUpdateField( 36 | "one", 37 | Some(Int( 38 | Span(45, 46), 39 | "1", 40 | )), 41 | ), 42 | RecordUpdateField( 43 | "two", 44 | Some(Int( 45 | Span(53, 54), 46 | "2", 47 | )), 48 | ), 49 | ], 50 | )), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_update_shorthand.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update_shorthand 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_shorthand_test 6 | --- 7 | 8 | pub fn wibble() { 9 | Wobble(..wabble, field:) 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 47), 25 | "wibble", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Expression(RecordUpdate( 31 | Span(21, 45), 32 | None, 33 | "Wobble", 34 | Variable( 35 | Span(30, 36), 36 | "wabble", 37 | ), 38 | [ 39 | RecordUpdateField( 40 | "field", 41 | None, 42 | ), 43 | ], 44 | )), 45 | ], 46 | ), 47 | ), 48 | ], 49 | ) -------------------------------------------------------------------------------- /birdie_snapshots/record_update_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: record_update_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: record_update_trailing_comma_test 6 | --- 7 | pub fn main() { Wibble(..wibble, one: 1, two: 2,) } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 51), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(RecordUpdate( 27 | Span(16, 49), 28 | None, 29 | "Wibble", 30 | Variable( 31 | Span(25, 31), 32 | "wibble", 33 | ), 34 | [ 35 | RecordUpdateField( 36 | "one", 37 | Some(Int( 38 | Span(38, 39), 39 | "1", 40 | )), 41 | ), 42 | RecordUpdateField( 43 | "two", 44 | Some(Int( 45 | Span(46, 47), 46 | "2", 47 | )), 48 | ), 49 | ], 50 | )), 51 | ], 52 | ), 53 | ), 54 | ], 55 | ) -------------------------------------------------------------------------------- /birdie_snapshots/string_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: string_location 4 | file: ./test/glance_test.gleam 5 | test_name: string_location_test 6 | --- 7 | 8 | pub fn main() { 9 | "Hello, world!" 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/string_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: string_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: string_pattern_test 6 | --- 7 | pub fn main() { let "123" = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 31), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 29), 28 | Let, 29 | PatternString( 30 | Span(20, 25), 31 | "123", 32 | ), 33 | None, 34 | Int(Span(28, 29), "1"), 35 | ), 36 | ], 37 | ), 38 | ), 39 | ], 40 | ) -------------------------------------------------------------------------------- /birdie_snapshots/string_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: string_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: string_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let "Some string" = todo 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/todo_as.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: todo_as 4 | file: ./test/glance_test.gleam 5 | test_name: todo_as_test 6 | --- 7 | pub fn main() { 8 | todo as "oh no" 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 35), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(Todo( 29 | Span(18, 33), 30 | Some(String( 31 | Span(26, 33), 32 | "oh no", 33 | )), 34 | )), 35 | ], 36 | ), 37 | ), 38 | ], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/todo_as_block.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: todo_as_block 4 | file: ./test/glance_test.gleam 5 | test_name: todo_as_block_test 6 | --- 7 | pub fn main() { 8 | todo as { "oh no" } 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [], 16 | [], 17 | [], 18 | [ 19 | Definition( 20 | [], 21 | Function( 22 | Span(0, 39), 23 | "main", 24 | Public, 25 | [], 26 | None, 27 | [ 28 | Expression(Todo( 29 | Span(18, 37), 30 | Some(Block( 31 | Span(26, 37), 32 | [ 33 | Expression(String( 34 | Span(28, 35), 35 | "oh no", 36 | )), 37 | ], 38 | )), 39 | )), 40 | ], 41 | ), 42 | ), 43 | ], 44 | ) -------------------------------------------------------------------------------- /birdie_snapshots/todo_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: todo_location 4 | file: ./test/glance_test.gleam 5 | test_name: todo_location_test 6 | --- 7 | 8 | pub fn main() { 9 | todo 10 | ▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/todo_message_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: todo_message_location 4 | file: ./test/glance_test.gleam 5 | test_name: todo_message_location_test 6 | --- 7 | 8 | pub fn main() { 9 | todo as "Not implemented" 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/trailing_comma_in_parameters.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: trailing_comma_in_parameters 4 | file: ./test/glance_test.gleam 5 | test_name: trailing_comma_in_parameters_test 6 | --- 7 | pub type Box(x, ) { 8 | Box 9 | } 10 | 11 | --------------------------- 12 | 13 | Module( 14 | [], 15 | [ 16 | Definition( 17 | [], 18 | CustomType( 19 | Span(0, 31), 20 | "Box", 21 | Public, 22 | False, 23 | ["x"], 24 | [Variant("Box", [], [])], 25 | ), 26 | ), 27 | ], 28 | [], 29 | [], 30 | [], 31 | ) -------------------------------------------------------------------------------- /birdie_snapshots/tuple_index.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: tuple_index 4 | file: ./test/glance_test.gleam 5 | test_name: tuple_index_test 6 | --- 7 | pub fn main() { wobble.12 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 27), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Expression(TupleIndex( 27 | Span(16, 25), 28 | Variable( 29 | Span(16, 22), 30 | "wobble", 31 | ), 32 | 12, 33 | )), 34 | ], 35 | ), 36 | ), 37 | ], 38 | ) -------------------------------------------------------------------------------- /birdie_snapshots/tuple_index_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: tuple_index_location 4 | file: ./test/glance_test.gleam 5 | test_name: tuple_index_location_test 6 | --- 7 | 8 | pub fn main() { 9 | some_tuple.42 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/tuple_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: tuple_location 4 | file: ./test/glance_test.gleam 5 | test_name: tuple_location_test 6 | --- 7 | 8 | pub fn main() { 9 | #(1, 2, True) 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/tuple_pattern.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: tuple_pattern 4 | file: ./test/glance_test.gleam 5 | test_name: tuple_pattern_test 6 | --- 7 | pub fn main() { let #(_, _) = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 33), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 31), 28 | Let, 29 | PatternTuple( 30 | Span(20, 27), 31 | [ 32 | PatternDiscard( 33 | Span(22, 23), 34 | "", 35 | ), 36 | PatternDiscard( 37 | Span(25, 26), 38 | "", 39 | ), 40 | ], 41 | ), 42 | None, 43 | Int(Span(30, 31), "1"), 44 | ), 45 | ], 46 | ), 47 | ), 48 | ], 49 | ) -------------------------------------------------------------------------------- /birdie_snapshots/tuple_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: tuple_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: tuple_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let #(a, b, 4) = todo 10 | ▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/tuple_pattern_trailing_comma.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: tuple_pattern_trailing_comma 4 | file: ./test/glance_test.gleam 5 | test_name: tuple_pattern_trailing_comma_test 6 | --- 7 | pub fn main() { let #(_, _,) = 1 } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 34), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Assignment( 27 | Span(16, 32), 28 | Let, 29 | PatternTuple( 30 | Span(20, 28), 31 | [ 32 | PatternDiscard( 33 | Span(22, 23), 34 | "", 35 | ), 36 | PatternDiscard( 37 | Span(25, 26), 38 | "", 39 | ), 40 | ], 41 | ), 42 | None, 43 | Int(Span(31, 32), "1"), 44 | ), 45 | ], 46 | ), 47 | ), 48 | ], 49 | ) -------------------------------------------------------------------------------- /birdie_snapshots/type_alias_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: type_alias_location 4 | file: ./test/glance_test.gleam 5 | test_name: type_alias_location_test 6 | --- 7 | 8 | type Wibble = Wobble 9 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 10 | -------------------------------------------------------------------------------- /birdie_snapshots/unqualified.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: unqualified 4 | file: ./test/glance_test.gleam 5 | test_name: unqualified_test 6 | --- 7 | import one/two/three.{One, Two, three, four} as four 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 52), 17 | "one/two/three", 18 | Some(Named("four")), 19 | [], 20 | [ 21 | UnqualifiedImport("One", None), 22 | UnqualifiedImport("Two", None), 23 | UnqualifiedImport( 24 | "three", 25 | None, 26 | ), 27 | UnqualifiedImport( 28 | "four", 29 | None, 30 | ), 31 | ], 32 | ), 33 | ), 34 | ], 35 | [], 36 | [], 37 | [], 38 | [], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/unqualified_aliased.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: unqualified_aliased 4 | file: ./test/glance_test.gleam 5 | test_name: unqualified_aliased_test 6 | --- 7 | import one/two/three.{One as Two, Three, four as five, six} as four 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 67), 17 | "one/two/three", 18 | Some(Named("four")), 19 | [], 20 | [ 21 | UnqualifiedImport( 22 | "One", 23 | Some("Two"), 24 | ), 25 | UnqualifiedImport( 26 | "Three", 27 | None, 28 | ), 29 | UnqualifiedImport( 30 | "four", 31 | Some("five"), 32 | ), 33 | UnqualifiedImport("six", None), 34 | ], 35 | ), 36 | ), 37 | ], 38 | [], 39 | [], 40 | [], 41 | [], 42 | ) -------------------------------------------------------------------------------- /birdie_snapshots/unqualified_type.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: unqualified_type 4 | file: ./test/glance_test.gleam 5 | test_name: unqualified_type_test 6 | --- 7 | import one/two/three.{type One, type Two, three, four, type Five as X, type Six as Y} as four 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [ 13 | Definition( 14 | [], 15 | Import( 16 | Span(0, 93), 17 | "one/two/three", 18 | Some(Named("four")), 19 | [ 20 | UnqualifiedImport("One", None), 21 | UnqualifiedImport("Two", None), 22 | UnqualifiedImport( 23 | "Five", 24 | Some("X"), 25 | ), 26 | UnqualifiedImport( 27 | "Six", 28 | Some("Y"), 29 | ), 30 | ], 31 | [ 32 | UnqualifiedImport( 33 | "three", 34 | None, 35 | ), 36 | UnqualifiedImport( 37 | "four", 38 | None, 39 | ), 40 | ], 41 | ), 42 | ), 43 | ], 44 | [], 45 | [], 46 | [], 47 | [], 48 | ) -------------------------------------------------------------------------------- /birdie_snapshots/use.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: use 4 | file: ./test/glance_test.gleam 5 | test_name: use_test 6 | --- 7 | pub fn main() { use x <- y } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 28), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Use( 27 | Span(16, 26), 28 | [ 29 | UsePattern( 30 | PatternVariable( 31 | Span(20, 21), 32 | "x", 33 | ), 34 | None, 35 | ), 36 | ], 37 | Variable(Span(25, 26), "y"), 38 | ), 39 | ], 40 | ), 41 | ), 42 | ], 43 | ) -------------------------------------------------------------------------------- /birdie_snapshots/use_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: use_location 4 | file: ./test/glance_test.gleam 5 | test_name: use_location_test 6 | --- 7 | 8 | pub fn main() { 9 | use x <- result.try(something) 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/use_multiple.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: use_multiple 4 | file: ./test/glance_test.gleam 5 | test_name: use_multiple_test 6 | --- 7 | pub fn main() { use x, y, z <- f } 8 | 9 | --------------------------- 10 | 11 | Module( 12 | [], 13 | [], 14 | [], 15 | [], 16 | [ 17 | Definition( 18 | [], 19 | Function( 20 | Span(0, 34), 21 | "main", 22 | Public, 23 | [], 24 | None, 25 | [ 26 | Use( 27 | Span(16, 32), 28 | [ 29 | UsePattern( 30 | PatternVariable( 31 | Span(20, 21), 32 | "x", 33 | ), 34 | None, 35 | ), 36 | UsePattern( 37 | PatternVariable( 38 | Span(23, 24), 39 | "y", 40 | ), 41 | None, 42 | ), 43 | UsePattern( 44 | PatternVariable( 45 | Span(26, 27), 46 | "z", 47 | ), 48 | None, 49 | ), 50 | ], 51 | Variable(Span(31, 32), "f"), 52 | ), 53 | ], 54 | ), 55 | ), 56 | ], 57 | ) -------------------------------------------------------------------------------- /birdie_snapshots/use_none.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: use_none 4 | file: ./test/glance_test.gleam 5 | test_name: use_none_test 6 | --- 7 | 8 | pub fn main() { 9 | use <- x 10 | } 11 | 12 | 13 | --------------------------- 14 | 15 | Module( 16 | [], 17 | [], 18 | [], 19 | [], 20 | [ 21 | Definition( 22 | [], 23 | Function( 24 | Span(1, 29), 25 | "main", 26 | Public, 27 | [], 28 | None, 29 | [ 30 | Use( 31 | Span(19, 27), 32 | [], 33 | Variable(Span(26, 27), "x"), 34 | ), 35 | ], 36 | ), 37 | ), 38 | ], 39 | ) -------------------------------------------------------------------------------- /birdie_snapshots/use_with_annotations.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: use_with_annotations 4 | file: ./test/glance_test.gleam 5 | test_name: use_with_annotations_test 6 | --- 7 | 8 | fn x() { 9 | use x: Int <- todo 10 | todo 11 | } 12 | 13 | 14 | --------------------------- 15 | 16 | Module( 17 | [], 18 | [], 19 | [], 20 | [], 21 | [ 22 | Definition( 23 | [], 24 | Function( 25 | Span(1, 39), 26 | "x", 27 | Private, 28 | [], 29 | None, 30 | [ 31 | Use( 32 | Span(12, 30), 33 | [ 34 | UsePattern( 35 | PatternVariable( 36 | Span(16, 17), 37 | "x", 38 | ), 39 | Some(NamedType( 40 | Span(19, 22), 41 | "Int", 42 | None, 43 | [], 44 | )), 45 | ), 46 | ], 47 | Todo(Span(26, 30), None), 48 | ), 49 | Expression(Todo( 50 | Span(33, 37), 51 | None, 52 | )), 53 | ], 54 | ), 55 | ), 56 | ], 57 | ) -------------------------------------------------------------------------------- /birdie_snapshots/variable_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: variable_location 4 | file: ./test/glance_test.gleam 5 | test_name: variable_location_test 6 | --- 7 | 8 | pub fn main() { 9 | some_variable 10 | ▔▔▔▔▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/variable_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: variable_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: variable_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let something = todo 10 | ▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /birdie_snapshots/variant_pattern_location.accepted: -------------------------------------------------------------------------------- 1 | --- 2 | version: 1.2.7 3 | title: variant_pattern_location 4 | file: ./test/glance_test.gleam 5 | test_name: variant_pattern_location_test 6 | --- 7 | 8 | pub fn main() { 9 | let Something = todo 10 | ▔▔▔▔▔▔▔▔▔ 11 | } 12 | -------------------------------------------------------------------------------- /gleam.toml: -------------------------------------------------------------------------------- 1 | name = "glance" 2 | version = "5.0.0" 3 | description = "A Gleam source code parser, in Gleam!" 4 | gleam = ">= 1.7.0" 5 | 6 | licences = ["Apache-2.0"] 7 | repository = { type = "github", user = "lpil", repo = "glance" } 8 | links = [ 9 | { title = "Website", href = "https://gleam.run" }, 10 | { title = "Sponsor", href = "https://github.com/sponsors/lpil" }, 11 | ] 12 | 13 | [dependencies] 14 | gleam_stdlib = ">= 0.28.0 and < 2.0.0" 15 | glexer = ">= 2.0.0 and < 3.0.0" 16 | 17 | [dev-dependencies] 18 | gleeunit = "~> 1.0" 19 | pprint = ">= 1.0.4 and < 2.0.0" 20 | 21 | # Birdie deps 22 | justin = ">= 1.0.1 and < 2.0.0" 23 | gleam_community_ansi = ">= 1.4.0 and < 2.0.0" 24 | argv = ">= 1.0.2 and < 2.0.0" 25 | gleam_erlang = ">= 0.25.0 and < 1.0.0" 26 | rank = ">= 1.0.0 and < 2.0.0" 27 | filepath = ">= 1.1.0 and < 2.0.0" 28 | trie_again = ">= 1.1.2 and < 2.0.0" 29 | simplifile = ">= 2.2.0 and < 3.0.0" 30 | edit_distance = ">= 2.0.1 and < 3.0.0" 31 | term_size = ">= 1.0.1 and < 2.0.0" 32 | -------------------------------------------------------------------------------- /manifest.toml: -------------------------------------------------------------------------------- 1 | # This file was generated by Gleam 2 | # You typically do not need to edit this file 3 | 4 | packages = [ 5 | { name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" }, 6 | { name = "edit_distance", version = "2.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "edit_distance", source = "hex", outer_checksum = "A1E485C69A70210223E46E63985FA1008B8B2DDA9848B7897469171B29020C05" }, 7 | { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" }, 8 | { name = "glam", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glam", source = "hex", outer_checksum = "4932A2D139AB0389E149396407F89654928D7B815E212BB02F13C66F53B1BBA1" }, 9 | { name = "gleam_community_ansi", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "8A62AE9CC6EA65BEA630D95016D6C07E4F9973565FA3D0DE68DC4200D8E0DD27" }, 10 | { name = "gleam_community_colour", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "FDD6AC62C6EC8506C005949A4FCEF032038191D5EAAEC3C9A203CD53AE956ACA" }, 11 | { name = "gleam_erlang", version = "0.34.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "0C38F2A128BAA0CEF17C3000BD2097EB80634E239CE31A86400C4416A5D0FDCC" }, 12 | { name = "gleam_json", version = "2.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "C55C5C2B318533A8072D221C5E06E5A75711C129E420DD1CE463342106012E5D" }, 13 | { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" }, 14 | { name = "gleam_stdlib", version = "0.59.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "F8FEE9B35797301994B81AF75508CF87C328FE1585558B0FFD188DC2B32EAA95" }, 15 | { name = "gleeunit", version = "1.3.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "A7DD6C07B7DA49A6E28796058AA89E651D233B357D5607006D70619CD89DAAAB" }, 16 | { name = "glexer", version = "2.2.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "glexer", source = "hex", outer_checksum = "5C235CBDF4DA5203AD5EAB1D6D8B456ED8162C5424FE2309CFFB7EF438B7C269" }, 17 | { name = "justin", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "justin", source = "hex", outer_checksum = "7FA0C6DB78640C6DC5FBFD59BF3456009F3F8B485BF6825E97E1EB44E9A1E2CD" }, 18 | { name = "pprint", version = "1.0.5", build_tools = ["gleam"], requirements = ["glam", "gleam_stdlib"], otp_app = "pprint", source = "hex", outer_checksum = "B5328E55FB9EED3941F1648536FDBFA0D97B0C21D21A6625D726CCB22A36782E" }, 19 | { name = "rank", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "rank", source = "hex", outer_checksum = "5660E361F0E49CBB714CC57CC4C89C63415D8986F05B2DA0C719D5642FAD91C9" }, 20 | { name = "simplifile", version = "2.2.1", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "C88E0EE2D509F6D86EB55161D631657675AA7684DAB83822F7E59EB93D9A60E3" }, 21 | { name = "term_size", version = "1.0.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "term_size", source = "hex", outer_checksum = "D00BD2BC8FB3EBB7E6AE076F3F1FF2AC9D5ED1805F004D0896C784D06C6645F1" }, 22 | { name = "trie_again", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "trie_again", source = "hex", outer_checksum = "5B19176F52B1BD98831B57FDC97BD1F88C8A403D6D8C63471407E78598E27184" }, 23 | ] 24 | 25 | [requirements] 26 | argv = { version = ">= 1.0.2 and < 2.0.0" } 27 | edit_distance = { version = ">= 2.0.1 and < 3.0.0" } 28 | filepath = { version = ">= 1.1.0 and < 2.0.0" } 29 | gleam_community_ansi = { version = ">= 1.4.0 and < 2.0.0" } 30 | gleam_erlang = { version = ">= 0.25.0 and < 1.0.0" } 31 | gleam_stdlib = { version = ">= 0.28.0 and < 2.0.0" } 32 | gleeunit = { version = "~> 1.0" } 33 | glexer = { version = ">= 2.0.0 and < 3.0.0" } 34 | justin = { version = ">= 1.0.1 and < 2.0.0" } 35 | pprint = { version = ">= 1.0.4 and < 2.0.0" } 36 | rank = { version = ">= 1.0.0 and < 2.0.0" } 37 | simplifile = { version = ">= 2.2.0 and < 3.0.0" } 38 | term_size = { version = ">= 1.0.1 and < 2.0.0" } 39 | trie_again = { version = ">= 1.1.2 and < 2.0.0" } 40 | -------------------------------------------------------------------------------- /test/birdie/internal/diff.gleam: -------------------------------------------------------------------------------- 1 | import gleam/dict.{type Dict} 2 | import gleam/list 3 | import gleam/option.{type Option, None, Some} 4 | import gleam/string 5 | 6 | pub type DiffLine { 7 | DiffLine(number: Int, line: String, kind: DiffLineKind) 8 | } 9 | 10 | pub type DiffLineKind { 11 | Old 12 | New 13 | Shared 14 | } 15 | 16 | pub fn histogram(one, other) { 17 | let one_lines = string.split(one, on: "\n") 18 | let other_lines = string.split(other, on: "\n") 19 | let lcs = lcs(one_lines, other_lines) 20 | match_diff_lines([], lcs, 1, one_lines, 1, other_lines) 21 | } 22 | 23 | fn match_diff_lines( 24 | lines: List(DiffLine), 25 | lcs: List(String), 26 | line_one: Int, 27 | one: List(String), 28 | line_other: Int, 29 | other: List(String), 30 | ) -> List(DiffLine) { 31 | case lcs, one, other { 32 | // We drained all the lines, we can return the accumulator which was built 33 | // in reverse order. 34 | [], [], [] -> list.reverse(lines) 35 | 36 | // If we don't have any more lines in the common prefix we first drain all 37 | // the lines from the first list marking those as old. 38 | [], [first, ..one], other -> 39 | [DiffLine(line_one, first, Old), ..lines] 40 | |> match_diff_lines(lcs, line_one + 1, one, line_other, other) 41 | 42 | // If we've also drained the first list we finish by draining the other one 43 | // marking all its lines as new ones. 44 | [], [], [first, ..other] -> 45 | [DiffLine(line_other, first, New), ..lines] 46 | |> match_diff_lines(lcs, line_one, one, line_other + 1, other) 47 | 48 | // While the first list has lines that are not in common we add those 49 | // marking them as old. 50 | [first_common, ..], [first_one, ..one], other if first_common != first_one -> 51 | [DiffLine(line_one, first_one, Old), ..lines] 52 | |> match_diff_lines(lcs, line_one + 1, one, line_other, other) 53 | 54 | // While the second list has lines that are not in common we add those 55 | // marking them as new. 56 | [first_common, ..], one, [first_other, ..other] 57 | if first_common != first_other 58 | -> 59 | [DiffLine(line_other, first_other, New), ..lines] 60 | |> match_diff_lines(lcs, line_one, one, line_other + 1, other) 61 | 62 | [first_common, ..lcs], [_, ..one], [_, ..other] -> 63 | [DiffLine(line_other, first_common, Shared), ..lines] 64 | |> match_diff_lines(lcs, line_one + 1, one, line_other + 1, other) 65 | 66 | [_, ..], [], _ | [_, ..], _, [] -> panic as "unreachable" 67 | } 68 | } 69 | 70 | /// Find the least common subsequences of shared items between two lists. 71 | /// 72 | /// Reference: https://tiarkrompf.github.io/notes/?/diff-algorithm/ 73 | /// 74 | fn lcs(one: List(a), other: List(a)) -> List(a) { 75 | // The recursive definition is so intuitive and elegant, just please don't 76 | // look at how `lowest_occurrence_common_item` is defined. 77 | // 78 | // 1. We remove the common prefix and suffix from the lists. 79 | // 2. In the remaining lists we find the common element that appears in both 80 | // the list number of times. 81 | // 3. We recursively look for the `lcs` of the pieces that come before the 82 | // common element in both lists and the pieces that come after the common 83 | // element in both lists. 84 | // 4. We join the common prefix and suffix, `lcs`s and common item. 85 | 86 | let #(prefix, one, other) = pop_common_prefix(between: one, and: other) 87 | let #(suffix, one, other) = pop_common_suffix(between: one, and: other) 88 | 89 | // 💡 A possible optimisation could be using a cache and hit that before 90 | // calling this function. That might make things faster as well. 91 | case lowest_occurrence_common_item(one, other) { 92 | None -> list.flatten([prefix, suffix]) 93 | Some(#(item, _, before_a, after_a, before_b, after_b)) -> 94 | // 💡 A possible optimisation I want to look into is using bags (super 95 | // fast append only) and turn that into a list only after everything is 96 | // done. That way we could avoid always repeatedly appending lists. 97 | list.flatten([ 98 | prefix, 99 | lcs(list.reverse(before_a), list.reverse(before_b)), 100 | [item], 101 | lcs(after_a, after_b), 102 | suffix, 103 | ]) 104 | } 105 | } 106 | 107 | // --- HISTOGRAM --------------------------------------------------------------- 108 | 109 | type Occurs(a) { 110 | One(times: Int, before: List(a), after: List(a)) 111 | Other(times: Int, before: List(a), after: List(a)) 112 | Both( 113 | times: Int, 114 | before_one: List(a), 115 | after_one: List(a), 116 | before_other: List(a), 117 | after_other: List(a), 118 | ) 119 | } 120 | 121 | fn lowest_occurrence_common_item( 122 | between one: List(a), 123 | and other: List(a), 124 | ) -> Option(#(a, Int, List(a), List(a), List(a), List(a))) { 125 | let histogram = 126 | histogram_add(to: dict.new(), from: one, with: One, acc: []) 127 | |> histogram_add(from: other, with: Other, acc: []) 128 | 129 | use lowest, a, occurs <- dict.fold(over: histogram, from: None) 130 | case occurs { 131 | // We're only looking for items that appear in both. 132 | One(..) | Other(..) -> lowest 133 | Both(n, before_one, after_one, before_other, after_other) -> 134 | case lowest { 135 | None -> Some(#(a, n, before_one, after_one, before_other, after_other)) 136 | // We keep the one that appears the least, so we compare `n` and `m`, 137 | // that is the number of occurrences of the current lowest and the new 138 | // item. 139 | Some(#(_, m, _, _, _, _)) -> 140 | case m <= n { 141 | True -> lowest 142 | False -> 143 | #(a, n, before_one, after_one, before_other, after_other) 144 | |> Some 145 | } 146 | } 147 | } 148 | } 149 | 150 | fn histogram_add( 151 | to histogram: Dict(a, Occurs(a)), 152 | from list: List(a), 153 | with to_occurrence: fn(Int, List(a), List(a)) -> Occurs(a), 154 | acc reverse_prefix: List(a), 155 | ) -> Dict(a, Occurs(a)) { 156 | case list { 157 | [] -> histogram 158 | [first, ..rest] -> 159 | { 160 | use previous <- dict.upsert(in: histogram, update: first) 161 | let new_occurrence = to_occurrence(1, reverse_prefix, rest) 162 | case previous { 163 | Some(occurrence) -> sum_occurrences(occurrence, new_occurrence) 164 | None -> new_occurrence 165 | } 166 | } 167 | |> histogram_add(rest, to_occurrence, [first, ..reverse_prefix]) 168 | } 169 | } 170 | 171 | // This is not general purpose and only takes into accounts the particular cases 172 | // that might occur in the histogram building. In particular we first add all 173 | // the `One`s and then all the `Other`s. 174 | fn sum_occurrences(one: Occurs(a), other: Occurs(a)) -> Occurs(a) { 175 | case one, other { 176 | One(n, _, _), One(m, before, after) -> One(n + m, before, after) 177 | Other(n, _, _), Other(m, before, after) -> Other(n + m, before, after) 178 | 179 | One(n, before_one, after_one), Other(m, before_other, after_other) 180 | | Both(n, before_one, after_one, _, _), Other(m, before_other, after_other) 181 | -> Both(n + m, before_one, after_one, before_other, after_other) 182 | 183 | _, _ -> panic as "unreachable: sum_occurrences" 184 | } 185 | } 186 | 187 | // --- LIST UTILS -------------------------------------------------------------- 188 | 189 | /// Returns the common prefix between two lists, and the remaining lists after 190 | /// removing the common prefix from each one. 191 | /// 192 | fn pop_common_prefix( 193 | between one: List(a), 194 | and other: List(a), 195 | ) -> #(List(a), List(a), List(a)) { 196 | let #(reverse_prefix, one, other) = do_pop_common_prefix([], one, other) 197 | #(list.reverse(reverse_prefix), one, other) 198 | } 199 | 200 | fn do_pop_common_prefix( 201 | reverse_prefix: List(a), 202 | one: List(a), 203 | other: List(a), 204 | ) -> #(List(a), List(a), List(a)) { 205 | case one, other { 206 | [first_one, ..one], [first_other, ..other] if first_one == first_other -> 207 | do_pop_common_prefix([first_one, ..reverse_prefix], one, other) 208 | _, _ -> #(reverse_prefix, one, other) 209 | } 210 | } 211 | 212 | /// Returns the common suffix between two lists, and the remaining lists after 213 | /// removing the common suffix from each one. 214 | /// 215 | fn pop_common_suffix( 216 | between one: List(a), 217 | and other: List(a), 218 | ) -> #(List(a), List(a), List(a)) { 219 | let #(suffix, reverse_one, reverse_other) = 220 | do_pop_common_prefix([], list.reverse(one), list.reverse(other)) 221 | #(suffix, list.reverse(reverse_one), list.reverse(reverse_other)) 222 | } 223 | -------------------------------------------------------------------------------- /test/birdie/internal/project.gleam: -------------------------------------------------------------------------------- 1 | import filepath 2 | import simplifile.{type FileError} 3 | 4 | /// Returns the path to the project's root. 5 | /// 6 | /// > ⚠️ This assumes that this is only ever run inside a Gleam's project and 7 | /// > sooner or later it will reach a `gleam.toml` file. 8 | /// > Otherwise this will end up in an infinite loop, I think. 9 | /// 10 | pub fn find_root() -> Result(String, FileError) { 11 | do_find_root(".") 12 | } 13 | 14 | fn do_find_root(path: String) -> Result(String, FileError) { 15 | let manifest = filepath.join(path, "gleam.toml") 16 | case simplifile.is_file(manifest) { 17 | Ok(True) -> Ok(path) 18 | Ok(False) -> do_find_root(filepath.join(path, "..")) 19 | Error(reason) -> Error(reason) 20 | } 21 | } 22 | --------------------------------------------------------------------------------