1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-08-01 04:57:44 +00:00

Merge pull request #52 from kamadorueda/kamadorueda

feat: apply without max-width
This commit is contained in:
Kevin Amado 2022-02-09 22:28:02 -05:00 committed by GitHub
commit 1cc586b32d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 714 additions and 446 deletions

View file

@ -4,61 +4,68 @@
fenix.url = "github:nix-community/fenix"; fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs"; fenix.inputs.nixpkgs.follows = "nixpkgs";
fenix.inputs.rust-analyzer-src.follows = "rustAnalyzer"; fenix.inputs.rust-analyzer-src.follows = "rustAnalyzer";
flakeCompat.url = github:edolstra/flake-compat; flakeCompat.url = github:edolstra/flake-compat;
flakeCompat.flake = false; flakeCompat.flake = false;
flakeUtils.url = "github:numtide/flake-utils"; flakeUtils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
rustAnalyzer.url = "github:rust-analyzer/rust-analyzer"; rustAnalyzer.url = "github:rust-analyzer/rust-analyzer";
rustAnalyzer.flake = false; rustAnalyzer.flake = false;
treefmt.url = "github:numtide/treefmt"; treefmt.url = "github:numtide/treefmt";
treefmt.inputs.flake-utils.follows = "flakeUtils"; treefmt.inputs.flake-utils.follows = "flakeUtils";
treefmt.inputs.nixpkgs.follows = "nixpkgs"; treefmt.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs: inputs.flakeUtils.lib.eachSystem [ "x86_64-darwin" "x86_64-linux" ] ( outputs = inputs:
system: let inputs.flakeUtils.lib.eachSystem [ "x86_64-darwin" "x86_64-linux" ] (
nixpkgs = import inputs.nixpkgs { inherit system; }; system: let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); nixpkgs = import inputs.nixpkgs { inherit system; };
treefmt = inputs.treefmt.defaultPackage.${system}; cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
fenix = inputs.fenix.packages.${system}; treefmt = inputs.treefmt.defaultPackage.${system};
fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; }; fenix = inputs.fenix.packages.${system};
in fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; };
{ in
checks.defaultPackage = inputs.self.defaultPackage.${system}; {
defaultApp = { checks.defaultPackage = inputs.self.defaultPackage.${system};
type = "app"; defaultApp = {
program = "${inputs.self.defaultPackage.${system}}/bin/alejandra"; type = "app";
}; program = "${inputs.self.defaultPackage.${system}}/bin/alejandra";
defaultPackage = fenixPlatform.buildRustPackage {
pname = cargoToml.package.name;
version =
let
commit = inputs.self.shortRev or "dirty";
date = inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
in
"${builtins.substring 0 8 date}_${commit}";
src = inputs.self.sourceInfo;
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = cargoToml.package.description;
homepage = "https://github.com/kamadorueda/alejandra";
license = nixpkgs.lib.licenses.unlicense;
maintainers = [ nixpkgs.lib.maintainers.kamadorueda ];
}; };
}; defaultPackage = fenixPlatform.buildRustPackage {
devShell = nixpkgs.mkShell { pname = cargoToml.package.name;
name = "Alejandra"; version =
packages = [ let
fenix.rust-analyzer commit = inputs.self.shortRev or "dirty";
fenix.latest.toolchain date =
nixpkgs.cargo-tarpaulin inputs.self.lastModifiedDate or inputs.self.lastModified or "19700101";
nixpkgs.jq in
nixpkgs.nodejs "${builtins.substring 0 8 date}_${commit}";
nixpkgs.nodePackages.prettier src = inputs.self.sourceInfo;
nixpkgs.nodePackages.prettier-plugin-toml cargoLock.lockFile = ./Cargo.lock;
nixpkgs.shfmt meta = {
treefmt description = cargoToml.package.description;
]; homepage = "https://github.com/kamadorueda/alejandra";
}; license = nixpkgs.lib.licenses.unlicense;
} maintainers = [ nixpkgs.lib.maintainers.kamadorueda ];
); };
};
devShell = nixpkgs.mkShell {
name = "Alejandra";
packages = [
fenix.rust-analyzer
fenix.latest.toolchain
nixpkgs.cargo-tarpaulin
nixpkgs.jq
nixpkgs.nodejs
nixpkgs.nodePackages.prettier
nixpkgs.nodePackages.prettier-plugin-toml
nixpkgs.shfmt
treefmt
];
};
}
);
} }

View file

@ -296,6 +296,7 @@ pub fn fits_in_single_line(
build_ctx: &crate::builder::BuildCtx, build_ctx: &crate::builder::BuildCtx,
node: rnix::SyntaxElement, node: rnix::SyntaxElement,
) -> bool { ) -> bool {
let line = build_ctx.pos_new.line;
let maybe_green_node = build( let maybe_green_node = build(
&build_ctx.config.with_layout(crate::config::Layout::Wide), &build_ctx.config.with_layout(crate::config::Layout::Wide),
node, node,
@ -304,10 +305,7 @@ pub fn fits_in_single_line(
); );
match maybe_green_node { match maybe_green_node {
Some(finished) => { Some(_) => build_ctx.pos_new.line == line,
build_ctx.pos_new.column + finished.to_string().chars().count()
<= build_ctx.config.max_width()
}
None => false, None => false,
} }
} }

View file

@ -133,31 +133,6 @@ impl Children {
}) })
} }
pub fn drain_newlines<F: FnMut(usize)>(&mut self, mut callback: F) {
let mut newlines = 0;
while let Some(child) = self.peek_next() {
match child.element.kind() {
rnix::SyntaxKind::TOKEN_WHITESPACE => {
newlines += child
.element
.into_token()
.unwrap()
.text()
.chars()
.filter(|c| *c == '\n')
.count();
self.move_next();
}
_ => {
break;
}
}
}
callback(newlines)
}
pub fn drain_comment<F: FnMut(String)>(&mut self, mut callback: F) { pub fn drain_comment<F: FnMut(String)>(&mut self, mut callback: F) {
if let Some(child) = self.peek_next() { if let Some(child) = self.peek_next() {
match child.element.kind() { match child.element.kind() {

View file

@ -8,14 +8,6 @@ pub fn parse(args: Vec<String>) -> clap::ArgMatches {
.short('d') .short('d')
.takes_value(false), .takes_value(false),
) )
.arg(
clap::Arg::new("max-width")
.default_value("80")
.help("How many characters per line to allow.")
.long("max-width")
.takes_value(true)
.value_name("CHARS"),
)
.arg( .arg(
clap::Arg::new("paths") clap::Arg::new("paths")
.help("Files or directories, or none to format stdin.") .help("Files or directories, or none to format stdin.")

View file

@ -6,14 +6,13 @@ pub enum Layout {
#[derive(Clone)] #[derive(Clone)]
pub struct Config { pub struct Config {
debug: bool, debug: bool,
layout: Layout, layout: Layout,
max_width: usize,
} }
impl Config { impl Config {
pub fn new() -> Config { pub fn new() -> Config {
Config { debug: false, layout: Layout::Tall, max_width: 80 } Config { debug: false, layout: Layout::Tall }
} }
pub fn debug(&self) -> bool { pub fn debug(&self) -> bool {
@ -24,19 +23,11 @@ impl Config {
&self.layout &self.layout
} }
pub fn max_width(&self) -> usize {
self.max_width
}
pub fn with_debug(&self, debug: bool) -> Config { pub fn with_debug(&self, debug: bool) -> Config {
Config { debug, layout: self.layout.clone(), max_width: self.max_width } Config { debug, layout: self.layout.clone() }
} }
pub fn with_layout(&self, layout: Layout) -> Config { pub fn with_layout(&self, layout: Layout) -> Config {
Config { debug: self.debug, layout, max_width: self.max_width } Config { debug: self.debug, layout }
}
pub fn with_max_width(&self, max_width: usize) -> Config {
Config { debug: self.debug, layout: self.layout.clone(), max_width }
} }
} }

View file

@ -5,12 +5,7 @@ fn main() -> std::io::Result<()> {
let matches = alejandra::cli::parse(std::env::args().collect()); let matches = alejandra::cli::parse(std::env::args().collect());
let debug: bool = matches.is_present("debug"); let debug: bool = matches.is_present("debug");
let max_width: usize = let config = alejandra::config::Config::new().with_debug(debug);
matches.value_of("max-width").unwrap().parse().unwrap();
let config = alejandra::config::Config::new()
.with_debug(debug)
.with_max_width(max_width);
match matches.values_of("paths") { match matches.values_of("paths") {
Some(paths) => { Some(paths) => {

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -24,10 +26,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
let child_prev = children.peek_prev().unwrap(); let child_prev = children.peek_prev().unwrap();
@ -36,7 +41,9 @@ pub fn rule(
let child = children.get_next().unwrap(); let child = children.get_next().unwrap();
match layout { match layout {
crate::config::Layout::Tall => { crate::config::Layout::Tall => {
if let rnix::SyntaxKind::TOKEN_COMMENT = child_prev.element.kind() { if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE = child_prev.element.kind()
{
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
} else if let rnix::SyntaxKind::NODE_ATTR_SET } else if let rnix::SyntaxKind::NODE_ATTR_SET

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -17,13 +19,17 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
@ -48,10 +54,13 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// expr // expr

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -36,10 +38,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// operator // operator
@ -53,13 +58,17 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -25,10 +27,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// expr // expr
@ -43,10 +48,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// } // }

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -24,10 +26,13 @@ pub fn rule(
loop { loop {
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let Some(child) = children.get_next() { if let Some(child) = children.get_next() {

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -25,7 +27,8 @@ pub fn rule(
} }
} }
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_next().unwrap().element.kind() children.peek_next().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
@ -33,28 +36,27 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// : // :
let child = children.get_next().unwrap(); let child = children.get_next().unwrap();
match layout { steps.push_back(crate::builder::Step::Format(child.element));
crate::config::Layout::Tall => {
steps.push_back(crate::builder::Step::FormatWider(child.element));
}
crate::config::Layout::Wide => {
steps.push_back(crate::builder::Step::Format(child.element));
}
}
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// c // c
@ -62,18 +64,56 @@ pub fn rule(
let child = children.get_next().unwrap(); let child = children.get_next().unwrap();
match layout { match layout {
crate::config::Layout::Tall => { crate::config::Layout::Tall => {
if is_pattern_type { if is_pattern_type
steps.push_back(crate::builder::Step::NewLine); || matches!(
steps.push_back(crate::builder::Step::Pad); child_prev.element.kind(),
} else if let rnix::SyntaxKind::TOKEN_COMMENT = rnix::SyntaxKind::TOKEN_COMMENT
child_prev.element.kind() | rnix::SyntaxKind::TOKEN_WHITESPACE
)
|| (matches!(
child.element.kind(),
rnix::SyntaxKind::NODE_LAMBDA
) && matches!(
child
.element
.clone()
.into_node()
.unwrap()
.children()
.next()
.unwrap()
.kind(),
rnix::SyntaxKind::NODE_PATTERN
))
|| !matches!(
child.element.kind(),
rnix::SyntaxKind::NODE_ATTR_SET
| rnix::SyntaxKind::NODE_PAREN
| rnix::SyntaxKind::NODE_LAMBDA
| rnix::SyntaxKind::NODE_LET_IN
| rnix::SyntaxKind::NODE_LIST
| rnix::SyntaxKind::NODE_LITERAL
| rnix::SyntaxKind::NODE_STRING
)
{ {
if build_ctx.pos_new.column > 1 {
steps.push_back(crate::builder::Step::Indent);
}
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::FormatWider(
child.element,
));
if build_ctx.pos_new.column > 1 {
steps.push_back(crate::builder::Step::Dedent);
}
} else { } else {
steps.push_back(crate::builder::Step::Whitespace); steps.push_back(crate::builder::Step::Whitespace);
steps.push_back(crate::builder::Step::FormatWider(
child.element,
));
} }
steps.push_back(crate::builder::Step::FormatWider(child.element));
} }
crate::config::Layout::Wide => { crate::config::Layout::Wide => {
steps.push_back(crate::builder::Step::Whitespace); steps.push_back(crate::builder::Step::Whitespace);

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -35,13 +37,17 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
@ -55,13 +61,17 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -23,10 +25,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// expr // expr
@ -43,10 +48,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// ) // )

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -23,13 +25,17 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -26,13 +28,17 @@ pub fn rule(
if children.has_next() { if children.has_next() {
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
@ -46,13 +52,17 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);

View file

@ -4,7 +4,9 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let has_comments = children.has_comments(); let has_comments = children.has_comments();
let has_comments_between_curly_b = node let has_comments_between_curly_b = node
@ -26,7 +28,7 @@ pub fn rule(
}) })
.count(); .count();
let layout = if has_comments { let layout = if has_comments || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -55,10 +57,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// { // {
@ -79,6 +84,7 @@ pub fn rule(
if let rnix::SyntaxKind::TOKEN_COMMENT if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_ELLIPSIS | rnix::SyntaxKind::TOKEN_ELLIPSIS
| rnix::SyntaxKind::TOKEN_WHITESPACE
| rnix::SyntaxKind::NODE_PAT_ENTRY = prev_kind | rnix::SyntaxKind::NODE_PAT_ENTRY = prev_kind
{ {
steps.push_back(crate::builder::Step::Indent); steps.push_back(crate::builder::Step::Indent);
@ -94,6 +100,7 @@ pub fn rule(
| rnix::SyntaxKind::TOKEN_CURLY_B_OPEN | rnix::SyntaxKind::TOKEN_CURLY_B_OPEN
| rnix::SyntaxKind::TOKEN_COMMENT | rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_ELLIPSIS | rnix::SyntaxKind::TOKEN_ELLIPSIS
| rnix::SyntaxKind::TOKEN_WHITESPACE
| rnix::SyntaxKind::NODE_PAT_ENTRY = prev_kind | rnix::SyntaxKind::NODE_PAT_ENTRY = prev_kind
{ {
steps.push_back(crate::builder::Step::Dedent); steps.push_back(crate::builder::Step::Dedent);
@ -110,7 +117,9 @@ pub fn rule(
steps.push_back(crate::builder::Step::Whitespace); steps.push_back(crate::builder::Step::Whitespace);
} }
if let rnix::SyntaxKind::TOKEN_COMMENT = prev_kind { if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE = prev_kind
{
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Whitespace); steps.push_back(crate::builder::Step::Whitespace);
@ -143,6 +152,10 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
children.move_next(); children.move_next();
} }
// \n
rnix::SyntaxKind::TOKEN_WHITESPACE => {
children.move_next();
}
_ => { _ => {
break; break;
} }
@ -160,10 +173,13 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// @ x // @ x

View file

@ -4,18 +4,24 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
}; };
while children.has_next() { while children.has_next() {
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let Some(child) = children.get_next() { if let Some(child) = children.get_next() {

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -35,10 +37,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// . // .
@ -46,13 +51,17 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -25,10 +27,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::Comment(text)); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::Comment(text));
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Pad);
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// expr // expr
@ -43,10 +48,13 @@ pub fn rule(
} }
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// } // }

View file

@ -4,9 +4,11 @@ pub fn rule(
) -> std::collections::LinkedList<crate::builder::Step> { ) -> std::collections::LinkedList<crate::builder::Step> {
let mut steps = std::collections::LinkedList::new(); let mut steps = std::collections::LinkedList::new();
let mut children = crate::children::Children::new(build_ctx, node); let mut children = crate::children::Children::new_with_configuration(
build_ctx, node, true,
);
let layout = if children.has_comments() { let layout = if children.has_comments() || children.has_newlines() {
&crate::config::Layout::Tall &crate::config::Layout::Tall
} else { } else {
build_ctx.config.layout() build_ctx.config.layout()
@ -17,13 +19,17 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
if let rnix::SyntaxKind::TOKEN_COMMENT = if let rnix::SyntaxKind::TOKEN_COMMENT
| rnix::SyntaxKind::TOKEN_WHITESPACE =
children.peek_prev().unwrap().element.kind() children.peek_prev().unwrap().element.kind()
{ {
steps.push_back(crate::builder::Step::NewLine); steps.push_back(crate::builder::Step::NewLine);
@ -48,10 +54,13 @@ pub fn rule(
steps.push_back(crate::builder::Step::Format(child.element)); steps.push_back(crate::builder::Step::Format(child.element));
// /**/ // /**/
children.drain_comments(|text| { children.drain_comments_and_newlines(|element| match element {
steps.push_back(crate::builder::Step::NewLine); crate::children::DrainCommentOrNewline::Comment(text) => {
steps.push_back(crate::builder::Step::Pad); steps.push_back(crate::builder::Step::NewLine);
steps.push_back(crate::builder::Step::Comment(text)); steps.push_back(crate::builder::Step::Pad);
steps.push_back(crate::builder::Step::Comment(text));
}
crate::children::DrainCommentOrNewline::Newline(_) => {}
}); });
// expr // expr

View file

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

View file

@ -4,5 +4,6 @@
(assert /*a*/ b; c) (assert /*a*/ b; c)
(assert /*a*/ b; /*b*/ c) (assert /*a*/ b; /*b*/ c)
( assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ) ( assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
( assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ) ( assert b;
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
] ]

View file

@ -19,7 +19,12 @@
rec /*a*/ { /*b*/ c=1; } rec /*a*/ { /*b*/ c=1; }
rec /*a*/ { /*b*/ c=1; /*d*/ } rec /*a*/ { /*b*/ c=1; /*d*/ }
{a=rec {a={a=rec {a={a=rec {a={a=rec {a={a=rec {a={};};};};};};};};};};} {
a=rec {
a={
a=rec {
a={
a=rec {a={a=rec {a={a=rec {a={};};};};};};};};};};}
rec { rec {

View file

@ -5,5 +5,6 @@
(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) ( 1
+ 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1)
] ]

View file

@ -1,6 +1,8 @@
[ [
{ inherit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; } {
{ inherit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; } inherit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; }
{ inherit
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; }
{ inherit b d ; } { inherit b d ; }
{ inherit b d /*e*/ ; } { inherit b d /*e*/ ; }
{ inherit b /*c*/ d ; } { inherit b /*c*/ d ; }

View file

@ -85,21 +85,21 @@ rec
/* /*
b b
*/ */
{ b = 1; }; { b = 1; };
m = a: m = a:
/* /*
b b
*/ */
{ {
b = 1; b = 1;
c = 2; c = 2;
}; };
n = pkgs: { }; n = pkgs: { };
o = o =
{ pkgs { pkgs
, ... , ...
}: }:
{ }; { };
a a
/* /*
@ -116,5 +116,6 @@ rec
; ;
p = p =
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a; aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { }
a;
} }

View file

@ -9,6 +9,11 @@
( (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
) )
( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ) (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa )
({ pkgs ? import ./.. { }, locationsXml }: null) ({ pkgs ? import ./.. { }, locationsXml }: null)
(a: b: c:
{ }:
a: b: c:
a)
] ]

View file

@ -4,22 +4,23 @@
/* /*
c c
*/ */
d d
) )
( (
{ }: { }:
b: b:
/* /*
c c
*/ */
d d
) )
( (
a: { }: a:
/* { }:
c /*
*/ c
d */
d
) )
(a: d) (a: d)
( (
@ -27,14 +28,15 @@
/* /*
c c
*/ */
d d
) )
( (
a a
/* /*
b b
*/ */
: d :
d
) )
( (
a a
@ -45,9 +47,11 @@
/* /*
c c
*/ */
d d
)
(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
) )
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
( (
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
) )
@ -55,6 +59,12 @@
{ pkgs ? import ./.. { } { pkgs ? import ./.. { }
, locationsXml , locationsXml
}: }:
null null
)
(
a: b: c:
{ }:
a: b: c:
a
) )
] ]

View file

@ -1,9 +1,12 @@
[ [
(a ? a) (a or a)
(a ?/**/a) (a or/**/a)
(a/**/? a) (a/**/or a)
(a/**/?/**/a) (a/**/or/**/a)
(a/**/?/**/(a/**/?/**/(a/**/?/**/a))) (a/**/or/**/(a/**/or/**/(a/**/or/**/a)))
( a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ) (a/**/or/**/(a/**/or/**/(a/**/or/**/a)))
( a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a) ( a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a )
( a or a
or a
or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a)
] ]

View file

@ -1,63 +1,64 @@
[ [
(a ? a) (a or a)
( (
a a or
?
/**/
a
)
(
a
/**/
? a
)
(
a
/**/
?
/**/
a
)
(
a
/**/
?
/**/
(
a
/**/ /**/
? a
)
(
a
/**/
or a
)
(
a
/**/
or
/**/
a
)
(
a
/**/
or
/**/ /**/
( (
a a
/**/ /**/
? or
/**/ /**/
a (
a
/**/
or
/**/
a
)
) )
)
) )
(a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a ? a)
( (
a a
? a /**/
? a or
? a /**/
? a (
? a a
? a /**/
? a or
? a /**/
? a (
? a a
? a /**/
? a or
? a /**/
? a a
? a )
? a )
? a )
? a (a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a)
? a (
a or a
or a
or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a or a
) )
] ]

View file

@ -1,17 +1,20 @@
( (
((c)) ( ((c))
(
(c) (c)
/* /*
e e
*/ */
) ( )
(
( (
c c
/* /*
d d
*/ */
) )
) ( )
(
( (
c c
/* /*
@ -21,14 +24,16 @@
/* /*
e e
*/ */
) ( )
(
( (
/* /*
b b
*/ */
c c
) )
) ( )
(
( (
/* /*
b b
@ -38,7 +43,8 @@
/* /*
e e
*/ */
) ( )
(
( (
/* /*
b b
@ -48,7 +54,8 @@
d d
*/ */
) )
) ( )
(
( (
/* /*
b b
@ -61,12 +68,14 @@
/* /*
e e
*/ */
) ( )
(
/* /*
a a
*/ */
(c) (c)
) ( )
(
/* /*
a a
*/ */
@ -74,7 +83,8 @@
/* /*
e e
*/ */
) ( )
(
/* /*
a a
*/ */
@ -84,7 +94,8 @@
d d
*/ */
) )
) ( )
(
/* /*
a a
*/ */
@ -97,7 +108,8 @@
/* /*
e e
*/ */
) ( )
(
/* /*
a a
*/ */
@ -107,7 +119,8 @@
*/ */
c c
) )
) ( )
(
/* /*
a a
*/ */
@ -120,7 +133,8 @@
/* /*
e e
*/ */
) ( )
(
/* /*
a a
*/ */
@ -133,7 +147,8 @@
d d
*/ */
) )
) ( )
(
/* /*
a a
*/ */

View file

@ -4,13 +4,13 @@
{ } @ { } @
/**/ /**/
a: a:
_ _
) )
( (
{ } { }
/**/ /**/
@ a: @ a:
_ _
) )
( (
{ } { }
@ -18,7 +18,7 @@
@ @
/**/ /**/
a: a:
_ _
) )
(a @ { }: _) (a @ { }: _)
@ -26,13 +26,13 @@
a @ a @
/**/ /**/
{ }: { }:
_ _
) )
( (
a a
/**/ /**/
@ { }: @ { }:
_ _
) )
( (
a a
@ -40,6 +40,6 @@
@ @
/**/ /**/
{ }: { }:
_ _
) )
] ]

View file

@ -74,4 +74,43 @@
({ a ? null }: _) ({ a ? null }: _)
({ /*a*/ b /*a*/ ? /*a*/ null /*c*/ , /*d*/ e /*a*/ ? /*a*/ null /*f*/ , /*g*/ ... /*h*/ }: _) ({ /*a*/ b /*a*/ ? /*a*/ null /*c*/ , /*d*/ e /*a*/ ? /*a*/ null /*f*/ , /*g*/ ... /*h*/ }: _)
({
/*a*/
#
b
/*a*/
#
?
/*a*/
#
null
/*c*/
#
,
/*d*/
#
e
/*a*/
#
?
/*a*/
#
null
/*f*/
#
,
/*g*/
#
...
/*h*/
#
}
/*i*/
#
:
/*j*/
#
_
)
] ]

View file

@ -4,27 +4,27 @@
( (
{ /**/ { /**/
}: }:
_ _
) )
({ ... }: _) ({ ... }: _)
( (
{ ... { ...
/**/ /**/
}: }:
_ _
) )
( (
{ /**/ { /**/
... ...
}: }:
_ _
) )
( (
{ /**/ { /**/
... ...
/**/ /**/
}: }:
_ _
) )
( (
@ -32,7 +32,7 @@
, e , e
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -42,7 +42,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -52,7 +52,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -65,7 +65,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -75,7 +75,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -88,7 +88,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -101,7 +101,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -117,7 +117,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -127,7 +127,7 @@
e e
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -140,7 +140,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -153,7 +153,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -169,7 +169,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -182,7 +182,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -198,7 +198,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -214,7 +214,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -233,7 +233,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -243,7 +243,7 @@
, e , e
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -256,7 +256,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -269,7 +269,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -285,7 +285,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -298,7 +298,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -314,7 +314,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -330,7 +330,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -349,7 +349,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -362,7 +362,7 @@
e e
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -378,7 +378,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -394,7 +394,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -413,7 +413,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -429,7 +429,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ b { b
@ -448,7 +448,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ b { b
@ -467,7 +467,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ b { b
@ -489,7 +489,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -499,7 +499,7 @@
, e , e
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -512,7 +512,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -525,7 +525,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -541,7 +541,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -554,7 +554,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -570,7 +570,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -586,7 +586,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -605,7 +605,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -618,7 +618,7 @@
e e
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -634,7 +634,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -650,7 +650,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -669,7 +669,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -685,7 +685,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -704,7 +704,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -723,7 +723,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -745,7 +745,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -758,7 +758,7 @@
, e , e
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -774,7 +774,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -790,7 +790,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -809,7 +809,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -825,7 +825,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -844,7 +844,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -863,7 +863,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -885,7 +885,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -901,7 +901,7 @@
e e
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -920,7 +920,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -939,7 +939,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -961,7 +961,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -980,7 +980,7 @@
*/ */
, ... , ...
}: }:
_ _
) )
( (
{ /* { /*
@ -1002,7 +1002,7 @@
h h
*/ */
}: }:
_ _
) )
( (
{ /* { /*
@ -1024,7 +1024,7 @@
*/ */
... ...
}: }:
_ _
) )
( (
{ /* { /*
@ -1049,7 +1049,7 @@
h h
*/ */
}: }:
_ _
) )
({ a ? null }: _) ({ a ? null }: _)
@ -1092,6 +1092,70 @@
h h
*/ */
}: }:
_ _
)
(
{
/*
a
*/
#
b
/*
a
*/
#
?
/*
a
*/
#
null
/*
c
*/
#
,
/*
d
*/
#
e
/*
a
*/
#
?
/*
a
*/
#
null
/*
f
*/
#
,
/*
g
*/
#
...
/*
h
*/
#
}
/*
i
*/
#
:
/*
j
*/
#
_
) )
] ]

View file

@ -4,5 +4,6 @@
(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.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 )
] ]

View file

@ -58,9 +58,7 @@
[${mkSectionName sectName}] [${mkSectionName sectName}]
'' ''
### ###
''-couch_ini ${cfg.package}/etc/default.ini ${configFile} ${ ''-couch_ini ${cfg.package}/etc/default.ini ${configFile} ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} ${cfg.configFile}''
pkgs.writeText "couchdb-extra.ini" cfg.extraConfig
} ${cfg.configFile}''
### ###
''exec i3-input -F "mark %s" -l 1 -P 'Mark: ' '' ''exec i3-input -F "mark %s" -l 1 -P 'Mark: ' ''
### ###

View file

@ -4,5 +4,6 @@
(with /*a*/ b; c) (with /*a*/ b; c)
(with /*a*/ b; /*b*/ c) (with /*a*/ b; /*b*/ c)
( with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ) ( with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
( with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ) ( with b;
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
] ]