Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 5 additions & 11 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,12 @@ module.exports = grammar({
$.lineComment,
$.docComment,
$.blockComment,
/[ \t\f\r\n;]/
/[\s;]/
],

word: $ => $.identifier,

conflicts: $ => [
// in ANTLR we deal with these by not allowing a newline or semicolon before subscript
[$.objectProperty, $.subscriptExpr],
[$.objectMethod, $.subscriptExpr],
[$.objectEntry, $.subscriptExpr],
[$.objectPredicate, $.subscriptExpr],

// these should be fixable in some other way (perhaps with prec)
[$.propertyCallExpr, $.methodCallExpr],
[$.variableExpr, $.methodCallExpr],
Expand Down Expand Up @@ -762,18 +756,18 @@ module.exports = grammar({
}
});

function commaSep1 (rule) {
function commaSep1(rule) {
return seq(rule, repeat(seq(',', rule)));
}

function commaSep (rule) {
function commaSep(rule) {
return optional(commaSep1(rule));
}

function sepBy (sep, rule) {
function sepBy(sep, rule) {
return optional(sepBy1(sep, rule))
}

function sepBy1 (sep, rule) {
function sepBy1(sep, rule) {
return seq(rule, repeat(seq(sep, rule)));
}
19 changes: 1 addition & 18 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3860,26 +3860,10 @@
},
{
"type": "PATTERN",
"value": "[ \\t\\f\\r\\n;]"
"value": "[\\s;]"
}
],
"conflicts": [
[
"objectProperty",
"subscriptExpr"
],
[
"objectMethod",
"subscriptExpr"
],
[
"objectEntry",
"subscriptExpr"
],
[
"objectPredicate",
"subscriptExpr"
],
[
"propertyCallExpr",
"methodCallExpr"
Expand Down Expand Up @@ -3969,4 +3953,3 @@
"inline": [],
"supertypes": []
}

Loading