Skip to content

Commit 90ebdcd

Browse files
committed
fix: javascript uses || now
1 parent d6ff2db commit 90ebdcd

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

common/define-grammar.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ module.exports = function defineGrammar(dialect) {
33
name: dialect,
44

55
externals: ($, previous) => previous.concat([
6-
// Allow the external scanner to tell whether it is parsing an expression
7-
// or a type by checking the validity of this binary operator. This is
8-
// needed because the rules for automatic semicolon insertion are
9-
// slightly different when parsing types. Any binary-only operator would
10-
// work.
11-
'||',
126
$._function_signature_automatic_semicolon,
137
]),
148

common/scanner.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
#include <tree_sitter/parser.h>
1+
#include "tree_sitter/parser.h"
2+
23
#include <wctype.h>
34

45
enum TokenType {
56
AUTOMATIC_SEMICOLON,
67
TEMPLATE_CHARS,
78
TERNARY_QMARK,
8-
BINARY_OPERATORS,
9+
HTML_COMMENT,
10+
LOGICAL_OR,
11+
ESCAPE_SEQUENCE,
912
FUNCTION_SIGNATURE_AUTOMATIC_SEMICOLON,
1013
};
1114

@@ -121,7 +124,7 @@ static bool scan_automatic_semicolon(TSLexer *lexer, const bool *valid_symbols){
121124
// the validity of a binary operator token.
122125
case '(':
123126
case '[':
124-
if (valid_symbols[BINARY_OPERATORS]) return false;
127+
if (valid_symbols[LOGICAL_OR]) return false;
125128
break;
126129

127130
// Insert a semicolon before `--` and `++`, but not before binary `+` or `-`.

0 commit comments

Comments
 (0)