-- Character classification
{-# LANGUAGE CPP #-}
module Ctype
        ( is_ident      -- Char# -> Bool
        , is_symbol     -- Char# -> Bool
        , is_any        -- Char# -> Bool
        , is_space      -- Char# -> Bool
        , is_lower      -- Char# -> Bool
        , is_upper      -- Char# -> Bool
        , is_digit      -- Char# -> Bool
        , is_alphanum   -- Char# -> Bool

        , is_decdigit, is_hexdigit, is_octdigit, is_bindigit
        , hexDigit, octDecDigit
        ) where

#include "HsVersions.h"

import GhcPrelude

import Data.Int         ( Int32 )
import Data.Bits        ( Bits((.&.)) )
import Data.Char        ( ord, chr )
import Panic

-- Bit masks

cIdent, cSymbol, cAny, cSpace, cLower, cUpper, cDigit :: Int
cIdent :: Int
cIdent  =  1
cSymbol :: Int
cSymbol =  2
cAny :: Int
cAny    =  4
cSpace :: Int
cSpace  =  8
cLower :: Int
cLower  = 16
cUpper :: Int
cUpper  = 32
cDigit :: Int
cDigit  = 64

-- | The predicates below look costly, but aren't, GHC+GCC do a great job
-- at the big case below.

{-# INLINE is_ctype #-}
is_ctype :: Int -> Char -> Bool
is_ctype :: Int -> Char -> Bool
is_ctype mask :: Int
mask c :: Char
c = (Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Char -> Int
charType Char
c) Int32 -> Int32 -> Int32
forall a. Bits a => a -> a -> a
.&. Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
mask) Int32 -> Int32 -> Bool
forall a. Eq a => a -> a -> Bool
/= (0::Int32)

is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit,
    is_alphanum :: Char -> Bool
is_ident :: Char -> Bool
is_ident  = Int -> Char -> Bool
is_ctype Int
cIdent
is_symbol :: Char -> Bool
is_symbol = Int -> Char -> Bool
is_ctype Int
cSymbol
is_any :: Char -> Bool
is_any    = Int -> Char -> Bool
is_ctype Int
cAny
is_space :: Char -> Bool
is_space  = Int -> Char -> Bool
is_ctype Int
cSpace
is_lower :: Char -> Bool
is_lower  = Int -> Char -> Bool
is_ctype Int
cLower
is_upper :: Char -> Bool
is_upper  = Int -> Char -> Bool
is_ctype Int
cUpper
is_digit :: Char -> Bool
is_digit  = Int -> Char -> Bool
is_ctype Int
cDigit
is_alphanum :: Char -> Bool
is_alphanum = Int -> Char -> Bool
is_ctype (Int
cLowerInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
cUpperInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
cDigit)

-- Utils

hexDigit :: Char -> Int
hexDigit :: Char -> Int
hexDigit c :: Char
c | Char -> Bool
is_decdigit Char
c = Char -> Int
ord Char
c Int -> Int -> Int
forall a. Num a => a -> a -> a
- Char -> Int
ord '0'
           | Bool
otherwise     = Char -> Int
ord (Char -> Char
to_lower Char
c) Int -> Int -> Int
forall a. Num a => a -> a -> a
- Char -> Int
ord 'a' Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 10

octDecDigit :: Char -> Int
octDecDigit :: Char -> Int
octDecDigit c :: Char
c = Char -> Int
ord Char
c Int -> Int -> Int
forall a. Num a => a -> a -> a
- Char -> Int
ord '0'

is_decdigit :: Char -> Bool
is_decdigit :: Char -> Bool
is_decdigit c :: Char
c
        =  Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
>= '0' Bool -> Bool -> Bool
&& Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= '9'

is_hexdigit :: Char -> Bool
is_hexdigit :: Char -> Bool
is_hexdigit c :: Char
c
        =  Char -> Bool
is_decdigit Char
c
        Bool -> Bool -> Bool
|| (Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
>= 'a' Bool -> Bool -> Bool
&& Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= 'f')
        Bool -> Bool -> Bool
|| (Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
>= 'A' Bool -> Bool -> Bool
&& Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= 'F')

is_octdigit :: Char -> Bool
is_octdigit :: Char -> Bool
is_octdigit c :: Char
c = Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
>= '0' Bool -> Bool -> Bool
&& Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= '7'

is_bindigit :: Char -> Bool
is_bindigit :: Char -> Bool
is_bindigit c :: Char
c = Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== '0' Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== '1'

to_lower :: Char -> Char
to_lower :: Char -> Char
to_lower c :: Char
c
  | Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
>=  'A' Bool -> Bool -> Bool
&& Char
c Char -> Char -> Bool
forall a. Ord a => a -> a -> Bool
<= 'Z' = Int -> Char
chr (Char -> Int
ord Char
c Int -> Int -> Int
forall a. Num a => a -> a -> a
- (Char -> Int
ord 'A' Int -> Int -> Int
forall a. Num a => a -> a -> a
- Char -> Int
ord 'a'))
  | Bool
otherwise = Char
c

-- | We really mean .|. instead of + below, but GHC currently doesn't do
--  any constant folding with bitops. *sigh*

charType :: Char -> Int
charType :: Char -> Int
charType c :: Char
c = case Char
c of
   '\0'   -> 0                         -- \000
   '\1'   -> 0                         -- \001
   '\2'   -> 0                         -- \002
   '\3'   -> 0                         -- \003
   '\4'   -> 0                         -- \004
   '\5'   -> 0                         -- \005
   '\6'   -> 0                         -- \006
   '\7'   -> 0                         -- \007
   '\8'   -> 0                         -- \010
   '\9'   -> Int
cSpace                    -- \t  (not allowed in strings, so !cAny)
   '\10'  -> Int
cSpace                    -- \n  (ditto)
   '\11'  -> Int
cSpace                    -- \v  (ditto)
   '\12'  -> Int
cSpace                    -- \f  (ditto)
   '\13'  -> Int
cSpace                    --  ^M (ditto)
   '\14'  -> 0                         -- \016
   '\15'  -> 0                         -- \017
   '\16'  -> 0                         -- \020
   '\17'  -> 0                         -- \021
   '\18'  -> 0                         -- \022
   '\19'  -> 0                         -- \023
   '\20'  -> 0                         -- \024
   '\21'  -> 0                         -- \025
   '\22'  -> 0                         -- \026
   '\23'  -> 0                         -- \027
   '\24'  -> 0                         -- \030
   '\25'  -> 0                         -- \031
   '\26'  -> 0                         -- \032
   '\27'  -> 0                         -- \033
   '\28'  -> 0                         -- \034
   '\29'  -> 0                         -- \035
   '\30'  -> 0                         -- \036
   '\31'  -> 0                         -- \037
   '\32'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSpace             --
   '\33'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- !
   '\34'  -> Int
cAny                      -- "
   '\35'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            --  #
   '\36'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            --  $
   '\37'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- %
   '\38'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- &
   '\39'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent             -- '
   '\40'  -> Int
cAny                      -- (
   '\41'  -> Int
cAny                      -- )
   '\42'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            --  *
   '\43'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- +
   '\44'  -> Int
cAny                      -- ,
   '\45'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- -
   '\46'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- .
   '\47'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            --  /
   '\48'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 0
   '\49'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 1
   '\50'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 2
   '\51'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 3
   '\52'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 4
   '\53'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 5
   '\54'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 6
   '\55'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 7
   '\56'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 8
   '\57'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cDigit   -- 9
   '\58'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- :
   '\59'  -> Int
cAny                      -- ;
   '\60'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- <
   '\61'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- =
   '\62'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- >
   '\63'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- ?
   '\64'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- @
   '\65'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- A
   '\66'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- B
   '\67'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- C
   '\68'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- D
   '\69'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- E
   '\70'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- F
   '\71'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- G
   '\72'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- H
   '\73'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- I
   '\74'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- J
   '\75'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- K
   '\76'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- L
   '\77'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- M
   '\78'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- N
   '\79'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- O
   '\80'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- P
   '\81'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- Q
   '\82'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- R
   '\83'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- S
   '\84'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- T
   '\85'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- U
   '\86'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- V
   '\87'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- W
   '\88'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- X
   '\89'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- Y
   '\90'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cUpper   -- Z
   '\91'  -> Int
cAny                      -- [
   '\92'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- backslash
   '\93'  -> Int
cAny                      -- ]
   '\94'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            --  ^
   '\95'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- _
   '\96'  -> Int
cAny                      -- `
   '\97'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- a
   '\98'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- b
   '\99'  -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- c
   '\100' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- d
   '\101' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- e
   '\102' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- f
   '\103' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- g
   '\104' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- h
   '\105' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- i
   '\106' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- j
   '\107' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- k
   '\108' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- l
   '\109' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- m
   '\110' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- n
   '\111' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- o
   '\112' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- p
   '\113' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- q
   '\114' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- r
   '\115' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- s
   '\116' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- t
   '\117' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- u
   '\118' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- v
   '\119' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- w
   '\120' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- x
   '\121' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- y
   '\122' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cIdent  Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cLower   -- z
   '\123' -> Int
cAny                      -- {
   '\124' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            --  |
   '\125' -> Int
cAny                      -- }
   '\126' -> Int
cAny Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
cSymbol            -- ~
   '\127' -> 0                         -- \177
   _ -> String -> Int
forall a. String -> a
panic ("charType: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Char -> String
forall a. Show a => a -> String
show Char
c)