Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e16c4c4
Add basic tree-sitter-cfml config
ghedwards Feb 12, 2025
5a43667
Create tree-sitter-cfml.wasm
ghedwards Feb 12, 2025
60b9e27
Build cfml.yml
ghedwards Feb 12, 2025
27b40d6
Revert "Build cfml.yml"
ghedwards Feb 12, 2025
def3a35
Merge pull request #1 from cfmleditor/cfml
ghedwards Feb 12, 2025
237e5e6
Fix package for tree-sitter-cfml
ghedwards Feb 12, 2025
0d12100
Update tree-sitter-cfml
ghedwards Feb 12, 2025
0ca6aff
Fix new line at the bottom of cfml.scm ( otherwise test was failing )
ghedwards Feb 12, 2025
5f315b4
Rollback version update
ghedwards Feb 12, 2025
ff724c9
Rollback Cargo version updates
ghedwards Feb 12, 2025
7a33e8f
Rollback flake.lock
ghedwards Feb 12, 2025
654a2fe
Wasm build was missing cfml path
ghedwards Feb 12, 2025
c4ffe3a
try get ci.yml working on github
ghedwards Feb 13, 2025
58961d4
Fix formatting issue ( line at end of file causing ci.yml to fail
ghedwards Feb 14, 2025
18501ff
Basic input / output test
ghedwards Feb 14, 2025
9925bbd
Fix cfml.scm format
ghedwards Feb 16, 2025
745ca05
CFML formatting improvements ( still early days )
ghedwards Feb 16, 2025
4421dd9
Try restore playground / wasm to flake.nix
ghedwards Feb 16, 2025
1f5b823
Default indents for CFML to tabs
ghedwards Feb 17, 2025
596411c
Update README.md
ghedwards Feb 20, 2025
f8b94e4
Revert topiary.png to 37883aa57ccd481b74f9b66ce65557e83b2422c7
ghedwards Feb 20, 2025
55cef1c
Revert topiary_logo.png to 37883aa57ccd481b74f9b66ce65557e83b2422c7
ghedwards Feb 20, 2025
b6f7977
Revert favicon-32x32.png to ec0e71584b4f8f9b6d408d1f75df6ed0ff46f89b
ghedwards Feb 20, 2025
68b893d
Revert .wasm files
ghedwards Feb 20, 2025
a828d06
Remove cfml references where not required
ghedwards Feb 20, 2025
079b059
Merge branch 'tweag:main' into main
ghedwards Feb 20, 2025
0609ec5
Merge branch 'tweag:main' into main
ghedwards Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ labels:
- name: "language: nickel"
color: f8451f
description: "Nickel formatting issues"
- name: "language: cfml"
color: f8451f
description: "Cfml formatting issues"
- name: "language: Tree-sitter queries"
color: f8451f
description: "Tree-sitter queries formatting issues"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ by their individual name). Once included, they can be accessed in
Topiary in the usual way.

* [Rust]
* [CFML] (ColdFusion Markup Language) by @ghedwards
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are still missing a link, here. In markdown, enclosing text in square brackets [like this] is a shorthand for specifying a reference with the same text ([like this][like this]). When the reference is defined, the markdown is rendered as a link. Following our example, all of the following are equivalent:

### Shorthand form
[like this]

[like this]: http://example.com

### Expanded form
[like this][like this]

[like this]: http://example.com

### Link form
[like this](http://example.com)

### HTML form
<a href="http://example.com">like this</a>

If you scroll to the bottom of README.md, you'll see where all the references are defined. You should also define one for [cfml], pointing to an authoritative source of information on CFML.


## Getting Started

Expand Down
3 changes: 3 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# be compatible with Nickel urgently (it is currently blocking for the CI), we
# use the tree-sitter-nickel flake directly.
, tree-sitter-nickel
# use the tree-sitter-cfml flake directly.
, tree-sitter-cfml
# tree-sitter-openscad is not in nixpkgs so use flake directly
, tree-sitter-openscad
}:
Expand Down Expand Up @@ -129,6 +131,7 @@ in
css="${pkgs.tree-sitter-grammars.tree-sitter-css}/parser" \
json="${pkgs.tree-sitter-grammars.tree-sitter-json}/parser" \
nickel="${tree-sitter-nickel}/parser" \
cfml="${tree-sitter-cfml}/parser" \
ocaml="${pkgs.tree-sitter-grammars.tree-sitter-ocaml}/parser" \
ocaml_interface="${pkgs.tree-sitter-grammars.tree-sitter-ocaml-interface}/parser" \
openscad="${tree-sitter-openscad}/parser" \
Expand Down
1 change: 1 addition & 0 deletions examples/client-app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};

tree-sitter-cfml = {
url = "github:cfmleditor/tree-sitter-cfml";
inputs.nixpkgs.follows = "nixpkgs";
};

tree-sitter-openscad = {
url = "github:mkatychev/tree-sitter-openscad";
inputs.nixpkgs.follows = "nixpkgs";
Expand All @@ -49,7 +54,7 @@

topiaryPkgs = pkgs.callPackage ./default.nix {
inherit (inputs) advisory-db crane rust-overlay;
inherit (pkgs.tree-sitter-grammars) tree-sitter-nickel tree-sitter-openscad;
inherit (pkgs.tree-sitter-grammars) tree-sitter-nickel tree-sitter-cfml tree-sitter-openscad;
craneLib = inputs.crane.mkLib pkgs;
};

Expand All @@ -69,6 +74,7 @@
# Nickel *should* have an overlay like this already
tree-sitter-grammars = prev.tree-sitter-grammars // {
tree-sitter-nickel = inputs.tree-sitter-nickel.packages.${prev.system}.default;
tree-sitter-cfml = inputs.tree-sitter-cfml.packages.${prev.system}.default;
tree-sitter-openscad = inputs.tree-sitter-openscad.packages.${prev.system}.default;
};
};
Expand Down
4 changes: 3 additions & 1 deletion topiary-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ contributed = [

# Excluded by default
experimental = [
"rust"
"rust",
"cfml"
]

bash = ["topiary-config/bash", "topiary-queries/bash"]
css = ["topiary-config/css", "topiary-queries/css"]
cfml = ["topiary-config/cfml", "topiary-queries/cfml"]
json = ["topiary-config/json", "topiary-queries/json"]
nickel = ["topiary-config/nickel", "topiary-queries/nickel"]
ocaml = ["topiary-config/ocaml", "topiary-queries/ocaml"]
Expand Down
3 changes: 3 additions & 0 deletions topiary-cli/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ where
#[cfg(feature = "css")]
"css" => Ok(topiary_queries::css().into()),

#[cfg(feature = "cfml")]
"cfml" => Ok(topiary_queries::cfml().into()),

#[cfg(feature = "json")]
"json" => Ok(topiary_queries::json().into()),

Expand Down
3 changes: 3 additions & 0 deletions topiary-cli/tests/sample-tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fn get_file_extension(language: &str) -> &str {
match language {
"bash" => "sh",
"css" => "css",
"cfml" => "cfm",
"json" => "json",
"nickel" => "ncl",
"ocaml" => "ml",
Expand Down Expand Up @@ -80,6 +81,7 @@ mod test_fmt {
lang_test!(
"bash",
"css",
"cfml",
"json",
"nickel",
"ocaml",
Expand Down Expand Up @@ -157,6 +159,7 @@ mod test_coverage {
lang_test!(
"bash",
"css",
"cfml",
"json",
"nickel",
"ocaml",
Expand Down
8 changes: 8 additions & 0 deletions topiary-cli/tests/samples/expected/cfml.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<cfcomponent>
<cffunction>
<cfargument/>
<cfset var test = "test" />
<cfset test2 = "" />
<cfset test3 = "" />
</cffunction>
</cfcomponent>
1 change: 1 addition & 0 deletions topiary-cli/tests/samples/input/cfml.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<cfcomponent><cffunction><cfargument><cfset var test = "test"/><cfset test2 = ""><cfset test3 = ""></cffunction></cfcomponent>
2 changes: 2 additions & 0 deletions topiary-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ bash = []
css = []
json = []
nickel = []
cfml = []
ocaml = []
ocaml_interface = []
ocamllex = []
Expand All @@ -60,6 +61,7 @@ all = [
"css",
"json",
"nickel",
"cfml",
"ocaml",
"ocaml_interface",
"ocamllex",
Expand Down
10 changes: 10 additions & 0 deletions topiary-config/languages.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
},
},

cfml = {
extensions = ["cfm"],
indent = " ", # 1 tab
grammar.source.git = {
git = "https://github.com/cfmleditor/tree-sitter-cfml.git",
rev = "979825d2e27ac9e65a217e5132c5c7eef4004b0e",
subdir = "cfml",
},
},

ocaml = {
extensions = ["ml"],
grammar.source.git = {
Expand Down
6 changes: 6 additions & 0 deletions topiary-config/languages_nix.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
grammar.source.path = "@nickel@",
},

cfml = {
extensions = ["cfm"],
indent = " ", # 1 tab
grammar.source.path = "@cfml@",
},

ocaml = {
extensions = ["ml"],
grammar.source.path = "@ocaml@",
Expand Down
1 change: 1 addition & 0 deletions topiary-queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ description = """
[features]
bash = []
css = []
cfml = []
json = []
nickel = []
ocaml = []
Expand Down
22 changes: 22 additions & 0 deletions topiary-queries/queries/cfml.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(cf_tag_open) @append_hardline
(cf_tag_close) @append_hardline

(
(cf_tag_open) @append_indent_start
_
(cf_tag_close) @prepend_indent_end
)

(cf_set_tag) @append_hardline
(cf_selfclose_tag) @append_hardline

(cf_var) @prepend_space
(assignment_expression) @prepend_space @append_space

(assignment_expression "=" @prepend_space @append_space)

(
(cf_selfclose_tag_end) @prepend_delimiter
(#delimiter! "/")
(#not-match? @prepend_delimiter "/")
)
6 changes: 6 additions & 0 deletions topiary-queries/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ pub fn css() -> &'static str {
include_str!("../queries/css.scm")
}

/// Returns the Topiary-compatible query file for CFML.
#[cfg(feature = "cfml")]
pub fn cfml() -> &'static str {
include_str!("../queries/cfml.scm")
}

/// Returns the Topiary-compatible query file for Json.
#[cfg(feature = "json")]
pub fn json() -> &'static str {
Expand Down
Binary file not shown.
Loading