mirror of
https://github.com/RGBCube/alejandra
synced 2025-07-31 12:37:45 +00:00
Merge pull request #52 from kamadorueda/kamadorueda
feat: apply without max-width
This commit is contained in:
commit
1cc586b32d
38 changed files with 714 additions and 446 deletions
99
flake.nix
99
flake.nix
|
@ -4,61 +4,68 @@
|
|||
fenix.url = "github:nix-community/fenix";
|
||||
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
fenix.inputs.rust-analyzer-src.follows = "rustAnalyzer";
|
||||
|
||||
flakeCompat.url = github:edolstra/flake-compat;
|
||||
flakeCompat.flake = false;
|
||||
|
||||
flakeUtils.url = "github:numtide/flake-utils";
|
||||
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
rustAnalyzer.url = "github:rust-analyzer/rust-analyzer";
|
||||
rustAnalyzer.flake = false;
|
||||
|
||||
treefmt.url = "github:numtide/treefmt";
|
||||
treefmt.inputs.flake-utils.follows = "flakeUtils";
|
||||
treefmt.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
outputs = inputs: inputs.flakeUtils.lib.eachSystem [ "x86_64-darwin" "x86_64-linux" ] (
|
||||
system: let
|
||||
nixpkgs = import inputs.nixpkgs { inherit system; };
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||
treefmt = inputs.treefmt.defaultPackage.${system};
|
||||
fenix = inputs.fenix.packages.${system};
|
||||
fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; };
|
||||
in
|
||||
{
|
||||
checks.defaultPackage = inputs.self.defaultPackage.${system};
|
||||
defaultApp = {
|
||||
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 ];
|
||||
outputs = inputs:
|
||||
inputs.flakeUtils.lib.eachSystem [ "x86_64-darwin" "x86_64-linux" ] (
|
||||
system: let
|
||||
nixpkgs = import inputs.nixpkgs { inherit system; };
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||
treefmt = inputs.treefmt.defaultPackage.${system};
|
||||
fenix = inputs.fenix.packages.${system};
|
||||
fenixPlatform = nixpkgs.makeRustPlatform { inherit (fenix.latest) cargo rustc; };
|
||||
in
|
||||
{
|
||||
checks.defaultPackage = inputs.self.defaultPackage.${system};
|
||||
defaultApp = {
|
||||
type = "app";
|
||||
program = "${inputs.self.defaultPackage.${system}}/bin/alejandra";
|
||||
};
|
||||
};
|
||||
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
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
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 ];
|
||||
};
|
||||
};
|
||||
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
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -296,6 +296,7 @@ pub fn fits_in_single_line(
|
|||
build_ctx: &crate::builder::BuildCtx,
|
||||
node: rnix::SyntaxElement,
|
||||
) -> bool {
|
||||
let line = build_ctx.pos_new.line;
|
||||
let maybe_green_node = build(
|
||||
&build_ctx.config.with_layout(crate::config::Layout::Wide),
|
||||
node,
|
||||
|
@ -304,10 +305,7 @@ pub fn fits_in_single_line(
|
|||
);
|
||||
|
||||
match maybe_green_node {
|
||||
Some(finished) => {
|
||||
build_ctx.pos_new.column + finished.to_string().chars().count()
|
||||
<= build_ctx.config.max_width()
|
||||
}
|
||||
Some(_) => build_ctx.pos_new.line == line,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
if let Some(child) = self.peek_next() {
|
||||
match child.element.kind() {
|
||||
|
|
|
@ -8,14 +8,6 @@ pub fn parse(args: Vec<String>) -> clap::ArgMatches {
|
|||
.short('d')
|
||||
.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(
|
||||
clap::Arg::new("paths")
|
||||
.help("Files or directories, or none to format stdin.")
|
||||
|
|
|
@ -6,14 +6,13 @@ pub enum Layout {
|
|||
|
||||
#[derive(Clone)]
|
||||
pub struct Config {
|
||||
debug: bool,
|
||||
layout: Layout,
|
||||
max_width: usize,
|
||||
debug: bool,
|
||||
layout: Layout,
|
||||
}
|
||||
|
||||
impl 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 {
|
||||
|
@ -24,19 +23,11 @@ impl Config {
|
|||
&self.layout
|
||||
}
|
||||
|
||||
pub fn max_width(&self) -> usize {
|
||||
self.max_width
|
||||
}
|
||||
|
||||
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 {
|
||||
Config { debug: self.debug, layout, max_width: self.max_width }
|
||||
}
|
||||
|
||||
pub fn with_max_width(&self, max_width: usize) -> Config {
|
||||
Config { debug: self.debug, layout: self.layout.clone(), max_width }
|
||||
Config { debug: self.debug, layout }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,12 +5,7 @@ fn main() -> std::io::Result<()> {
|
|||
let matches = alejandra::cli::parse(std::env::args().collect());
|
||||
|
||||
let debug: bool = matches.is_present("debug");
|
||||
let max_width: usize =
|
||||
matches.value_of("max-width").unwrap().parse().unwrap();
|
||||
|
||||
let config = alejandra::config::Config::new()
|
||||
.with_debug(debug)
|
||||
.with_max_width(max_width);
|
||||
let config = alejandra::config::Config::new().with_debug(debug);
|
||||
|
||||
match matches.values_of("paths") {
|
||||
Some(paths) => {
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -24,10 +26,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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();
|
||||
|
@ -36,7 +41,9 @@ pub fn rule(
|
|||
let child = children.get_next().unwrap();
|
||||
match layout {
|
||||
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::Pad);
|
||||
} else if let rnix::SyntaxKind::NODE_ATTR_SET
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -17,13 +19,17 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
@ -48,10 +54,13 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// expr
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -36,10 +38,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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(_) => {}
|
||||
});
|
||||
|
||||
// operator
|
||||
|
@ -53,13 +58,17 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -25,10 +27,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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(_) => {}
|
||||
});
|
||||
|
||||
// expr
|
||||
|
@ -43,10 +48,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// }
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -24,10 +26,13 @@ pub fn rule(
|
|||
|
||||
loop {
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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() {
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
@ -33,28 +36,27 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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(_) => {}
|
||||
});
|
||||
|
||||
// :
|
||||
let child = children.get_next().unwrap();
|
||||
match layout {
|
||||
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));
|
||||
}
|
||||
}
|
||||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// c
|
||||
|
@ -62,18 +64,56 @@ pub fn rule(
|
|||
let child = children.get_next().unwrap();
|
||||
match layout {
|
||||
crate::config::Layout::Tall => {
|
||||
if is_pattern_type {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
} else if let rnix::SyntaxKind::TOKEN_COMMENT =
|
||||
child_prev.element.kind()
|
||||
if is_pattern_type
|
||||
|| matches!(
|
||||
child_prev.element.kind(),
|
||||
rnix::SyntaxKind::TOKEN_COMMENT
|
||||
| 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::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 {
|
||||
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 => {
|
||||
steps.push_back(crate::builder::Step::Whitespace);
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -35,13 +37,17 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
@ -55,13 +61,17 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -23,10 +25,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// expr
|
||||
|
@ -43,10 +48,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// )
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -23,13 +25,17 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -26,13 +28,17 @@ pub fn rule(
|
|||
|
||||
if children.has_next() {
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
@ -46,13 +52,17 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
|
|
@ -4,7 +4,9 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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_between_curly_b = node
|
||||
|
@ -26,7 +28,7 @@ pub fn rule(
|
|||
})
|
||||
.count();
|
||||
|
||||
let layout = if has_comments {
|
||||
let layout = if has_comments || children.has_newlines() {
|
||||
&crate::config::Layout::Tall
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -55,10 +57,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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(_) => {}
|
||||
});
|
||||
|
||||
// {
|
||||
|
@ -79,6 +84,7 @@ pub fn rule(
|
|||
|
||||
if let rnix::SyntaxKind::TOKEN_COMMENT
|
||||
| rnix::SyntaxKind::TOKEN_ELLIPSIS
|
||||
| rnix::SyntaxKind::TOKEN_WHITESPACE
|
||||
| rnix::SyntaxKind::NODE_PAT_ENTRY = prev_kind
|
||||
{
|
||||
steps.push_back(crate::builder::Step::Indent);
|
||||
|
@ -94,6 +100,7 @@ pub fn rule(
|
|||
| rnix::SyntaxKind::TOKEN_CURLY_B_OPEN
|
||||
| rnix::SyntaxKind::TOKEN_COMMENT
|
||||
| rnix::SyntaxKind::TOKEN_ELLIPSIS
|
||||
| rnix::SyntaxKind::TOKEN_WHITESPACE
|
||||
| rnix::SyntaxKind::NODE_PAT_ENTRY = prev_kind
|
||||
{
|
||||
steps.push_back(crate::builder::Step::Dedent);
|
||||
|
@ -110,7 +117,9 @@ pub fn rule(
|
|||
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::Pad);
|
||||
steps.push_back(crate::builder::Step::Whitespace);
|
||||
|
@ -143,6 +152,10 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
children.move_next();
|
||||
}
|
||||
// \n
|
||||
rnix::SyntaxKind::TOKEN_WHITESPACE => {
|
||||
children.move_next();
|
||||
}
|
||||
_ => {
|
||||
break;
|
||||
}
|
||||
|
@ -160,10 +173,13 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// @ x
|
||||
|
|
|
@ -4,18 +4,24 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
};
|
||||
|
||||
while children.has_next() {
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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() {
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -35,10 +37,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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(_) => {}
|
||||
});
|
||||
|
||||
// .
|
||||
|
@ -46,13 +51,17 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -25,10 +27,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
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(_) => {}
|
||||
});
|
||||
|
||||
// expr
|
||||
|
@ -43,10 +48,13 @@ pub fn rule(
|
|||
}
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// }
|
||||
|
|
|
@ -4,9 +4,11 @@ pub fn rule(
|
|||
) -> std::collections::LinkedList<crate::builder::Step> {
|
||||
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
|
||||
} else {
|
||||
build_ctx.config.layout()
|
||||
|
@ -17,13 +19,17 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
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()
|
||||
{
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
|
@ -48,10 +54,13 @@ pub fn rule(
|
|||
steps.push_back(crate::builder::Step::Format(child.element));
|
||||
|
||||
// /**/
|
||||
children.drain_comments(|text| {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
children.drain_comments_and_newlines(|element| match element {
|
||||
crate::children::DrainCommentOrNewline::Comment(text) => {
|
||||
steps.push_back(crate::builder::Step::NewLine);
|
||||
steps.push_back(crate::builder::Step::Pad);
|
||||
steps.push_back(crate::builder::Step::Comment(text));
|
||||
}
|
||||
crate::children::DrainCommentOrNewline::Newline(_) => {}
|
||||
});
|
||||
|
||||
// expr
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
(a b) (a b) (
|
||||
(a b)
|
||||
(a b)
|
||||
(
|
||||
a
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
(assert /*a*/ b; c)
|
||||
(assert /*a*/ b; /*b*/ c)
|
||||
( assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
|
||||
( assert b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
|
||||
( assert b;
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
|
||||
]
|
||||
|
|
|
@ -19,7 +19,12 @@
|
|||
rec /*a*/ { /*b*/ c=1; }
|
||||
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 {
|
||||
|
||||
|
|
|
@ -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,6 +1,8 @@
|
|||
[
|
||||
{ inherit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; }
|
||||
{ inherit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; }
|
||||
{
|
||||
inherit aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; }
|
||||
{ inherit
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; }
|
||||
{ inherit b d ; }
|
||||
{ inherit b d /*e*/ ; }
|
||||
{ inherit b /*c*/ d ; }
|
||||
|
|
|
@ -85,21 +85,21 @@ rec
|
|||
/*
|
||||
b
|
||||
*/
|
||||
{ b = 1; };
|
||||
{ b = 1; };
|
||||
m = a:
|
||||
/*
|
||||
b
|
||||
*/
|
||||
{
|
||||
b = 1;
|
||||
c = 2;
|
||||
};
|
||||
{
|
||||
b = 1;
|
||||
c = 2;
|
||||
};
|
||||
n = pkgs: { };
|
||||
o =
|
||||
{ pkgs
|
||||
, ...
|
||||
}:
|
||||
{ };
|
||||
{ };
|
||||
|
||||
a
|
||||
/*
|
||||
|
@ -116,5 +116,6 @@ rec
|
|||
;
|
||||
|
||||
p =
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { } a;
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa { }
|
||||
a;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa )
|
||||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa )
|
||||
({ pkgs ? import ./.. { }, locationsXml }: null)
|
||||
(a: b: c:
|
||||
{ }:
|
||||
a: b: c:
|
||||
a)
|
||||
]
|
||||
|
|
|
@ -4,22 +4,23 @@
|
|||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
d
|
||||
)
|
||||
(
|
||||
{ }:
|
||||
b:
|
||||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
b:
|
||||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
)
|
||||
(
|
||||
a: { }:
|
||||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
a:
|
||||
{ }:
|
||||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
)
|
||||
(a: d)
|
||||
(
|
||||
|
@ -27,14 +28,15 @@
|
|||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
d
|
||||
)
|
||||
(
|
||||
a
|
||||
/*
|
||||
b
|
||||
*/
|
||||
: d
|
||||
:
|
||||
d
|
||||
)
|
||||
(
|
||||
a
|
||||
|
@ -45,9 +47,11 @@
|
|||
/*
|
||||
c
|
||||
*/
|
||||
d
|
||||
d
|
||||
)
|
||||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
|
||||
(
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
)
|
||||
|
@ -55,6 +59,12 @@
|
|||
{ pkgs ? import ./.. { }
|
||||
, locationsXml
|
||||
}:
|
||||
null
|
||||
null
|
||||
)
|
||||
(
|
||||
a: b: c:
|
||||
{ }:
|
||||
a: b: c:
|
||||
a
|
||||
)
|
||||
]
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
[
|
||||
(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 or a)
|
||||
(a or/**/a)
|
||||
(a/**/or a)
|
||||
(a/**/or/**/a)
|
||||
(a/**/or/**/(a/**/or/**/(a/**/or/**/a)))
|
||||
(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 )
|
||||
( 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)
|
||||
]
|
||||
|
|
|
@ -1,63 +1,64 @@
|
|||
[
|
||||
(a ? a)
|
||||
(a or a)
|
||||
(
|
||||
a
|
||||
?
|
||||
/**/
|
||||
a
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
? a
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
?
|
||||
/**/
|
||||
a
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
?
|
||||
/**/
|
||||
(
|
||||
a
|
||||
a or
|
||||
/**/
|
||||
?
|
||||
a
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
or a
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
or
|
||||
/**/
|
||||
a
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
or
|
||||
/**/
|
||||
(
|
||||
a
|
||||
/**/
|
||||
?
|
||||
/**/
|
||||
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
|
||||
? 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 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
|
||||
)
|
||||
]
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
(
|
||||
((c)) (
|
||||
((c))
|
||||
(
|
||||
(c)
|
||||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
(
|
||||
c
|
||||
/*
|
||||
d
|
||||
*/
|
||||
)
|
||||
) (
|
||||
)
|
||||
(
|
||||
(
|
||||
c
|
||||
/*
|
||||
|
@ -21,14 +24,16 @@
|
|||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
*/
|
||||
c
|
||||
)
|
||||
) (
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
|
@ -38,7 +43,8 @@
|
|||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
|
@ -48,7 +54,8 @@
|
|||
d
|
||||
*/
|
||||
)
|
||||
) (
|
||||
)
|
||||
(
|
||||
(
|
||||
/*
|
||||
b
|
||||
|
@ -61,12 +68,14 @@
|
|||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
(c)
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
@ -74,7 +83,8 @@
|
|||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
@ -84,7 +94,8 @@
|
|||
d
|
||||
*/
|
||||
)
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
@ -97,7 +108,8 @@
|
|||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
@ -107,7 +119,8 @@
|
|||
*/
|
||||
c
|
||||
)
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
@ -120,7 +133,8 @@
|
|||
/*
|
||||
e
|
||||
*/
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
@ -133,7 +147,8 @@
|
|||
d
|
||||
*/
|
||||
)
|
||||
) (
|
||||
)
|
||||
(
|
||||
/*
|
||||
a
|
||||
*/
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
{ } @
|
||||
/**/
|
||||
a:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ }
|
||||
/**/
|
||||
@ a:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ }
|
||||
|
@ -18,7 +18,7 @@
|
|||
@
|
||||
/**/
|
||||
a:
|
||||
_
|
||||
_
|
||||
)
|
||||
|
||||
(a @ { }: _)
|
||||
|
@ -26,13 +26,13 @@
|
|||
a @
|
||||
/**/
|
||||
{ }:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
a
|
||||
/**/
|
||||
@ { }:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
a
|
||||
|
@ -40,6 +40,6 @@
|
|||
@
|
||||
/**/
|
||||
{ }:
|
||||
_
|
||||
_
|
||||
)
|
||||
]
|
||||
|
|
|
@ -74,4 +74,43 @@
|
|||
|
||||
({ 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*/
|
||||
#
|
||||
}
|
||||
/*i*/
|
||||
#
|
||||
:
|
||||
/*j*/
|
||||
#
|
||||
_
|
||||
)
|
||||
]
|
||||
|
|
|
@ -4,27 +4,27 @@
|
|||
(
|
||||
{ /**/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
({ ... }: _)
|
||||
(
|
||||
{ ...
|
||||
/**/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /**/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /**/
|
||||
...
|
||||
/**/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
|
||||
(
|
||||
|
@ -32,7 +32,7 @@
|
|||
, e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -42,7 +42,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -65,7 +65,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -75,7 +75,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -88,7 +88,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -101,7 +101,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -117,7 +117,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -127,7 +127,7 @@
|
|||
e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -140,7 +140,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -153,7 +153,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -169,7 +169,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -182,7 +182,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -198,7 +198,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -214,7 +214,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -233,7 +233,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -243,7 +243,7 @@
|
|||
, e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -256,7 +256,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -269,7 +269,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -285,7 +285,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -298,7 +298,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -314,7 +314,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -330,7 +330,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -349,7 +349,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -362,7 +362,7 @@
|
|||
e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -378,7 +378,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -394,7 +394,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -413,7 +413,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -429,7 +429,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -448,7 +448,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -467,7 +467,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ b
|
||||
|
@ -489,7 +489,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -499,7 +499,7 @@
|
|||
, e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -512,7 +512,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -525,7 +525,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -541,7 +541,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -554,7 +554,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -570,7 +570,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -586,7 +586,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -605,7 +605,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -618,7 +618,7 @@
|
|||
e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -634,7 +634,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -650,7 +650,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -669,7 +669,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -685,7 +685,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -704,7 +704,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -723,7 +723,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -745,7 +745,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -758,7 +758,7 @@
|
|||
, e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -774,7 +774,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -790,7 +790,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -809,7 +809,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -825,7 +825,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -844,7 +844,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -863,7 +863,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -885,7 +885,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -901,7 +901,7 @@
|
|||
e
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -920,7 +920,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -939,7 +939,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -961,7 +961,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -980,7 +980,7 @@
|
|||
*/
|
||||
, ...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -1002,7 +1002,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -1024,7 +1024,7 @@
|
|||
*/
|
||||
...
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
(
|
||||
{ /*
|
||||
|
@ -1049,7 +1049,7 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
|
||||
({ a ? null }: _)
|
||||
|
@ -1092,6 +1092,70 @@
|
|||
h
|
||||
*/
|
||||
}:
|
||||
_
|
||||
_
|
||||
)
|
||||
|
||||
(
|
||||
{
|
||||
/*
|
||||
a
|
||||
*/
|
||||
#
|
||||
b
|
||||
/*
|
||||
a
|
||||
*/
|
||||
#
|
||||
?
|
||||
/*
|
||||
a
|
||||
*/
|
||||
#
|
||||
null
|
||||
/*
|
||||
c
|
||||
*/
|
||||
#
|
||||
,
|
||||
/*
|
||||
d
|
||||
*/
|
||||
#
|
||||
e
|
||||
/*
|
||||
a
|
||||
*/
|
||||
#
|
||||
?
|
||||
/*
|
||||
a
|
||||
*/
|
||||
#
|
||||
null
|
||||
/*
|
||||
f
|
||||
*/
|
||||
#
|
||||
,
|
||||
/*
|
||||
g
|
||||
*/
|
||||
#
|
||||
...
|
||||
/*
|
||||
h
|
||||
*/
|
||||
#
|
||||
}
|
||||
/*
|
||||
i
|
||||
*/
|
||||
#
|
||||
:
|
||||
/*
|
||||
j
|
||||
*/
|
||||
#
|
||||
_
|
||||
)
|
||||
]
|
||||
|
|
|
@ -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 )
|
||||
]
|
||||
|
|
|
@ -58,9 +58,7 @@
|
|||
[${mkSectionName sectName}]
|
||||
''
|
||||
###
|
||||
''-couch_ini ${cfg.package}/etc/default.ini ${configFile} ${
|
||||
pkgs.writeText "couchdb-extra.ini" cfg.extraConfig
|
||||
} ${cfg.configFile}''
|
||||
''-couch_ini ${cfg.package}/etc/default.ini ${configFile} ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} ${cfg.configFile}''
|
||||
###
|
||||
''exec i3-input -F "mark %s" -l 1 -P 'Mark: ' ''
|
||||
###
|
||||
|
|
|
@ -4,5 +4,6 @@
|
|||
(with /*a*/ b; c)
|
||||
(with /*a*/ b; /*b*/ c)
|
||||
( with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
|
||||
( with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
|
||||
( with b;
|
||||
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc )
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue