tree-sitter-ucode 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/grammar.js +26 -59
- package/package.json +5 -2
- package/prebuilds/darwin-arm64/tree-sitter-ucode.node +0 -0
- package/prebuilds/linux-arm64/tree-sitter-ucode.node +0 -0
- package/prebuilds/linux-x64/tree-sitter-ucode.node +0 -0
- package/prebuilds/win32-x64/tree-sitter-ucode.node +0 -0
- package/queries/highlights.scm +0 -5
- package/queries/locals.scm +2 -7
- package/queries/tags.scm +0 -13
- package/src/grammar.json +139 -229
- package/src/node-types.json +0 -55
- package/src/parser.c +19226 -20672
- package/src/scanner.c +6 -5
- package/tmpl/grammar.js +1 -1
- package/tmpl/src/parser.c +1 -1
- package/tree-sitter-ucode.wasm +0 -0
- package/tree-sitter-ucode_tmpl.wasm +0 -0
- package/tree-sitter.json +1 -1
package/src/scanner.c
CHANGED
|
@@ -33,6 +33,9 @@ static bool scan_template_chars(TSLexer *lexer) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
// Implements the three ASI rules from ECMA-262 §12.10 (Automatic Semicolon
|
|
37
|
+
// Insertion): insert before a token that the grammar doesn't allow if (1) a
|
|
38
|
+
// line terminator precedes it, (2) it is `}`, or (3) the input is exhausted.
|
|
36
39
|
static bool scan_automatic_semicolon(TSLexer *lexer) {
|
|
37
40
|
lexer->result_symbol = AUTOMATIC_SEMICOLON;
|
|
38
41
|
lexer->mark_end(lexer);
|
|
@@ -57,8 +60,7 @@ static bool scan_automatic_semicolon(TSLexer *lexer) {
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
// Skip inline whitespace (any Unicode space that is not a line terminator)
|
|
60
|
-
if (lexer->lookahead
|
|
61
|
-
iswspace(lexer->lookahead)) {
|
|
63
|
+
if (iswspace(lexer->lookahead)) {
|
|
62
64
|
skip(lexer);
|
|
63
65
|
continue;
|
|
64
66
|
}
|
|
@@ -141,10 +143,9 @@ static bool scan_automatic_semicolon(TSLexer *lexer) {
|
|
|
141
143
|
break;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
//
|
|
145
|
-
//
|
|
146
|
+
// Tokens that can continue the prior expression suppress ASI;
|
|
147
|
+
// anything else (identifier, keyword, number, …) gets one inserted.
|
|
146
148
|
switch (lexer->lookahead) {
|
|
147
|
-
// Things that could continue the expression — no ASI
|
|
148
149
|
case '(': case '[': case '`':
|
|
149
150
|
case '.': case ',': case ';':
|
|
150
151
|
case '+': case '-': case '*': case '%':
|
package/tmpl/grammar.js
CHANGED
package/tmpl/src/parser.c
CHANGED
package/tree-sitter-ucode.wasm
CHANGED
|
Binary file
|
|
Binary file
|