Compare commits

..

No commits in common. "bca4c8d312d3c71de3fbd25cb07d2c80c844d461" and "c5d3860a83c9b42ae4e0b3bc8efaf8a409ee70b8" have entirely different histories.

7 changed files with 1900 additions and 2520 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "tree-sitter-blueprint"
description = "Blueprint grammar for the tree-sitter parsing library"
version = "0.1.2"
version = "0.1.1"
keywords = ["incremental", "parsing", "android", "blueprint"]
categories = ["parsing", "text-editors"]
repository = "https://git.belanyi.fr/ambroisie/tree-sitter-blueprint"

View file

@ -11,8 +11,7 @@ module.exports = grammar({
extras: ($) => [
/\s+/,
$.line_comment,
$.block_comment,
$.comment,
],
rules: {
@ -23,9 +22,7 @@ module.exports = grammar({
$.module,
),
line_comment: (_) => seq("//", /.*/),
block_comment: (_) => seq("/*", /[^*]*\*+([^/*][^*]*\*+)*/, '/'),
comment: (_) => seq("#", /.*/),
// Definitions {{{

View file

@ -1,6 +1,6 @@
{
"name": "tree-sitter-blueprint",
"version": "0.1.2",
"version": "0.1.1",
"description": "Blueprint grammar for tree-sitter",
"main": "bindings/node",
"keywords": [

27
src/grammar.json generated
View file

@ -21,12 +21,12 @@
}
]
},
"line_comment": {
"comment": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "//"
"value": "#"
},
{
"type": "PATTERN",
@ -34,23 +34,6 @@
}
]
},
"block_comment": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "/*"
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",
"value": "/"
}
]
},
"assignment": {
"type": "SEQ",
"members": [
@ -952,11 +935,7 @@
},
{
"type": "SYMBOL",
"name": "line_comment"
},
{
"type": "SYMBOL",
"name": "block_comment"
"name": "comment"
}
],
"conflicts": [],

25
src/node-types.json generated
View file

@ -168,12 +168,12 @@
}
},
{
"type": "block_comment",
"type": "boolean_literal",
"named": true,
"fields": {}
},
{
"type": "boolean_literal",
"type": "comment",
"named": true,
"fields": {}
},
@ -259,11 +259,6 @@
]
}
},
{
"type": "line_comment",
"named": true,
"fields": {}
},
{
"type": "list_expression",
"named": true,
@ -637,6 +632,10 @@
"type": "\"",
"named": false
},
{
"type": "#",
"named": false
},
{
"type": "(",
"named": false
@ -653,18 +652,6 @@
"type": "-",
"named": false
},
{
"type": "/",
"named": false
},
{
"type": "/*",
"named": false
},
{
"type": "//",
"named": false
},
{
"type": ":",
"named": false

4252
src/parser.c generated

File diff suppressed because it is too large Load diff

View file

@ -2,122 +2,33 @@
Empty comment
================================================================================
//
#
--------------------------------------------------------------------------------
(source_file
(line_comment))
(comment))
================================================================================
Single comment
================================================================================
// This is a comment
# This is a comment
--------------------------------------------------------------------------------
(source_file
(line_comment))
(comment))
================================================================================
Multiple comments
================================================================================
// This is a comment
// This is a second comment
# This is a comment
# This is a second comment
--------------------------------------------------------------------------------
(source_file
(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 '*')))
(comment)
(comment))