Compare commits
5 Commits
f13775ea60
...
dab6d76f9c
Author | SHA1 | Date |
---|---|---|
Shadowfacts | dab6d76f9c | |
Max Brunsfeld | a03f1d2d1d | |
Microsoft Provenance Contributions | 7c39062216 | |
Ryan Tsao | 94e1023093 | |
Max Brunsfeld | 9668e88916 |
|
@ -1,12 +1,13 @@
|
|||
[package]
|
||||
name = "tree-sitter-css"
|
||||
description = "css grammar for the tree-sitter parsing library"
|
||||
version = "0.0.1"
|
||||
version = "0.20.0"
|
||||
keywords = ["incremental", "parsing", "css"]
|
||||
categories = ["parsing", "text-editors"]
|
||||
repository = "https://github.com/tree-sitter/tree-sitter-javascript"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
authors = ["Max Brunsfeld <maxbrunsfeld@gmail.com>"]
|
||||
|
||||
build = "bindings/rust/build.rs"
|
||||
include = [
|
||||
|
@ -20,7 +21,7 @@ include = [
|
|||
path = "bindings/rust/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tree-sitter = "0.17"
|
||||
tree-sitter = "0.20"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0"
|
||||
|
|
|
@ -86,6 +86,7 @@ a {
|
|||
c: 5em;
|
||||
margin: 10E3px;
|
||||
margin: -456.8px;
|
||||
margin: -5px;
|
||||
margin: -0.0px;
|
||||
}
|
||||
|
||||
|
@ -97,6 +98,7 @@ a {
|
|||
(declaration (property_name) (integer_value (unit)))
|
||||
(declaration (property_name) (float_value (unit)))
|
||||
(declaration (property_name) (float_value (unit)))
|
||||
(declaration (property_name) (integer_value (unit)))
|
||||
(declaration (property_name) (float_value (unit))))))
|
||||
|
||||
============================
|
||||
|
@ -240,5 +242,28 @@ a-property: calc(5px + var(--a-variable));
|
|||
---
|
||||
|
||||
(stylesheet
|
||||
(declaration (property_name) (plain_value))
|
||||
(declaration (property_name) (integer_value (unit)))
|
||||
(declaration (property_name) (call_expression (function_name) (arguments (binary_expression (integer_value (unit)) (call_expression (function_name) (arguments (plain_value))))))))
|
||||
|
||||
=============================================
|
||||
Spaces after colons in property declarations
|
||||
=============================================
|
||||
|
||||
div {
|
||||
margin : 0;
|
||||
padding : 0;
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(stylesheet
|
||||
(rule_set
|
||||
(selectors
|
||||
(tag_name))
|
||||
(block
|
||||
(declaration
|
||||
(property_name)
|
||||
(integer_value))
|
||||
(declaration
|
||||
(property_name)
|
||||
(integer_value)))))
|
||||
|
|
|
@ -333,7 +333,7 @@ module.exports = grammar({
|
|||
')'
|
||||
),
|
||||
|
||||
identifier: $ => /[a-zA-Z-_][a-zA-Z0-9-_]*/,
|
||||
identifier: $ => /(--|-?[a-zA-Z_])[a-zA-Z0-9-_]*/,
|
||||
|
||||
at_keyword: $ => /@[a-zA-Z-_]+/,
|
||||
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
{
|
||||
"name": "tree-sitter-css",
|
||||
"version": "0.16.0",
|
||||
"version": "0.20.0",
|
||||
"description": "CSS grammar for tree-sitter",
|
||||
"main": "bindings/node",
|
||||
"keywords": [
|
||||
"parser",
|
||||
"lexer"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tree-sitter/tree-sitter-css.git"
|
||||
},
|
||||
"author": "Max Brunsfeld",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nan": "^2.14.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tree-sitter-cli": "^0.19.1"
|
||||
"tree-sitter-cli": "^0.20.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tree-sitter test && tree-sitter parse examples/*.css --quiet --time",
|
||||
|
|
|
@ -1642,7 +1642,7 @@
|
|||
},
|
||||
"identifier": {
|
||||
"type": "PATTERN",
|
||||
"value": "[a-zA-Z-_][a-zA-Z0-9-_]*"
|
||||
"value": "(--|-?[a-zA-Z_])[a-zA-Z0-9-_]*"
|
||||
},
|
||||
"at_keyword": {
|
||||
"type": "PATTERN",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,24 +12,40 @@ unsigned tree_sitter_css_external_scanner_serialize(void *p, char *buffer) { ret
|
|||
void tree_sitter_css_external_scanner_deserialize(void *p, const char *b, unsigned n) {}
|
||||
|
||||
bool tree_sitter_css_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
|
||||
if (iswspace(lexer->lookahead)) {
|
||||
lexer->advance(lexer, true);
|
||||
if (iswspace(lexer->lookahead) && valid_symbols[DESCENDANT_OP]) {
|
||||
lexer->result_symbol = DESCENDANT_OP;
|
||||
|
||||
lexer->advance(lexer, true);
|
||||
while (iswspace(lexer->lookahead)) {
|
||||
lexer->advance(lexer, true);
|
||||
}
|
||||
lexer->mark_end(lexer);
|
||||
|
||||
if (
|
||||
lexer->lookahead == '#' ||
|
||||
lexer->lookahead == '.' ||
|
||||
lexer->lookahead == '[' ||
|
||||
lexer->lookahead == ':' ||
|
||||
lexer->lookahead == '-' ||
|
||||
iswalnum(lexer->lookahead)
|
||||
) {
|
||||
lexer->result_symbol = DESCENDANT_OP;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (lexer->lookahead == ':') {
|
||||
lexer->advance(lexer, false);
|
||||
if (iswspace(lexer->lookahead)) return false;
|
||||
for (;;) {
|
||||
if (
|
||||
lexer->lookahead == ';' ||
|
||||
lexer->lookahead == '}' ||
|
||||
lexer->eof(lexer)
|
||||
) return false;
|
||||
if (lexer->lookahead == '{') {
|
||||
return true;
|
||||
}
|
||||
lexer->advance(lexer, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -102,8 +102,8 @@ struct TSLanguage {
|
|||
const uint16_t *small_parse_table;
|
||||
const uint32_t *small_parse_table_map;
|
||||
const TSParseActionEntry *parse_actions;
|
||||
const char **symbol_names;
|
||||
const char **field_names;
|
||||
const char * const *symbol_names;
|
||||
const char * const *field_names;
|
||||
const TSFieldMapSlice *field_map_slices;
|
||||
const TSFieldMapEntry *field_map_entries;
|
||||
const TSSymbolMetadata *symbol_metadata;
|
||||
|
@ -123,6 +123,7 @@ struct TSLanguage {
|
|||
unsigned (*serialize)(void *, char *);
|
||||
void (*deserialize)(void *, const char *, unsigned);
|
||||
} external_scanner;
|
||||
const TSStateId *primary_state_ids;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue