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] [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.2" version = "0.1.1"
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"

View file

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

View file

@ -1,6 +1,6 @@
{ {
"name": "tree-sitter-blueprint", "name": "tree-sitter-blueprint",
"version": "0.1.2", "version": "0.1.1",
"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
View file

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

25
src/node-types.json generated
View file

@ -168,12 +168,12 @@
} }
}, },
{ {
"type": "block_comment", "type": "boolean_literal",
"named": true, "named": true,
"fields": {} "fields": {}
}, },
{ {
"type": "boolean_literal", "type": "comment",
"named": true, "named": true,
"fields": {} "fields": {}
}, },
@ -259,11 +259,6 @@
] ]
} }
}, },
{
"type": "line_comment",
"named": true,
"fields": {}
},
{ {
"type": "list_expression", "type": "list_expression",
"named": true, "named": true,
@ -637,6 +632,10 @@
"type": "\"", "type": "\"",
"named": false "named": false
}, },
{
"type": "#",
"named": false
},
{ {
"type": "(", "type": "(",
"named": false "named": false
@ -653,18 +652,6 @@
"type": "-", "type": "-",
"named": false "named": false
}, },
{
"type": "/",
"named": false
},
{
"type": "/*",
"named": false
},
{
"type": "//",
"named": false
},
{ {
"type": ":", "type": ":",
"named": false "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 Empty comment
================================================================================ ================================================================================
// #
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
(source_file (source_file
(line_comment)) (comment))
================================================================================ ================================================================================
Single comment Single comment
================================================================================ ================================================================================
// This is a comment # This is a comment
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
(source_file (source_file
(line_comment)) (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
(line_comment) (comment)
(line_comment)) (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 '*')))