Merge commit '5f2c94b897601b4029fedcce7db4c6d76ce8a128'

syntax_id
Wilfred Hughes 2023-08-08 23:24:52 +07:00
commit 3612c472f5
8 changed files with 2922 additions and 2542 deletions

@ -21,7 +21,7 @@ include = [
path = "bindings/rust/lib.rs"
[dependencies]
tree-sitter = "0.19"
tree-sitter = ">= 0.19"
[build-dependencies]
cc = "1.0"

@ -101,6 +101,21 @@ a::first-line {}
(selectors (pseudo_element_selector (tag_name) (tag_name)))
(block)))
=========================
::slotted pseudo element
=========================
::slotted(button) {}
---
(stylesheet
(rule_set
(selectors (pseudo_element_selector (tag_name)
(arguments (tag_name))))
(block)))
=========================
Child selectors
=========================
@ -126,6 +141,7 @@ Descendant selectors
a b {}
c d e {}
f * {}
---
@ -137,6 +153,12 @@ c d e {}
(selectors (descendant_selector
(descendant_selector (tag_name) (tag_name))
(tag_name)))
(block))
(rule_set
(selectors
(descendant_selector
(tag_name)
(universal_selector)))
(block)))
===========================

@ -162,7 +162,8 @@ module.exports = grammar({
pseudo_element_selector: $ => seq(
optional($._selector),
'::',
alias($.identifier, $.tag_name)
alias($.identifier, $.tag_name),
optional(alias($.pseudo_element_arguments, $.arguments))
),
id_selector: $ => seq(
@ -196,6 +197,12 @@ module.exports = grammar({
')'
),
pseudo_element_arguments: $ => seq(
token.immediate('('),
sep(',', choice($._selector, repeat1($._value))),
')'
),
// Declarations
declaration: $ => seq(

@ -653,6 +653,23 @@
},
"named": true,
"value": "tag_name"
},
{
"type": "CHOICE",
"members": [
{
"type": "ALIAS",
"content": {
"type": "SYMBOL",
"name": "pseudo_element_arguments"
},
"named": true,
"value": "arguments"
},
{
"type": "BLANK"
}
]
}
]
},
@ -923,6 +940,79 @@
}
]
},
"pseudo_element_arguments": {
"type": "SEQ",
"members": [
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": "("
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_selector"
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_value"
}
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_selector"
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_value"
}
}
]
}
]
}
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ")"
}
]
},
"declaration": {
"type": "SEQ",
"members": [

@ -1226,6 +1226,10 @@
"type": "adjacent_sibling_selector",
"named": true
},
{
"type": "arguments",
"named": true
},
{
"type": "attribute_selector",
"named": true

File diff suppressed because it is too large Load Diff

@ -26,6 +26,7 @@ bool tree_sitter_css_external_scanner_scan(void *payload, TSLexer *lexer, const
lexer->lookahead == '.' ||
lexer->lookahead == '[' ||
lexer->lookahead == '-' ||
lexer->lookahead == '*' ||
iswalnum(lexer->lookahead)
) {
return true;

@ -123,6 +123,7 @@ struct TSLanguage {
unsigned (*serialize)(void *, char *);
void (*deserialize)(void *, const char *, unsigned);
} external_scanner;
const TSStateId *primary_state_ids;
};
/*