diff options
author | Marvin Borner | 2022-08-31 00:50:16 +0200 |
---|---|---|
committer | Marvin Borner | 2022-08-31 00:50:16 +0200 |
commit | 906fe10ab27f010f676c0c05d9b81abd15225c6a (patch) | |
tree | 05da144d2e6f586fac0cfa497ca492c105502dce /src/Parser.hs | |
parent | 7209f9dde5ea9085cf61a7210be836e1e7f8dcc7 (diff) |
Unicodification
I like unicode, sorry if you have a different opinion
Diffstat (limited to 'src/Parser.hs')
-rw-r--r-- | src/Parser.hs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/Parser.hs b/src/Parser.hs index 15400f6..1952cde 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -17,10 +17,6 @@ type Parser = Parsec Void String sc :: Parser () sc = void $ char ' ' --- "'" can't be in special chars because of 'c' char notation and prefixation -specialChar :: Parser Char -specialChar = oneOf "!?*@.,:;+-_#$%^&<>/\\|{}~=" - -- lower or upper greekLetter :: Parser Char greekLetter = satisfy isGreek @@ -31,20 +27,26 @@ emoticon = satisfy isEmoticon where isEmoticon c = ('\128512' <= c && c <= '\128591') mathematicalOperator :: Parser Char -mathematicalOperator = satisfy isMathematicalOperator - where isMathematicalOperator c = '∀' <= c && c <= '⋿' +mathematicalOperator = satisfy isMathematicalUnicodeBlock + <|> oneOf "¬₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾" + where isMathematicalUnicodeBlock c = ('∀' <= c && c <= '⋿') mathematicalArrow :: Parser Char mathematicalArrow = satisfy isMathematicalOperator where isMathematicalOperator c = '←' <= c && c <= '⇿' +-- "'" can't be in special chars because of 'c' char notation and prefixation +specialChar :: Parser Char +specialChar = + oneOf "!?*@.,:;+-_#$%^&<>/\\|{}~=" + <|> mathematicalOperator + <|> mathematicalArrow + mixfixNone :: Parser MixfixIdentifierKind mixfixNone = char '…' >> pure MixfixNone mixfixSome :: Parser MixfixIdentifierKind -mixfixSome = - MixfixSome - <$> (some $ specialChar <|> mathematicalOperator <|> mathematicalArrow) +mixfixSome = MixfixSome <$> (some specialChar) mixfixOperator :: Parser Identifier mixfixOperator = normalMixfix <|> namespacedMixfix @@ -55,8 +57,7 @@ mixfixOperator = normalMixfix <|> namespacedMixfix prefixOperator :: Parser Identifier prefixOperator = normalPrefix <|> namespacedPrefix where - normalPrefix = PrefixFunction - <$> some (specialChar <|> mathematicalOperator <|> mathematicalArrow) + normalPrefix = PrefixFunction <$> some specialChar namespacedPrefix = NamespacedFunction <$> dottedNamespace <*> prefixOperator defIdentifier :: Parser Identifier |