Skip to content

Robertsson/tree-sitter-antlers

Repository files navigation

Tree-sitter Antlers

Tree-sitter grammar for the Antlers templating language used by Statamic CMS.

Features

Feature Status Notes
Variables Simple, nested, and array access are supported.
Comments Both {{# ... #}} and {{!-- ... --}} styles are supported.
Data Types Strings, numbers (including hex and octal), and booleans are supported.
Operators ⚠️ Most arithmetic, comparison, and logical operators are supported, but there are some precedence issues with or.
Control Structures if, elseif, else, and unless are supported.
Loops collection, nav, taxonomy, and form loops are supported.
Modifiers Modifiers with and without parameters are supported.
PHP Integration {{? ... ?}} and {{$ ... $}} are supported.
Interpolation Interpolation in parameters is supported.
Multi-statements Multiple statements separated by semicolons are supported.
Array Methods Array methods like orderby, groupby, etc. are supported.
Specialized Tags Most specialized tags like cache, session, markdown, etc. are supported.

Parser Status

  • ~80% Antlers specification coverage
  • Comprehensive syntax highlighting and editor support

Installation

  1. Clone the repository:
git clone https://github.com/Robertsson/tree-sitter-antlers.git
cd tree-sitter-antlers
  1. Install dependencies:
npm install
  1. Generate the parser:
tree-sitter generate
  1. Test the parser:
tree-sitter test

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for more information.

License

MIT License - see LICENSE for details.

Links

About

Tree-sitter grammar for the Antlers templating language used by Statamic CMS.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published