mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Allow unicode identifiers
This commit is contained in:
parent
9b08b6df3c
commit
c6bcd67523
7
examples/unicode.carp
Normal file
7
examples/unicode.carp
Normal file
@ -0,0 +1,7 @@
|
||||
(use IO)
|
||||
|
||||
(def 😀 \😀)
|
||||
|
||||
(defn main []
|
||||
(println &(str 😀))
|
||||
)
|
@ -8,6 +8,7 @@ import qualified Text.Parsec as Parsec
|
||||
-- import Text.Parsec.Pos (newPos)
|
||||
import qualified Data.Set as Set
|
||||
import qualified Data.Map as Map
|
||||
import Data.Char (ord)
|
||||
import Obj
|
||||
import Types
|
||||
import Util
|
||||
@ -223,7 +224,8 @@ symbolSegment :: Parsec.Parsec String ParseState String
|
||||
symbolSegment = do sym <- Parsec.many1 validInSymbol
|
||||
incColumn (length sym)
|
||||
return sym
|
||||
where validInSymbol = Parsec.choice [Parsec.letter, Parsec.digit, Parsec.oneOf validCharacters]
|
||||
where validInSymbol = Parsec.choice [Parsec.letter, Parsec.digit, Parsec.oneOf validCharacters, highCharacters]
|
||||
highCharacters = Parsec.satisfy ((> 127) . ord)
|
||||
|
||||
period :: Parsec.Parsec String ParseState ()
|
||||
period = do Parsec.char '.'
|
||||
|
Loading…
Reference in New Issue
Block a user