Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP nix #771

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

WIP nix #771

wants to merge 1 commit into from

Conversation

domenkozar
Copy link

Couldn't figure out why tree-parser for Nix doesn't work:

echo "1" | ./target/debug/topiary format -l nix
[2024-10-17T16:21:07Z ERROR topiary] Nickel error: ImportError(ParseErrors(ParseErrors { errors: [UnexpectedToken(RawSpan { src_id: FileId(1), start: ByteIndex(506), end: ByteIndex(507) }, ["\"!\"", "\"\\\"\"", "\"'\\\"\"", "\"(\"", "\"-\"", "\"Array\"", "\"Bool\"", "\"Dyn\"", "\"Number\"", "\"String\"", "\"[\"", "\"[|\"", "\"_\"", "\"array/at\"", "\"array/generate\"", "\"array/length\"", "\"array/map\"", "\"array/slice\"", "\"bin num literal\"", "\"blame\"", "\"contract/apply\"", "\"contract/array_lazy_app\"", "\"contract/record_lazy_app\"", "\"dec num literal\"", "\"deep_seq\"", "\"deserialize\"", "\"enum/embed\"", "\"enum/from_string\"", "\"enum/get_arg\"", "\"enum/get_tag\"", "\"enum/is_variant\"", "\"enum/make_variant\"", "\"eval_nix\"", "\"false\"", "\"forall\"", "\"hash\"", "\"hex num literal\"", "\"identifier\"", "\"label/append_note\"", "\"label/flip_polarity\"", "\"label/go_array\"", "\"label/go_codom\"", "\"label/go_dict\"", "\"label/go_dom\"", "\"label/go_field\"", "\"label/insert_type_variable\"", "\"label/lookup_type_variable\"", "\"label/polarity\"", "\"label/push_diag\"", "\"label/with_message\"", "\"label/with_notes\"", "\"m%\\\"\"", "\"match\"", "\"null\"", "\"number/from_string\"", "\"oct num literal\"", "\"op force\"", "\"op rec_default\"", "\"op rec_force\"", "\"or\"", "\"pow\"", "\"raw enum tag\"", "\"record/empty_with_tail\"", "\"record/field_is_defined\"", "\"record/field_is_defined_with_opts\"", "\"record/fields\"", "\"record/fields_with_opts\"", "\"record/has_field\"", "\"record/has_field_with_opts\"", "\"record/insert\"", "\"record/insert_with_opts\"", "\"record/map\"", "\"record/remove\"", "\"record/remove_with_opts\"", "\"record/seal_tail\"", "\"record/unseal_tail\"", "\"record/values\"", "\"seal\"", "\"seq\"", "\"serialize\"", "\"string/chars\"", "\"string/contains\"", "\"string/find\"", "\"string/find_all\"", "\"string/is_match\"", "\"string/length\"", "\"string/lowercase\"", "\"string/replace\"", "\"string/replace_regex\"", "\"string/split\"", "\"string/substr\"", "\"string/trim\"", "\"string/uppercase\"", "\"symbolic string start\"", "\"to_string\"", "\"trace\"", "\"true\"", "\"typeof\"", "\"unseal\"", "\"{\""])] }, Original(RawSpan { src_id: FileId(2), start: ByteIndex(0), end: ByteIndex(16) })))

@domenkozar domenkozar force-pushed the nix branch 2 times, most recently from 4bc7ec2 to 8266eb4 Compare October 17, 2024 17:00
@domenkozar
Copy link
Author

Thanks!

@yannham how about this:

[2024-10-17T17:03:14Z ERROR topiary] Error parsing query file
[2024-10-17T17:03:14Z ERROR topiary] Cause: QueryError { row: 40, column: 4, offset: 866, message: "    \"(\" @append_spaced_softline @append_indent_start\n    ^", kind: Structure }

@yannham
Copy link
Member

yannham commented Oct 17, 2024

It's strange. It seems that the formals node isn't recognized for some reason, or not expected here (If I replace the offending line with formals: (_ then it works, or rather this precise error disappears) but looking at the tree-sitter Nix grammar this should be valid at first sight. I need to run right now but I'll give it a second look tomorrow.

@domenkozar
Copy link
Author

Alright it does run now, but it needs work on the formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants