Compare commits
3 commits
c5d3860a83
...
bca4c8d312
| Author | SHA1 | Date | |
|---|---|---|---|
| bca4c8d312 | |||
| 540f28e55e | |||
| f76248b670 |
7 changed files with 2553 additions and 1933 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "tree-sitter-blueprint"
|
name = "tree-sitter-blueprint"
|
||||||
description = "Blueprint grammar for the tree-sitter parsing library"
|
description = "Blueprint grammar for the tree-sitter parsing library"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
keywords = ["incremental", "parsing", "android", "blueprint"]
|
keywords = ["incremental", "parsing", "android", "blueprint"]
|
||||||
categories = ["parsing", "text-editors"]
|
categories = ["parsing", "text-editors"]
|
||||||
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-blueprint"
|
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-blueprint"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ module.exports = grammar({
|
||||||
|
|
||||||
extras: ($) => [
|
extras: ($) => [
|
||||||
/\s+/,
|
/\s+/,
|
||||||
$.comment,
|
$.line_comment,
|
||||||
|
$.block_comment,
|
||||||
],
|
],
|
||||||
|
|
||||||
rules: {
|
rules: {
|
||||||
|
|
@ -22,7 +23,9 @@ module.exports = grammar({
|
||||||
$.module,
|
$.module,
|
||||||
),
|
),
|
||||||
|
|
||||||
comment: (_) => seq("#", /.*/),
|
line_comment: (_) => seq("//", /.*/),
|
||||||
|
|
||||||
|
block_comment: (_) => seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'),
|
||||||
|
|
||||||
// Definitions {{{
|
// Definitions {{{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tree-sitter-blueprint",
|
"name": "tree-sitter-blueprint",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "Blueprint grammar for tree-sitter",
|
"description": "Blueprint grammar for tree-sitter",
|
||||||
"main": "bindings/node",
|
"main": "bindings/node",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
||||||
27
src/grammar.json
generated
27
src/grammar.json
generated
|
|
@ -21,12 +21,12 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"comment": {
|
"line_comment": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "#"
|
"value": "//"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
|
|
@ -34,6 +34,23 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"block_comment": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "/*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"assignment": {
|
"assignment": {
|
||||||
"type": "SEQ",
|
"type": "SEQ",
|
||||||
"members": [
|
"members": [
|
||||||
|
|
@ -935,7 +952,11 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "comment"
|
"name": "line_comment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "block_comment"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"conflicts": [],
|
"conflicts": [],
|
||||||
|
|
|
||||||
25
src/node-types.json
generated
25
src/node-types.json
generated
|
|
@ -168,12 +168,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "boolean_literal",
|
"type": "block_comment",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {}
|
"fields": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "comment",
|
"type": "boolean_literal",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {}
|
"fields": {}
|
||||||
},
|
},
|
||||||
|
|
@ -259,6 +259,11 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "line_comment",
|
||||||
|
"named": true,
|
||||||
|
"fields": {}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "list_expression",
|
"type": "list_expression",
|
||||||
"named": true,
|
"named": true,
|
||||||
|
|
@ -632,10 +637,6 @@
|
||||||
"type": "\"",
|
"type": "\"",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "#",
|
|
||||||
"named": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "(",
|
"type": "(",
|
||||||
"named": false
|
"named": false
|
||||||
|
|
@ -652,6 +653,18 @@
|
||||||
"type": "-",
|
"type": "-",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "/",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "/*",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "//",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": ":",
|
"type": ":",
|
||||||
"named": false
|
"named": false
|
||||||
|
|
|
||||||
4318
src/parser.c
generated
4318
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,33 +2,122 @@
|
||||||
Empty comment
|
Empty comment
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
#
|
//
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(comment))
|
(line_comment))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Single comment
|
Single comment
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
# This is a comment
|
// This is a comment
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(comment))
|
(line_comment))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Multiple comments
|
Multiple comments
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
||||||
# This is a comment
|
// This is a comment
|
||||||
# This is a second comment
|
// This is a second comment
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(source_file
|
(source_file
|
||||||
(comment)
|
(line_comment)
|
||||||
(comment))
|
(line_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Empty block comment
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/**/
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Whitespace block comment
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Block comment
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/* This is a comment */
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Block comment with slashes
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/* /// */
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Block comment with asterisks
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/* *** */
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Block comment is not recursive
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/* /* */
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(block_comment))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Unterminated comment
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(ERROR))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Comment end-delimiter only
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(source_file
|
||||||
|
(ERROR
|
||||||
|
(UNEXPECTED '*')))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue