From c0ce15a3bacc9fe336f0e536a9b60512e8cc593e Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 23 Aug 2022 12:32:16 +0200 Subject: Allowed some unicode chars --- src/Parser.hs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Parser.hs b/src/Parser.hs index d60cddb..04b09e1 100644 --- a/src/Parser.hs +++ b/src/Parser.hs @@ -26,22 +26,36 @@ greekLetter :: Parser Char greekLetter = satisfy isGreek where isGreek c = ('Α' <= c && c <= 'Ω') || ('α' <= c && c <= 'ω') +emoticon :: Parser Char +emoticon = satisfy isEmoticon + where isEmoticon c = ('\128512' <= c && c <= '\128591') + +mathematicalOperator :: Parser Char +mathematicalOperator = satisfy isMathematicalOperator + where isMathematicalOperator c = '∀' <= c && c <= '⋿' + +mathematicalArrow :: Parser Char +mathematicalArrow = satisfy isMathematicalOperator + where isMathematicalOperator c = '←' <= c && c <= '⇿' + infixOperator :: Parser Identifier infixOperator = normalInfix <|> namespacedInfix where - normalInfix = InfixFunction <$> some specialChar + normalInfix = InfixFunction + <$> some (specialChar <|> mathematicalOperator <|> mathematicalArrow) namespacedInfix = NamespacedFunction <$> dottedNamespace <*> infixOperator prefixOperator :: Parser Identifier prefixOperator = normalPrefix <|> namespacedPrefix where - normalPrefix = PrefixFunction <$> some specialChar + normalPrefix = PrefixFunction + <$> some (specialChar <|> mathematicalOperator <|> mathematicalArrow) namespacedPrefix = NamespacedFunction <$> dottedNamespace <*> prefixOperator defIdentifier :: Parser Identifier defIdentifier = ( NormalFunction - <$> ((:) <$> (lowerChar <|> greekLetter) <*> many + <$> ((:) <$> (lowerChar <|> greekLetter <|> emoticon) <*> many (alphaNumChar <|> specialChar <|> char '\'') ) ) -- cgit v1.2.3