difftreelog
fix(rowan-parser) handle unhidden fields
in: master
4 files changed
crates/jrsonnet-formatter/src/snapshots/jrsonnet_formatter__tests__snapshots@basic_object.jsonnet.snapdiffbeforeafterboth3expression: reformat(&input)3expression: reformat(&input)4input_file: crates/jrsonnet-formatter/src/tests/basic_object.jsonnet4input_file: crates/jrsonnet-formatter/src/tests/basic_object.jsonnet5---5---6{ foo: 'bar', baz: 'qux', nested: { a: 1, b: 2 } }6{ foo: 'bar', baz: 'qux', nested: { a: 1, b: 2 }, unhidden::: 1 }77crates/jrsonnet-formatter/src/tests/basic_object.jsonnetdiffbeforeafterboth1{ foo: 'bar', baz: 'qux', nested: { a: 1, b: 2 } }1{ foo: 'bar', baz: 'qux', nested: { a: 1, b: 2 }, unhidden::: 1 }22crates/jrsonnet-rowan-parser/src/lib.rsdiffbeforeafterboth21pub use ast::{AstChildren, AstNode, AstToken};21pub use ast::{AstChildren, AstNode, AstToken};22pub use generated::{nodes, syntax_kinds::SyntaxKind};22pub use generated::{nodes, syntax_kinds::SyntaxKind};23pub use language::*;23pub use language::*;24pub use token_set::SyntaxKindSet;25pub use string_block::{collect_lexed_str_block, CollectStrBlock};24pub use string_block::{collect_lexed_str_block, CollectStrBlock};25pub use token_set::SyntaxKindSet;262627use self::{27use self::{28 ast::support,28 ast::support,crates/jrsonnet-rowan-parser/src/parser.rsdiffbeforeafterboth407 m.complete(p, FIELD_NAME_FIXED);407 m.complete(p, FIELD_NAME_FIXED);408 } else {408 } else {409 m.forget(p);409 m.forget(p);410 // ::: it split because in TS it is being handled as : ::410 p.error_with_recovery_set(TS![; : :: ::: '(']);411 p.error_with_recovery_set(TS![; : :: '('].with(T![:::]));411 }412 }412}413}413fn visibility(p: &mut Parser) {414fn visibility(p: &mut Parser) {415 // ::: it split because in TS it is being handled as : ::414 if p.at_ts(TS![: :: :::]) {416 if p.at_ts(TS![: ::].with(T![:::])) {415 p.bump();417 p.bump();416 } else {418 } else {417 p.error_with_recovery_set(TS![=]);419 p.error_with_recovery_set(TS![=]);471 visibility(p);473 visibility(p);472 expr(p);474 expr(p);473 true475 true476 // ::: it split because in TS it is being handled as : ::474 } else if p.at_ts(TS![: :: :::]) && p.nth_at(1, T![function]) {477 } else if p.at_ts(TS![: ::].with(T![:::])) && p.nth_at(1, T![function]) {475 visibility(p);478 visibility(p);476 p.bump_assert(T![function]);479 p.bump_assert(T![function]);477 params_desc(p);480 params_desc(p);