Compare commits
3 commits
c5d3860a83
...
bca4c8d312
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | bca4c8d312 | ||
Bruno BELANYI | 540f28e55e | ||
Bruno BELANYI | f76248b670 |
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "tree-sitter-blueprint"
|
||||
description = "Blueprint grammar for the tree-sitter parsing library"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
keywords = ["incremental", "parsing", "android", "blueprint"]
|
||||
categories = ["parsing", "text-editors"]
|
||||
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-blueprint"
|
||||
|
|
|
@ -11,7 +11,8 @@ module.exports = grammar({
|
|||
|
||||
extras: ($) => [
|
||||
/\s+/,
|
||||
$.comment,
|
||||
$.line_comment,
|
||||
$.block_comment,
|
||||
],
|
||||
|
||||
rules: {
|
||||
|
@ -22,7 +23,9 @@ module.exports = grammar({
|
|||
$.module,
|
||||
),
|
||||
|
||||
comment: (_) => seq("#", /.*/),
|
||||
line_comment: (_) => seq("//", /.*/),
|
||||
|
||||
block_comment: (_) => seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'),
|
||||
|
||||
// Definitions {{{
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tree-sitter-blueprint",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"description": "Blueprint grammar for tree-sitter",
|
||||
"main": "bindings/node",
|
||||
"keywords": [
|
||||
|
|
27
src/grammar.json
generated
27
src/grammar.json
generated
|
@ -21,12 +21,12 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"line_comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "#"
|
||||
"value": "//"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
|
@ -34,6 +34,23 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"block_comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "/*"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "/"
|
||||
}
|
||||
]
|
||||
},
|
||||
"assignment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
@ -935,7 +952,11 @@
|
|||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "comment"
|
||||
"name": "line_comment"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "block_comment"
|
||||
}
|
||||
],
|
||||
"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,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"type": "boolean_literal",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
|
@ -259,6 +259,11 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "line_comment",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "list_expression",
|
||||
"named": true,
|
||||
|
@ -632,10 +637,6 @@
|
|||
"type": "\"",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "#",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "(",
|
||||
"named": false
|
||||
|
@ -652,6 +653,18 @@
|
|||
"type": "-",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "/",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "/*",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "//",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ":",
|
||||
"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
|
||||
================================================================================
|
||||
|
||||
#
|
||||
//
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(comment))
|
||||
(line_comment))
|
||||
|
||||
================================================================================
|
||||
Single comment
|
||||
================================================================================
|
||||
|
||||
# This is a comment
|
||||
// This is a comment
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(comment))
|
||||
(line_comment))
|
||||
|
||||
================================================================================
|
||||
Multiple comments
|
||||
================================================================================
|
||||
|
||||
# This is a comment
|
||||
# This is a second comment
|
||||
// This is a comment
|
||||
// This is a second comment
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(comment)
|
||||
(comment))
|
||||
(line_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…
Reference in a new issue