Safe Haskell | None |
---|
Synopsis
- isOp :: Char -> Bool
- isSpaceX :: Char -> Bool
- isLetterDigit :: Char -> Bool
- alnums :: String -> (String, String)
- alphaStr :: String -> String -> (String, String)
- alphaDigitStr :: String -> String -> (String, String)
- getAlphaNum2 :: String -> String -> (String, String)
- getDigit :: String -> String -> (String, String)
- getNegativeInt :: String -> String -> (String, String)
- spanX :: (a -> Bool) -> [a] -> [a] -> ([a], [a])
- getWSpace :: String -> String -> (String, String)
- isStrDQ :: (String, String) -> Bool
- getStrDQ :: String -> String -> (String, String)
- yesDQ :: String -> String -> (String, String)
- oneDQ :: String -> String -> (String, String)
- isStrSQ :: (String, String) -> Bool
- isSQ :: Char -> Bool
- oneSQ :: String -> String -> (String, String)
- nonSQ :: String -> String -> (String, String)
- nonDQ :: String -> String -> (String, String)
- getStrSQ :: String -> String -> (String, String)
- isDoubleQuote :: Char -> Bool
- isDQ :: Char -> Bool
- getEqualRightArrow :: String -> String -> (String, String)
- getTwoColon :: String -> String -> (String, String)
- getSubRightArrow :: String -> String -> (String, String)
- getTwoEqual :: String -> String -> (String, String)
- getEqual :: String -> String -> (String, String)
- getSingleQuote :: String -> String -> (String, String)
- getDoubleQuote :: String -> String -> (String, String)
- getForwardslash :: String -> String -> (String, String)
- getBackslash :: String -> String -> (String, String)
- getGT :: String -> String -> (String, String)
- getLT :: String -> String -> (String, String)
- getSub :: String -> String -> (String, String)
- getSUb :: [Char] -> [Char] -> ([Char], [Char])
- getRCB :: String -> String -> (String, String)
- getLCB :: String -> String -> (String, String)
- getRP :: String -> String -> (String, String)
- getLP :: String -> String -> (String, String)
- getRSB :: String -> String -> (String, String)
- getLSB :: String -> String -> (String, String)
- data Token
- = AlphaNum String
- | TokLP String
- | TokRP String
- | TokLCB String
- | TokRCB String
- | TokLSB String
- | TokRSB String
- | TokGT String
- | TokLT String
- | TokEqual String
- | TokSQ String
- | TokDQ String
- | TokColon String
- | TokForwardslash String
- | TokBackslash String
- | OpAdd String
- | OpSub String
- | OpDiv String
- | OpMul String
- | DQString String
- | SQString String
- | WSpace String
- | SymEqualRightArrow String
- | SymTwoColon String
- | SymSubRightArrow String
- | NegativeInt String
- | SymTwoEqual String
- | Unknown String
- | NumberX String
- tokenize :: String -> [Token]
- colorToken :: [Token] -> [String]
- leftPadNum :: [Token] -> [String]
- matchStr :: Int -> [Token] -> [String]
- px :: Int -> String -> IO ()
- highlight :: String -> IO ()
- highlightStr :: String -> String
- testAll :: IO ()
Documentation
isLetterDigit :: Char -> Bool Source #
alnums :: String -> (String, String) Source #
===
ab12- => (ab12, -) "" "ab12-" "a" "b12-" "ab" "12-" "ab1" "2-" "ab12" "-"
alphaDigitStr :: String -> String -> (String, String) Source #
getAlphaNum2 :: String -> String -> (String, String) Source #
getDigit :: String -> String -> (String, String) Source #
Extract digits from a string
getDigit "" "123abc" => ("123", "abc") getDigit "" "+123" => ("", "+123") getDigit KK "123ab" => ("123KK", "ab") [get KK "123ab" c = 1 [get KK "23ab" c = 2 [get KK "3ab" c = 3 [get KK "ab" c = a ] (KK, "ab") ] ("3KK" "ab") ] ("23KK" "ab") ] ("123KK" "ab")
accum inputStr (accum, restOfStr) ↓ ↓ ↓
getNegativeInt :: String -> String -> (String, String) Source #
getStrSQ :: String -> String -> (String, String) Source #
getStrSQ ""ab
cdef => ("ab
", "efg") getStrSQ "" "'abc" => ("", "'abc") getStrSQ "" "''abc" => ("''", "'abc")
isDoubleQuote :: Char -> Bool Source #
Single Quotes String
getEqualRightArrow :: String -> String -> (String, String) Source #
getTwoColon :: String -> String -> (String, String) Source #
getSubRightArrow :: String -> String -> (String, String) Source #
Single Quotes String
->
getTwoEqual :: String -> String -> (String, String) Source #
getSingleQuote :: String -> String -> (String, String) Source #
getDoubleQuote :: String -> String -> (String, String) Source #
getForwardslash :: String -> String -> (String, String) Source #
getBackslash :: String -> String -> (String, String) Source #
AlphaNum String | |
TokLP String | |
TokRP String | |
TokLCB String | |
TokRCB String | |
TokLSB String | |
TokRSB String | |
TokGT String | |
TokLT String | |
TokEqual String | |
TokSQ String | |
TokDQ String | |
TokColon String | |
TokForwardslash String | |
TokBackslash String | |
OpAdd String | |
OpSub String | |
OpDiv String | |
OpMul String | |
DQString String | |
SQString String | |
WSpace String | |
SymEqualRightArrow String | |
SymTwoColon String | |
SymSubRightArrow String | |
NegativeInt String | |
SymTwoEqual String | |
Unknown String | |
NumberX String |
tokenize :: String -> [Token] Source #
let s = "( 1 + 2 = 3 )" putStr $ (concat . colorToken) $ tokenize s
colorToken :: [Token] -> [String] Source #
KEY:
TODO: refactor the code
let s = "( 1 + 2 = 3 )"
putStr $ (concat . colorToken) $ tokenize s
leftPadNum :: [Token] -> [String] Source #
highlightStr :: String -> String Source #
KEY: color string
USE AronToken
putStr $ highlightStr "{abc}"