1 unstable release

0.0.1 Jun 24, 2024

#6 in #shopify

AGPL-3.0

145KB
2.5K SLoC

Pest 2.5K SLoC // 0.4% comments Rust 5 SLoC // 0.3% comments

Liquid Grammar Pest

Pest grammar for parsing Shopify Liquid



Requirements

This repository requires Rust language/compiler to build from source

As of last update to this ReadMe file, the recommended method of installing Rust is via the installer script...

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Quick Start

This repository is a Rust library, define it as a dependency within a project Cargo.toml file...

Cargo.toml (snip)

[dependencies]
pest = "2.7.10"
liquid_grammar_pest = "0.0.1"

Check Rust -- Doc -- Specifying Dependencies for details about defining dependencies.

Then include within a source file via use statement...

src/main.rs

use liquid_grammar_pest::{LiquidParser, Rule};
use pest::Parser;

Usage

Check the tests/ and examples/ files for sample code.


Notes

This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.

This repository is focused on providing grammar and, through Pest, tokenizer only. It is up to crate consumers to implement interpreter, error customization, or any additional features.


Contributing

Options for contributing to liquid-grammar-pest and rust-utilities


Forking

Start making a Fork of this repository to an account that you have write permissions for.

  • Add remote for fork URL. The URL syntax is git@github.com:<NAME>/<REPO>.git...
cd ~/git/hub/rust-utilities/liquid-grammar-pest

git remote add fork git@github.com:<NAME>/liquid-grammar-pest.git
  • Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/rust-utilities/liquid-grammar-pest


git commit -F- <<'EOF'
:bug: Fixes #42 Issue


**Edits**


- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF


git push fork main

Note, the -u option may be used to set fork as the default remote, eg. git push -u fork main however, this will also default the fork remote for pulling from too! Meaning that pulling updates from origin must be done explicitly, eg. git pull origin main

  • Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>

Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.


Sponsor

Thanks for even considering it!

Via Liberapay you may sponsor__shields_io__liberapay on a repeating basis.

Regardless of if you're able to financially support projects such as liquid-grammar-pest that rust-utilities maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.


Attribution


License

This project is licensed based on use-case


Commercial and/or proprietary use

If a project is either commercial or (||) proprietary, then please contact the author for pricing and licensing options to make use of code and/or features from this repository.


Non-commercial and FOSS use

If a project is both non-commercial and (&&) published with a license compatible with AGPL-3.0, then it may utilize code from this repository under the following terms.

Pest grammar for parsing Shopify Liquid
Copyright (C) 2024 S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

... For further details review full length version of AGPL-3.0 License.

Dependencies

~2–2.8MB
~57K SLoC