Skip to content

Commit

Permalink
[FJSX15] Simplify expression group
Browse files Browse the repository at this point in the history
  • Loading branch information
borela committed Feb 7, 2018
1 parent 76d5623 commit 8a2b3ed
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions syntaxes/fjsx15/expression.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,14 @@ contexts:
- include: Packages/Naomi/syntaxes/fjsx15/literal/number.sublime-syntax
# Detect operators as soon as possible.
- include: Packages/Naomi/syntaxes/fjsx15/operator.sublime-syntax
# Open new expression group.
- match: \(
scope: punctuation.section.group.begin.js.fjsx15
set: open-group
# Start of the expression.
- match: (?=\S)
set: [ optional-tail, head ]

close-group:
- match: \)
scope: punctuation.section.group.end.js.fjsx15
set: optional-tail
pop: true

comma:
- include: Packages/Naomi/syntaxes/fjsx15/operator/comma.sublime-syntax
Expand All @@ -73,10 +69,20 @@ contexts:
- include: Packages/Naomi/syntaxes/fjsx15/variable.sublime-syntax#function-assigned-to-variable
- include: Packages/Naomi/syntaxes/fjsx15/constant.sublime-syntax
- include: Packages/Naomi/syntaxes/fjsx15/variable.sublime-syntax
# Open new expression group.
- match: \(
scope: punctuation.section.group.begin.js.fjsx15
set: open-group

open-group:
- meta_scope: meta.group.js.fjsx15
- include: comment-no-pop
# Close the current expression group.
- include: close-group
# Open new expression group.
- match: \(
scope: punctuation.section.group.begin.js.fjsx15
push: open-group
# Comma operator.
- match: (?=,)
push: comma
Expand All @@ -85,18 +91,9 @@ contexts:
set: [ close-group, type-cast ]
# Arrow functions need to be detect before expression groups.
- include: Packages/Naomi/syntaxes/fjsx15/arrow-function.no-pop.sublime-syntax
# Open new expression group.
- match: \(
scope: punctuation.section.group.begin.js.fjsx15
push: open-group
# Close the current expression group.
- include: close-group
# Start of the expression.
- match: (?=\S)
push: optional-expression

optional-expression:
- include: Packages/Naomi/syntaxes/fjsx15/optional-expression.sublime-syntax
push: main

optional-tail:
- include: comment-no-pop
Expand Down

0 comments on commit 8a2b3ed

Please sign in to comment.