tree-sitter-scss-modern
v0.1.0
Published
Tree-sitter grammar for current SCSS syntax (module system, maps, control flow)
Maintainers
Readme
tree-sitter-scss-modern
A tree-sitter grammar for current SCSS syntax.
This project is a maintained fork of
tree-sitter-grammars/tree-sitter-scss, licensed
under MIT. It adds the Sass module system (@use and @forward options), maps, variable flags, boolean
operators, and other current syntax the original does not parse, keeping the original's node kinds.
Using it
cargo add tree-sitter tree-sitter-scss-modernlet mut parser = tree_sitter::Parser::new();
let language = tree_sitter_scss_modern::LANGUAGE;
parser
.set_language(&language.into())
.expect("Error loading current SCSS syntax parser");npm install tree-sitter-scss-modernimport Parser from 'tree-sitter';
import Language from 'tree-sitter-scss-modern';
const parser = new Parser();
parser.setLanguage(Language);A GitHub Packages copy is also published as @meloncholera/tree-sitter-scss-modern.
Building
npm install --ignore-scripts
npx --yes [email protected] -- tree-sitter generate
cargo buildThe generated parser (src/parser.c, src/grammar.json, and src/node-types.json) is committed.
Regenerate and commit the diff after every grammar.js change.
Testing
CC=gcc CXX=g++ npx --yes [email protected] -- tree-sitter test
cargo testOn Windows without MSVC, set CC and CXX to an installed GCC-compatible toolchain.
