3个版本

0.0.3 2022年9月24日
0.0.2 2022年9月23日
0.0.1 2022年9月23日

#289 in 文本编辑器

Download history 56/week @ 2024-03-13 52/week @ 2024-03-20 84/week @ 2024-03-27 108/week @ 2024-04-03 82/week @ 2024-04-10 49/week @ 2024-04-17 62/week @ 2024-04-24 68/week @ 2024-05-01 67/week @ 2024-05-08 52/week @ 2024-05-15 46/week @ 2024-05-22 78/week @ 2024-05-29 77/week @ 2024-06-05 74/week @ 2024-06-12 56/week @ 2024-06-19 46/week @ 2024-06-26

263 每月下载

MIT 许可证

225KB
7.5K SLoC

C 7K SLoC C++ 315 SLoC // 0.0% comments JavaScript 210 SLoC Scheme 107 SLoC // 0.1% comments Rust 43 SLoC // 0.1% comments

tree-sitter-vue

npm build

Vue (Vue v2.6.0 模板语法) 语法用于 tree-sitter

注意:此语法不负责解析嵌入式语言,有关更多信息,请参阅多语言文档

变更日志

安装

npm install tree-sitter-vue tree-sitter

使用说明

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))))

许可证

MIT © Ika

依赖项

~2.7–4MB
~71K SLoC