Skip to content

Commit e679382

Browse files
committed
Fix #175 (unicode forall syntax)
1 parent 4c9905e commit e679382

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
- Recognize indented `\begin{code}` boundary in literate haskell files.
77
- Fix highlighting of symbolic data constructors within fixity declarations (e.g. `infixl 9 :$`).
88
- Add `meta.embedded.block.{quasi-quoter}` scope to quasi-quotations.
9+
- Ensure highlighting of unicode forall syntax matches that of alphabetic forall syntax
10+
([#175](https://github.com/JustusAdam/language-haskell/issues/175)).
911

1012
## 3.3.0 - 25.06.2020
1113

syntaxes/haskell.YAML-tmLanguage

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,8 @@ repository:
14021402
patterns:
14031403
# Fully reserved symbols,
14041404
# not including '::' (special treatment as it starts type highlighting),
1405-
# nor '=>' (it highlights its precedent as a type).
1405+
# nor '=>' (it highlights its precedent as a type),
1406+
# nor '∀' (highlights subsequent dot for quantification).
14061407
- match: >-
14071408
(?x)
14081409
(?<![\p{S}\p{P}&&[^(),;\[\]`{}_"'']])
@@ -1418,7 +1419,6 @@ repository:
14181419
|(-<<|⤛)
14191420
|(>-|⤚)
14201421
|(>>-|⤜)
1421-
|(∀)
14221422
)
14231423
(?![\p{S}\p{P}&&[^(),;\[\]`{}_"'']])
14241424
captures:
@@ -1433,7 +1433,6 @@ repository:
14331433
'9': {name: keyword.operator.arrow.left.tail.double.haskell}
14341434
'10': {name: keyword.operator.arrow.tail.haskell}
14351435
'11': {name: keyword.operator.arrow.tail.double.haskell}
1436-
'12': {name: keyword.other.forall.haskell}
14371436
# Reserved postfix symbol: '#'
14381437
# This allows users to specify highlighting of '#' dependent on theme,
14391438
# as we are unfortunately unable to make a decision based on enabled extensions.
@@ -1501,10 +1500,27 @@ repository:
15011500
'4': {name: storage.type.infix.haskell}
15021501
'5': {name: punctuation.backtick.haskell}
15031502
forall:
1504-
begin: '\b(?<!'')(forall|∀)\b(?!'')'
1503+
begin: >-
1504+
(?x)
1505+
# Alphabetic forall
1506+
(?:
1507+
\b(?<!')
1508+
(forall)
1509+
\b(?!')
1510+
)
1511+
|
1512+
# Symbolic forall
1513+
(?:
1514+
# Not preceded by a symbol except reserved symbols
1515+
(?<![\p{S}\p{P}&&[^(),;\[\]`{}_"'']])
1516+
(∀)
1517+
# Not followed by a symbol except reserved symbols
1518+
(?![\p{S}\p{P}&&[^(),;\[\]`{}_"'']])
1519+
)
15051520
end: '(\.)|(->|→)'
15061521
beginCaptures:
15071522
'1': {name: keyword.other.forall.haskell}
1523+
'2': {name: keyword.other.forall.haskell}
15081524
endCaptures:
15091525
'1': {name: keyword.operator.period.haskell}
15101526
'2': {name: keyword.operator.arrow.haskell}

test/tickets/T0175.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-- SYNTAX TEST "source.haskell" "Unicode forall"
2+
3+
foo :: ( a. Num a => a -> a) -> (Int,Double) -> (Int,Double)
4+
-- ^ keyword.other.forall.haskell
5+
-- ^ keyword.operator.period.haskell
6+
foo f (a,b) = (f a, f b)
7+
8+
bar :: (forall a. Num a => a -> a) -> (Int,Double) -> (Int,Double)
9+
-- ^^^^^^ keyword.other.forall.haskell
10+
-- ^ keyword.operator.period.haskell
11+
bar f (a,b) = (f a, f b)
12+
13+
notForall :: x ∀∀ y -> z
14+
-- ^^ - keyword.other.forall.haskell

0 commit comments

Comments
 (0)