Skip to content

Commit

Permalink
[Haskell] Improve multi-line strings fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Jul 30, 2021
1 parent d0c5d31 commit c6f01ca
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
12 changes: 9 additions & 3 deletions Haskell/Haskell.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1381,15 +1381,21 @@ contexts:
5: constant.character.escape.control.haskell
- match: (\\)\s*$
captures:
1: punctuation.separator.continuation.haskell
1: punctuation.definition.continuation.begin.haskell
push: linteral-string-continuation

linteral-string-continuation:
- clear_scopes: 2
- meta_scope: meta.string.continuation.haskell
- meta_include_prototype: false
- match: \\
scope: punctuation.separator.continuation.haskell
scope: punctuation.definition.continuation.end.haskell
pop: 1
- match: (?=")
- match: \"
scope: invalid.illegal.expect-continuation-end.haskell
pop: 2
- match: \S
scope: invalid.illegal.expect-continuation-end.haskell
pop: 1

###[ KEYWORDS AND OPERATORS ]##################################################
Expand Down
29 changes: 24 additions & 5 deletions Haskell/tests/syntax_test_haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3860,14 +3860,33 @@ main = do
-- ^ keyword.operator.haskell

"This is a\
-- ^^^^^^^^^^^^ meta.string.haskell string.quoted.double.haskell
-- ^ punctuation.separator.continuation.haskell
-- ^^^^^^^^^^ meta.string.haskell string.quoted.double.haskell
-- ^^ meta.string.continuation.haskell - string
-- ^ punctuation.definition.continuation.begin.haskell
"This is a\
\multi-line string literal\
\example"
-- ^^^^^^^^^ meta.string.haskell string.quoted.double.haskell
-- ^ punctuation.separator.continuation.haskell
-- <- meta.string.continuation.haskell - string
-- ^^ meta.string.continuation.haskell - string
-- ^ punctuation.definition.continuation.end.haskell
-- ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.string.haskell string.quoted.double.haskell
-- ^^ meta.string.continuation.haskell - string
-- ^ punctuation.definition.continuation.begin.haskell
"This is a\
\multi-line string literal\
/example"
-- <- meta.string.continuation.haskell - string
-- ^^ meta.string.continuation.haskell - string
-- ^ invalid.illegal.expect-continuation-end.haskell
-- ^^^^^^^^ meta.string.haskell string.quoted.double.haskell
-- ^ punctuation.definition.string.end.haskell
"This is a\
"
-- <- meta.string.continuation.haskell - string
-- ^^ meta.string.continuation.haskell - string
-- ^ invalid.illegal.expect-continuation-end.haskell
-- ^ - meta.string - string - invalid
-- [ INFIX OPERATORS ] --------------------------------------------------------
! # $ % & + . / < = > ? @ \ ^ | - ~ : -- ascii symbols
Expand Down

0 comments on commit c6f01ca

Please sign in to comment.