Vue grammar for tree-sitter
- JavaScript 41.2%
- C++ 18.7%
- Rust 17.5%
- Tree-sitter Query 14.3%
- Vue 4.5%
- Other 3.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
The submodule entry remained after .gitmodules was deleted, breaking libgit2-based fetches (cargo update failed with: no URL configured for submodule 'tree-sitter'). The Rust build uses the git.sly.so tree-sitter dependency directly, so the local copy is untracked tooling only. |
||
| bindings | ||
| corpus | ||
| docs | ||
| queries | ||
| scripts | ||
| src | ||
| test | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .npmignore | ||
| .travis.yml | ||
| binding.gyp | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| grammar.js | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| ThirdPartyNoticeText.txt | ||
| yarn.lock | ||
tree-sitter-vue
Vue (Vue v2.6.0 Template Syntax) grammar for tree-sitter
Note: This grammar is not responsible for parsing embedded languages, see Multi-language Documents for more info.
Install
npm install tree-sitter-vue tree-sitter
Usage
const Parser = require("tree-sitter");
const Vue = require("tree-sitter-vue");
const parser = new Parser();
parser.setLanguage(Vue);
const sourceCode = `
<template>
Hello, <a :[key]="url">{{ name }}</a>!
</template>
`;
const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());
// (component
// (template_element
// (start_tag
// (tag_name))
// (text)
// (element
// (start_tag
// (tag_name)
// (directive_attribute
// (directive_name)
// (directive_dynamic_argument
// (directive_dynamic_argument_value))
// (quoted_attribute_value
// (attribute_value))))
// (interpolation
// (raw_text))
// (end_tag
// (tag_name)))
// (text)
// (end_tag
// (tag_name))))
License
MIT © Ika