Rui Barreiroadded jsonbb6aaad6 years agoHistory
41 lines · 837 B · Text
RawDownload
module Language.JSON.String.Lexer import Language.JSON.String.Tokensimport Text.Lexer %default total exportquo : Lexerquo = is '"' exportesc : Lexer -> Lexeresc = escape '\\' privateunicodeEscape : LexerunicodeEscape = esc $ is 'u' <+> count (exactly 4) hexDigit privatesimpleEscape : LexersimpleEscape = esc $ oneOf "\"\\/bfnrt" privatelegalChar : LexerlegalChar = non (quo <|> is '\\' <|> control) privatejsonStringTokenMap : TokenMap JSONStringTokenjsonStringTokenMap = toTokenMap $  [ (quo, JSTQuote)  , (unicodeEscape, JSTUnicodeEscape)  , (simpleEscape, JSTSimpleEscape)  , (legalChar, JSTChar)  ] exportlexString : String -> Maybe (List JSONStringToken)lexString x = case lex jsonStringTokenMap x of                   (toks, _, _, "") => Just $ map TokenData.tok toks                   _ => Nothing

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t