1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-02 05:27:45 +00:00

feat: try parentheses heuristics

This commit is contained in:
Kevin Amado 2022-03-01 21:54:20 -05:00
parent 64509489fb
commit f04306e80e
17 changed files with 1944 additions and 1581 deletions

View file

@ -21,45 +21,15 @@ pub(crate) struct BuildCtx {
pub vertical: bool, pub vertical: bool,
} }
impl BuildCtx {
pub fn new(
force_wide: bool,
path: String,
pos_old: crate::position::Position,
vertical: bool,
) -> BuildCtx {
BuildCtx {
force_wide,
force_wide_success: true,
indentation: 0,
path,
pos_old,
vertical,
}
}
}
pub(crate) fn build( pub(crate) fn build(
build_ctx: &mut BuildCtx,
element: rnix::SyntaxElement, element: rnix::SyntaxElement,
force_wide: bool,
path: String,
vertical: bool,
) -> Option<rowan::GreenNode> { ) -> Option<rowan::GreenNode> {
let mut builder = rowan::GreenNodeBuilder::new(); let mut builder = rowan::GreenNodeBuilder::new();
let mut build_ctx = BuildCtx::new(
force_wide,
path,
crate::position::Position::default(),
vertical,
);
build_step( build_step(&mut builder, build_ctx, &crate::builder::Step::Format(element));
&mut builder,
&mut build_ctx,
&crate::builder::Step::Format(element),
);
if force_wide { if build_ctx.force_wide {
if build_ctx.force_wide_success { Some(builder.finish()) } else { None } if build_ctx.force_wide_success { Some(builder.finish()) } else { None }
} else { } else {
Some(builder.finish()) Some(builder.finish())
@ -266,10 +236,17 @@ fn format_wider(
} }
pub(crate) fn fits_in_single_line( pub(crate) fn fits_in_single_line(
build_ctx: &crate::builder::BuildCtx, build_ctx_old: &crate::builder::BuildCtx,
element: rnix::SyntaxElement, element: rnix::SyntaxElement,
) -> bool { ) -> bool {
build(element, true, build_ctx.path.clone(), false).is_some() let mut build_ctx = crate::builder::BuildCtx {
force_wide: true,
force_wide_success: true,
vertical: false,
..build_ctx_old.clone()
};
build(&mut build_ctx, element).is_some()
} }
pub(crate) fn make_isolated_token( pub(crate) fn make_isolated_token(

View file

@ -1,12 +1,10 @@
use std::collections::LinkedList; use std::collections::LinkedList;
#[derive(Debug)]
pub(crate) enum Trivia { pub(crate) enum Trivia {
Comment(String), Comment(String),
Newlines(usize), Newlines(usize),
} }
#[derive(Debug)]
pub(crate) struct Child { pub(crate) struct Child {
pub element: rnix::SyntaxElement, pub element: rnix::SyntaxElement,

View file

@ -19,7 +19,16 @@ pub fn in_memory(path: String, before: String) -> (Status, String) {
return (Status::Error(errors[0].to_string()), before); return (Status::Error(errors[0].to_string()), before);
} }
let after = crate::builder::build(ast.node().into(), false, path, true) let mut build_ctx = crate::builder::BuildCtx {
force_wide: false,
force_wide_success: true,
indentation: 0,
path,
pos_old: crate::position::Position::default(),
vertical: true,
};
let after = crate::builder::build(&mut build_ctx, ast.node().into())
.unwrap() .unwrap()
.to_string(); .to_string();

View file

@ -1,13 +1,13 @@
use std::collections::LinkedList; use std::collections::LinkedList;
#[derive(Debug, Default)] #[derive(Default)]
pub(crate) struct Argument { pub(crate) struct Argument {
pub comments_before: LinkedList<String>, pub comments_before: LinkedList<String>,
pub item: Option<rnix::SyntaxElement>, pub item: Option<rnix::SyntaxElement>,
pub comment_after: Option<String>, pub comment_after: Option<String>,
} }
#[derive(Debug, Default)] #[derive(Default)]
pub(crate) struct Pattern { pub(crate) struct Pattern {
pub initial_at: Option<rnix::SyntaxElement>, pub initial_at: Option<rnix::SyntaxElement>,
pub comments_after_initial_at: LinkedList<String>, pub comments_after_initial_at: LinkedList<String>,

View file

@ -1,4 +1,4 @@
#[derive(Clone, Debug)] #[derive(Clone)]
pub(crate) struct Position { pub(crate) struct Position {
pub column: usize, pub column: usize,
pub line: usize, pub line: usize,

View file

@ -11,11 +11,28 @@ pub(crate) fn rule(
let closer = children.next().unwrap(); let closer = children.next().unwrap();
let vertical = opener.has_inline_comment let vertical = opener.has_inline_comment
|| opener.has_trivialities || opener.has_comments
|| expression.has_inline_comment || expression.has_inline_comment
|| expression.has_trivialities || expression.has_comments
|| closer.has_inline_comment || closer.has_inline_comment
|| closer.has_trivialities; || closer.has_comments
|| matches!(
expression.element.kind(),
rnix::SyntaxKind::NODE_IF_ELSE | rnix::SyntaxKind::NODE_LET_IN
)
|| (matches!(
expression.element.kind(),
rnix::SyntaxKind::NODE_APPLY
| rnix::SyntaxKind::NODE_ASSERT
| rnix::SyntaxKind::NODE_BIN_OP
| rnix::SyntaxKind::NODE_OR_DEFAULT
| rnix::SyntaxKind::NODE_LAMBDA
| rnix::SyntaxKind::NODE_SELECT
| rnix::SyntaxKind::NODE_WITH
) && second_through_penultimate_line_are_not_indented(
build_ctx,
expression.element.clone(),
));
// opener // opener
steps.push_back(crate::builder::Step::Format(opener.element)); steps.push_back(crate::builder::Step::Format(opener.element));
@ -77,3 +94,29 @@ pub(crate) fn rule(
steps steps
} }
fn second_through_penultimate_line_are_not_indented(
build_ctx: &crate::builder::BuildCtx,
element: rnix::SyntaxElement,
) -> bool {
let mut build_ctx =
crate::builder::BuildCtx { force_wide: false, ..build_ctx.clone() };
let formatted =
crate::builder::build(&mut build_ctx, element).unwrap().to_string();
let formatted_lines: Vec<&str> = formatted.split('\n').collect();
if formatted_lines.len() <= 2 {
return false;
}
let whitespace = format!("{0:<1$}", "", 2 * (build_ctx.indentation + 1));
formatted_lines
.iter()
.skip(1)
.rev()
.skip(1)
.any(|line| !line.is_empty() && !line.starts_with(&whitespace))
}

View file

@ -1,10 +1,12 @@
(a b) (a b)
(a b) (a b)
(a (
/* a
/*
b b
*/ */
c) c
)
( (
/* /*
a a

View file

@ -1,22 +1,29 @@
[ [
(assert b; e) (assert b; e)
(assert b; (
assert b;
/* /*
d d
*/ */
e) e
)
(assert b; e) (assert b; e)
(assert b; (
assert b;
/* /*
d d
*/ */
e) e
(assert )
(
assert
/* /*
a a
*/ */
b; e) b; e
(assert )
(
assert
/* /*
a a
*/ */
@ -24,13 +31,17 @@
/* /*
d d
*/ */
e) e
(assert )
(
assert
/* /*
a a
*/ */
b; e) b; e
(assert )
(
assert
/* /*
a a
*/ */
@ -38,7 +49,8 @@
/* /*
d d
*/ */
e) e
)
(assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc) (assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)
(assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc) (assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)
] ]

View file

@ -1,32 +1,45 @@
[ [
(1 + 1) (1 + 1)
(1 (
1
+ +
/**/ /**/
1) 1
(1 )
(
1
/**/ /**/
+ 1) + 1
(1 )
(
1
/**/ /**/
+ +
/**/ /**/
1) 1
(1 )
(
1
/**/ /**/
+ +
/**/ /**/
(1 (
1
/**/ /**/
+ +
/**/ /**/
(1 (
1
/**/ /**/
+ +
/**/ /**/
1))) 1
)
)
)
(1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1) (1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1)
(1 (
1
+ 1 + 1
+ 1 + 1
+ 1 + 1
@ -45,5 +58,6 @@
+ 1 + 1
+ 1 + 1
+ 1 + 1
+ 1) + 1
)
] ]

View file

@ -81,7 +81,8 @@
#7 #7
} }
(let (
let
# 1 # 1
#2 #2
a = 1; # 3 a = 1; # 3
@ -94,11 +95,14 @@
d = 1; d = 1;
#7 #7
in in
d) d
)
({ (
{
a, # comment a, # comment
b ? 2, # comment b ? 2, # comment
}: }:
_) _
)
] ]

View file

@ -1,22 +1,29 @@
[ [
(if true (
if true
then { then {
version = "1.2.3"; version = "1.2.3";
} }
else { else {
version = "3.2.1"; version = "3.2.1";
}) }
(if true )
(
if true
then '' then ''
some text some text
'' ''
else '' else ''
other text other text
'') ''
(if ./a )
(
if ./a
then b then b
else c) else c
(if )
(
if
/**/ /**/
a a
/**/ /**/
@ -26,14 +33,18 @@
/**/ /**/
else else
/**/ /**/
c) c
(if # test )
(
if # test
a # test a # test
then # test then # test
b # test b # test
else # test else # test
c) c
(if # test )
(
if # test
/**/ /**/
a # test a # test
/**/ /**/
@ -42,8 +53,10 @@
/**/ /**/
else # test else # test
/**/ /**/
c) c
(if )
(
if
if a if a
then b then b
else c else c
@ -52,8 +65,10 @@
then b then b
else if a else if a
then b then b
else c) else c
(if )
(
if
if a if a
then b then b
else c else c
@ -66,125 +81,206 @@
*/ */
if a if a
then b then b
else c) else c
(if )
(if (
(if if
(if a (
if
(
if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)) else c
)
)
then then
(if (
(if a if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)) else c
)
)
else else
(if (
(if a if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c))) else c
)
)
)
then then
(if (
(if if
(if a (
if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)) else c
)
)
then then
(if (
(if a if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)) else c
)
)
else else
(if (
(if a if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c))) else c
)
)
)
else else
(if (
(if if
(if a (
if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)) else c
)
)
then then
(if (
(if a if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)) else c
)
)
else else
(if (
(if a if
(
if a
then b then b
else c) else c
)
then then
(if a (
if a
then b then b
else c) else c
)
else else
(if a (
if a
then b then b
else c)))) else c
)
)
)
)
] ]

View file

@ -1,32 +1,43 @@
[ [
(a: b: (
a: b:
/* /*
c c
*/ */
d) d
({}: b: )
(
{}: b:
/* /*
c c
*/ */
d) d
(a: {}: )
(
a: {}:
/* /*
c c
*/ */
d) d
)
(a: d) (a: d)
(a: (
a:
/* /*
c c
*/ */
d) d
(a )
(
a
/* /*
b b
*/ */
: :
d) d
(a )
(
a
/* /*
b b
*/ */
@ -34,18 +45,17 @@
/* /*
c c
*/ */
d) d
(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
) )
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
( (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa {
)
({
pkgs ? import ./.. {}, pkgs ? import ./.. {},
locationsXml, locationsXml,
}: }:
null) null
)
(a: b: c: {}: a: b: c: (a: b: c: {}: a: b: c:
a) a)
@ -53,19 +63,23 @@
# Stuff # Stuff
}) })
({pkgs, ...}: let (
{pkgs, ...}: let
in in
pkgs) pkgs
)
(a: {b, ...}: c: { (a: {b, ...}: c: {
# Stuff # Stuff
}) })
(a: { (
a: {
b, b,
c, c,
... ...
}: d: { }: d: {
# Stuff # Stuff
}) }
)
] ]

View file

@ -1,48 +1,68 @@
[ [
(a.b or c) (a.b or c)
(a.b (
a.b
or or
/**/ /**/
c) c
(a.b )
(
a.b
/**/ /**/
or c) or c
(a.b )
(
a.b
/**/ /**/
or or
/**/ /**/
c) c
(a.b )
(
a.b
/**/ /**/
or or
/**/ /**/
(a.b (
a.b
/**/ /**/
or or
/**/ /**/
(a.b (
a.b
/**/ /**/
or or
/**/ /**/
c))) c
(a.b )
)
)
(
a.b
/**/ /**/
or or
/**/ /**/
(a.b (
a.b
/**/ /**/
or or
/**/ /**/
(a.b (
a.b
/**/ /**/
or or
/**/ /**/
c))) c
)
)
)
(a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a) (a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a)
(a.a (
a.a
or a.a # test or a.a # test
or a.a # test or a.a # test
or # test or # test
a.a a.a
or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a) or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a or a.a
)
] ]

View file

@ -1,33 +1,45 @@
[ [
({} @ a: _) ({} @ a: _)
({} @ (
{} @
/**/ /**/
a: a:
_) _
({} )
(
{}
/**/ /**/
@ a: @ a:
_) _
({} )
(
{}
/**/ /**/
@ @
/**/ /**/
a: a:
_) _
)
(a @ {}: _) (a @ {}: _)
(a @ (
a @
/**/ /**/
{}: {}:
_) _
(a )
(
a
/**/ /**/
@ {}: @ {}:
_) _
(a )
(
a
/**/ /**/
@ @
/**/ /**/
{}: {}:
_) _
)
] ]

View file

@ -9,19 +9,24 @@
foo, foo,
bar, # Some comment bar, # Some comment
}: {}) }: {})
(a @ { (
a @ {
self, self,
gomod2nix, gomod2nix,
mach-nix, mach-nix,
}: }:
_) _
({ )
(
{
self, self,
gomod2nix, gomod2nix,
mach-nix, mach-nix,
} @ inp: } @ inp:
_) _
({ )
(
{
a ? [ a ? [
1 1
2 2
@ -31,38 +36,50 @@
# ... # ...
}, },
}: }:
_) _
)
({}: _) ({}: _)
({a}: _) ({a}: _)
({ (
{
/**/ /**/
}: }:
_) _
)
({...}: _) ({...}: _)
({ (
{
... ...
/**/ /**/
}: }:
_) _
({ )
(
{
/**/ /**/
... ...
}: }:
_) _
({ )
(
{
/**/ /**/
... ...
/**/ /**/
}: }:
_) _
)
({ (
{
b, b,
e, e,
... ...
}: }:
_) _
({ )
(
{
b, b,
e, e,
... ...
@ -70,8 +87,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
e, e,
/* /*
@ -79,8 +98,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
e, e,
/* /*
@ -91,8 +112,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
e, e,
/* /*
@ -100,8 +123,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
e, e,
/* /*
@ -112,8 +137,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
e, e,
/* /*
@ -124,8 +151,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
e, e,
/* /*
@ -139,8 +168,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -148,8 +179,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -160,8 +193,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -172,8 +207,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -187,8 +224,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -199,8 +238,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -214,8 +255,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -229,8 +272,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
d d
@ -247,8 +292,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -256,8 +303,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -268,8 +317,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -280,8 +331,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -295,8 +348,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -307,8 +362,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -322,8 +379,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -337,8 +396,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -355,8 +416,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -367,8 +430,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -382,8 +447,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -397,8 +464,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -415,8 +484,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -430,8 +501,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -448,8 +521,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -466,8 +541,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
b, b,
/* /*
c c
@ -487,8 +564,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -496,8 +575,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -508,8 +589,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -520,8 +603,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -535,8 +620,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -547,8 +634,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -562,8 +651,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -577,8 +668,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -595,8 +688,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -607,8 +702,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -622,8 +719,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -637,8 +736,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -655,8 +756,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -670,8 +773,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -688,8 +793,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -706,8 +813,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -727,8 +836,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -739,8 +850,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -754,8 +867,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -769,8 +884,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -787,8 +904,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -802,8 +921,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -820,8 +941,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -838,8 +961,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -859,8 +984,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -874,8 +1001,10 @@
e, e,
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -892,8 +1021,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -910,8 +1041,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -931,8 +1064,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -949,8 +1084,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -970,8 +1107,10 @@
h h
*/ */
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -991,8 +1130,10 @@
*/ */
... ...
}: }:
_) _
({ )
(
{
/* /*
a a
*/ */
@ -1015,10 +1156,12 @@
h h
*/ */
}: }:
_) _
)
({a ? null}: _) ({a ? null}: _)
({ (
{
/* /*
a a
*/ */
@ -1057,7 +1200,8 @@
h h
*/ */
}: }:
_) _
)
( (
{ {

View file

@ -1,19 +1,26 @@
[ [
(a.a) (a.a)
(a (
a
. .
/**/ /**/
a) a
(a )
(
a
/**/ /**/
.a) .a
(a )
(
a
/**/ /**/
. .
/**/ /**/
a) a
)
(a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a) (a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a)
(a (
a
.a .a
.a .a
.a .a
@ -51,5 +58,6 @@
.a .a
.a .a
.a .a
.a) .a
)
] ]

View file

@ -1,16 +1,21 @@
[ [
(with b; c) (with b; c)
(with b; (
with b;
/* /*
b b
*/ */
c) c
(with )
(
with
/* /*
a a
*/ */
b; c) b; c
(with )
(
with
/* /*
a a
*/ */
@ -18,7 +23,8 @@
/* /*
b b
*/ */
c) c
)
(with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc) (with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)
(with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc) (with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc)
{a = with b; 1;} {a = with b; 1;}
@ -41,13 +47,16 @@
# comment # comment
} }
(with a; with b; with c; {a = 1;}) (with a; with b; with c; {a = 1;})
(with a; (
with a;
with b; with b;
with c; { with c; {
a = 1; a = 1;
b = 2; b = 2;
}) }
(with a; )
(
with a;
/* /*
comment comment
*/ */
@ -55,7 +64,8 @@
with c; { with c; {
a = 1; a = 1;
b = 2; b = 2;
}) }
)
{ {
a = with b; with b; with b; 1; a = with b; with b; with b; 1;
} }