-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4da98f7
Showing
25 changed files
with
7,368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 2 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[corpus/*] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
* text eol=lf | ||
*.wasm binary | ||
|
||
/src/** linguist-generated | ||
/src/scanner.* linguist-generated=false | ||
/index.js linguist-generated | ||
/binding.gyp linguist-detectable=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/build | ||
/node_modules | ||
/tree-sitter |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
language: rust | ||
|
||
rust: | ||
- stable | ||
|
||
script: | ||
- if [ ! -d "./tree-sitter/target/release" ]; then bash ./scripts/setup-tree-sitter.sh; fi | ||
- ./tree-sitter/target/release/tree-sitter test | ||
|
||
cache: | ||
cargo: true | ||
directories: | ||
- ./tree-sitter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) Ika <ikatyang@gmail.com> (https://github.com/ikatyang) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# tree-sitter-vue | ||
|
||
[![npm](https://img.shields.io/npm/v/tree-sitter-vue.svg)](https://www.npmjs.com/package/tree-sitter-vue) | ||
[![build](https://img.shields.io/travis/com/ikatyang/tree-sitter-vue/master.svg)](https://travis-ci.com/ikatyang/tree-sitter-vue/builds) | ||
|
||
Vue ([Vue v2.6.0 Template Syntax](https://vuejs.org/v2/guide/syntax.html)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter) | ||
|
||
_Note: This grammar is not responsible for parsing embedded languages, see [Multi-language Documents](http://tree-sitter.github.io/tree-sitter/using-parsers#multi-language-documents) for more info._ | ||
|
||
[Changelog](https://github.com/ikatyang/tree-sitter-vue/blob/master/CHANGELOG.md) | ||
|
||
## Install | ||
|
||
```sh | ||
npm install tree-sitter-vue tree-sitter | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
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](https://github.com/ikatyang) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
This project incorporates third party material from the projects listed below. | ||
The original copyright notice and the license under which we received such third | ||
party material are set forth below. | ||
|
||
================================================================================ | ||
|
||
tree-sitter-html (https://github.com/tree-sitter/tree-sitter-html) | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Max Brunsfeld | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"targets": [ | ||
{ | ||
"target_name": "tree_sitter_vue_binding", | ||
"include_dirs": [ | ||
"<!(node -e \"require('nan')\")", | ||
"src" | ||
], | ||
"sources": [ | ||
"src/binding.cc", | ||
"src/parser.c", | ||
"src/scanner.cc" | ||
], | ||
"cflags_c": [ | ||
"-std=c99", | ||
] | ||
} | ||
] | ||
} |
Oops, something went wrong.