Safe HaskellNone

AronToken

Synopsis

Documentation

isOp :: Char -> Bool Source #

isSpaceX :: Char -> Bool Source #

isLetterDigit :: Char -> Bool Source #

alnums :: String -> (String, String) Source #

===

       ab12- => (ab12, -)

       "" "ab12-"

       "a" "b12-"
       "ab" "12-"
       "ab1" "2-"
       "ab12" "-"

   

alphaStr :: String -> String -> (String, String) Source #

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 #

spanX :: (a -> Bool) -> [a] -> [a] -> ([a], [a]) Source #

getWSpace :: String -> String -> (String, String) Source #

isStrDQ :: (String, String) -> Bool Source #

getStrDQ :: String -> String -> (String, String) Source #

yesDQ :: String -> String -> (String, String) Source #

oneDQ :: String -> String -> (String, String) Source #

isStrSQ :: (String, String) -> Bool Source #

isSQ :: Char -> Bool Source #

oneSQ :: String -> String -> (String, String) Source #

nonSQ :: String -> String -> (String, String) Source #

nonDQ :: String -> String -> (String, String) Source #

String has no Double Quotes

getStrSQ :: String -> String -> (String, String) Source #

    getStrSQ "" abcdef => ("ab", "efg")
    getStrSQ "" "'abc"   => ("",   "'abc")
    getStrSQ "" "''abc"  => ("''",   "'abc")

  

isDoubleQuote :: Char -> Bool Source #

Single Quotes String

isDQ :: Char -> Bool Source #

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 #

getEqual :: 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 #

getGT :: String -> String -> (String, String) Source #

getLT :: String -> String -> (String, String) Source #

getSub :: String -> String -> (String, String) Source #

===

   Subtraction: -
   

getSUb :: [Char] -> [Char] -> ([Char], [Char]) Source #

getRCB :: String -> String -> (String, String) Source #

Get Right Curly Bracket

getLCB :: String -> String -> (String, String) Source #

Get Left Curly Bracket

getRP :: String -> String -> (String, String) Source #

Get Right Parenthese or Right Round Bracket

getLP :: String -> String -> (String, String) Source #

Get Left Parenthese or Left Round Bracket

getRSB :: String -> String -> (String, String) Source #

Get Right Square Bracket

getLSB :: String -> String -> (String, String) Source #

Get Left Square Bracket

data Token Source #

Constructors

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 

Instances

Instances details
Eq Token Source # 
Instance details

Defined in AronToken

Methods

(==) :: Token -> Token -> Bool

(/=) :: Token -> Token -> Bool

Show Token Source # 
Instance details

Defined in AronToken

Methods

showsPrec :: Int -> Token -> ShowS

show :: Token -> String

showList :: [Token] -> ShowS

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 #

matchStr :: Int -> [Token] -> [String] Source #

px :: Int -> String -> IO () Source #

highlight :: String -> IO () Source #

KEY: color string

USE AronToken

    highlight "{abc}"
  

highlightStr :: String -> String Source #

KEY: color string

USE AronToken

    putStr $ highlightStr "{abc}"
  

testAll :: IO () Source #