Skip to content

Commit

Permalink
[Haskell] Match groups
Browse files Browse the repository at this point in the history
  • Loading branch information
FichteFoll committed Dec 3, 2019
1 parent 52a3ade commit 4d4210c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
29 changes: 23 additions & 6 deletions Haskell/Haskell.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,38 @@ variables:
)
contexts:
main:
prototype:
- include: comment
- include: preprocessor

main:
- include: statement
- include: expression

statement:
- include: declaration
- include: keyword
- include: import

expression:
- include: keyword
- include: operator
- include: constant
- include: string
- include: splice
- include: group
- match: ','
scope: punctuation.separator.comma.haskell

group:
- match: \(
scope: punctuation.section.group.begin.haskell
push:
- meta_scope: meta.group.haskell
- match: \)
scope: punctuation.section.group.end.haskell
pop: true
- include: expression

constant:
- match: \(\)
scope: constant.language.unit.haskell
Expand Down Expand Up @@ -129,8 +148,7 @@ contexts:
scope: keyword.control.import.haskell
- include: module_name
- include: module_exports
- include: comment


keyword:
- match: \b(?:do|where|in)\b
scope: keyword.control.context.haskell
Expand Down Expand Up @@ -187,6 +205,7 @@ contexts:
- match: '"'
scope: punctuation.definition.string.begin.haskell
push:
- meta_include_prototype: false
- meta_scope: string.quoted.double.haskell
- match: $|"
scope: punctuation.definition.string.end.haskell
Expand Down Expand Up @@ -290,7 +309,6 @@ contexts:
- match: \(.*?\)
comment: So named because I don't know what to call this.
scope: meta.other.unknown.haskell
- include: comment

module_name:
- match: '\b{{module_name}}\b'
Expand All @@ -308,7 +326,6 @@ contexts:
scope: storage.type.haskell
- match: \(\)
scope: support.constant.unit.haskell
- include: comment

pragma:
- match: '\{-#'
Expand Down
9 changes: 9 additions & 0 deletions Haskell/syntax_test_haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ test a = case a of
else 0
-- ^^^^ keyword.control.conditional.else.haskell


--MISC

(group)
-- ^^^^^^^ meta.group.haskell
-- ^ punctuation.section.group.begin.haskell
-- ^ punctuation.section.group.end.haskell


--NUMBERS

0
Expand Down

0 comments on commit 4d4210c

Please sign in to comment.