{-# OPTIONS  #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Language.C.Parser.Tokens
-- Copyright   :  [1999..2004] Manuel M T Chakravarty
--                2005 Duncan Coutts
-- License     :  BSD-style
-- Maintainer  :  benedikt.huber@gmail.com
-- Portability :  portable
--
--  C Tokens for the C lexer.
--
-----------------------------------------------------------------------------
module Language.C.Parser.Tokens (CToken(..), posLenOfTok, GnuCTok(..), ClangCTok(..)) where

import Language.C.Data.Position    (Position, Pos(..), PosLength)
import Language.C.Data.Ident       (Ident, identToString)
import Language.C.Syntax.Constants (CChar, CInteger, CFloat, CString, ClangCVersion)

-- token definition
-- ----------------

-- possible tokens (EXPORTED)
--
data CToken = CTokLParen   !PosLength            -- `('
            | CTokRParen   !PosLength            -- `)'
            | CTokLBracket !PosLength            -- `['
            | CTokRBracket !PosLength            -- `]'
            | CTokArrow    !PosLength            -- `->'
            | CTokDot      !PosLength            -- `.'
            | CTokExclam   !PosLength            -- `!'
            | CTokTilde    !PosLength            -- `~'
            | CTokInc      !PosLength            -- `++'
            | CTokDec      !PosLength            -- `--'
            | CTokPlus     !PosLength            -- `+'
            | CTokMinus    !PosLength            -- `-'
            | CTokStar     !PosLength            -- `*'
            | CTokSlash    !PosLength            -- `/'
            | CTokPercent  !PosLength            -- `%'
            | CTokAmper    !PosLength            -- `&'
            | CTokShiftL   !PosLength            -- `<<'
            | CTokShiftR   !PosLength            -- `>>'
            | CTokLess     !PosLength            -- `<'
            | CTokLessEq   !PosLength            -- `<='
            | CTokHigh     !PosLength            -- `>'
            | CTokHighEq   !PosLength            -- `>='
            | CTokEqual    !PosLength            -- `=='
            | CTokUnequal  !PosLength            -- `!='
            | CTokHat      !PosLength            -- `^'
            | CTokBar      !PosLength            -- `|'
            | CTokAnd      !PosLength            -- `&&'
            | CTokOr       !PosLength            -- `||'
            | CTokQuest    !PosLength            -- `?'
            | CTokColon    !PosLength            -- `:'
            | CTokAssign   !PosLength            -- `='
            | CTokPlusAss  !PosLength            -- `+='
            | CTokMinusAss !PosLength            -- `-='
            | CTokStarAss  !PosLength            -- `*='
            | CTokSlashAss !PosLength            -- `/='
            | CTokPercAss  !PosLength            -- `%='
            | CTokAmpAss   !PosLength            -- `&='
            | CTokHatAss   !PosLength            -- `^='
            | CTokBarAss   !PosLength            -- `|='
            | CTokSLAss    !PosLength            -- `<<='
            | CTokSRAss    !PosLength            -- `>>='
            | CTokComma    !PosLength            -- `,'
            | CTokSemic    !PosLength            -- `;'
            | CTokLBrace   !PosLength            -- `{'
            | CTokRBrace   !PosLength            -- `}'
            | CTokEllipsis !PosLength            -- `...'
            | CTokAlignof  !PosLength            -- `alignof'
                                                -- (or `__alignof',
                                                -- `__alignof__')
            | CTokAlignas  !PosLength            -- `_Alignas'
            | CTokAsm      !PosLength            -- `asm'
                                                -- (or `__asm',
                                                -- `__asm__')
            | CTokAtomic   !PosLength            -- `_Atomic'
            | CTokAuto     !PosLength            -- `auto'
            | CTokBreak    !PosLength            -- `break'
            | CTokBool     !PosLength            -- `_Bool'
            | CTokCase     !PosLength            -- `case'
            | CTokChar     !PosLength            -- `char'
            | CTokConst    !PosLength            -- `const'
                                                -- (or `__const', `__const__')
            | CTokContinue !PosLength            -- `continue'
            | CTokComplex  !PosLength            -- `_Complex'
            | CTokDefault  !PosLength            -- `default'
            | CTokDo       !PosLength            -- `do'
            | CTokDouble   !PosLength            -- `double'
            | CTokElse     !PosLength            -- `else'
            | CTokEnum     !PosLength            -- `enum'
            | CTokExtern   !PosLength            -- `extern'
            | CTokFloat    !PosLength            -- `float'
            | CTokFloatN !Int !Bool !PosLength   -- `__float128' or `_Float{32,64,128}{,x}`
            | CTokFor      !PosLength            -- `for'
            | CTokGeneric  !PosLength            -- `_Generic'
            | CTokGoto     !PosLength            -- `goto'
            | CTokIf       !PosLength            -- `if'
            | CTokInline   !PosLength            -- `inline'
                                                -- (or `__inline',
                                                -- `__inline__')
            | CTokInt      !PosLength            -- `int'
            | CTokInt128   !PosLength            -- `__int128`
                                                 -- (or `__int128_t`)
            | CTokLong     !PosLength            -- `long'
            | CTokLabel    !PosLength            -- `__label__
            | CTokNoreturn !PosLength            -- `_Noreturn'
            | CTokNullable !PosLength            -- `_Nullable'
            | CTokNonnull  !PosLength            -- `_Nonnull'
            | CTokRegister !PosLength            -- `register'
            | CTokRestrict !PosLength            -- `restrict'
                                                -- (or `__restrict',
                                                -- `__restrict__')
            | CTokReturn   !PosLength            -- `return'
            | CTokShort    !PosLength            -- `short'
            | CTokSigned   !PosLength            -- `signed'
                                                -- (or `__signed',
                                                -- `__signed__')
            | CTokSizeof   !PosLength            -- `sizeof'
            | CTokStatic   !PosLength            -- `static'
            | CTokStaticAssert !PosLength        -- `_Static_assert'
            | CTokStruct   !PosLength            -- `struct'
            | CTokSwitch   !PosLength            -- `switch'
            | CTokTypedef  !PosLength            -- `typedef'
            | CTokTypeof   !PosLength            -- `typeof'
            | CTokThread   !PosLength            -- `__thread'
            | CTokUInt128  !PosLength            -- `__uint128`
                                                 -- (or `__uint128_t`)
            | CTokUnion    !PosLength            -- `union'
            | CTokUnsigned !PosLength            -- `unsigned'
            | CTokVoid     !PosLength            -- `void'
            | CTokVolatile !PosLength            -- `volatile'
                                                -- (or `__volatile',
                                                -- `__volatile__')
            | CTokWhile    !PosLength            -- `while'
            | CTokCLit     !PosLength !CChar     -- character constant
            | CTokILit     !PosLength !CInteger  -- integer constant
            | CTokFLit     !PosLength CFloat     -- float constant
            | CTokSLit     !PosLength CString    -- string constant
            | CTokIdent    !PosLength !Ident     -- identifier

              -- not generated here, but in `CParser.parseCHeader'
            | CTokTyIdent  !PosLength !Ident     -- `typedef-name' identifier
            | CTokGnuC !GnuCTok !PosLength       -- special GNU C tokens
            | CTokClangC !PosLength !ClangCTok   -- special Clang C tokens
            | CTokClKernel !PosLength            -- OpenCL `__kernel'
            | CTokClRdOnly !PosLength            -- OpenCL `__read_only'
            | CTokClWrOnly !PosLength            -- OpenCL `__write_only'
            | CTokClGlobal !PosLength            -- OpenCL `__Global'
            | CTokClLocal  !PosLength            -- OpenCL `__Local'
            | CTokEof                           -- end of file

-- special tokens used in GNU C extensions to ANSI C
--
data GnuCTok = GnuCAttrTok              -- `__attribute__'
             | GnuCExtTok               -- `__extension__'
             | GnuCVaArg                -- `__builtin_va_arg'
             | GnuCOffsetof             -- `__builtin_offsetof'
             | GnuCTyCompat             -- `__builtin_types_compatible_p'
             | GnuCComplexReal          -- `__real__'
             | GnuCComplexImag          -- `__imag__'

data ClangCTok = ClangCVersionTok !ClangCVersion -- version constant from 'availability' attribute
               | ClangBuiltinConvertVector
               | ClangCBitCast                   -- `__builtin_bit_cast`

instance Pos CToken where
  posOf :: CToken -> Position
posOf = (Position, Int) -> Position
forall a b. (a, b) -> a
fst ((Position, Int) -> Position)
-> (CToken -> (Position, Int)) -> CToken -> Position
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CToken -> (Position, Int)
posLenOfTok

-- token position and length
posLenOfTok :: CToken -> (Position,Int)
posLenOfTok :: CToken -> (Position, Int)
posLenOfTok (CTokLParen   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokRParen   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokLBracket (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokRBracket (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokArrow    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokDot      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokExclam   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokTilde    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokInc      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokDec      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokPlus     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokMinus    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokStar     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSlash    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokPercent  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAmper    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokShiftL   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokShiftR   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokLess     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokLessEq   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokHigh     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokHighEq   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokEqual    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokUnequal  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokHat      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokBar      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAnd      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokOr       (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokQuest    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokColon    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAssign   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokPlusAss  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokMinusAss (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokStarAss  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSlashAss (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokPercAss  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAmpAss   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokHatAss   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokBarAss   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSLAss    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSRAss    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokComma    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSemic    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokLBrace   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokRBrace   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokEllipsis (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAlignof  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAlignas  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAsm      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAtomic   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokAuto     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokBreak    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokBool     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokCase     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokChar     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokConst    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokContinue (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokComplex  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokDefault  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokDo       (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokDouble   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokElse     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokEnum     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokExtern   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokFloat    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokFloatN Int
_ Bool
_ (Position, Int)
pos) = (Position, Int)
pos
posLenOfTok (CTokFor      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokGeneric  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokGoto     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokInt      (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokInt128   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokInline   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokIf       (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokLong     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokLabel    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokNoreturn (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokNullable (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokNonnull  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokRegister (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokRestrict (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokReturn   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokShort    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSigned   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSizeof   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokStatic   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokStaticAssert (Position, Int)
pos) = (Position, Int)
pos
posLenOfTok (CTokStruct   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokSwitch   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokTypedef  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokTypeof   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokThread   (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokUInt128  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokUnion    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokUnsigned (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokVoid     (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokVolatile (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokWhile    (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokCLit     (Position, Int)
pos CChar
_) = (Position, Int)
pos
posLenOfTok (CTokILit     (Position, Int)
pos CInteger
_) = (Position, Int)
pos
posLenOfTok (CTokFLit     (Position, Int)
pos CFloat
_) = (Position, Int)
pos
posLenOfTok (CTokSLit     (Position, Int)
pos CString
_) = (Position, Int)
pos
posLenOfTok (CTokIdent    (Position, Int)
pos Ident
_) = (Position, Int)
pos
posLenOfTok (CTokTyIdent  (Position, Int)
pos Ident
_) = (Position, Int)
pos
posLenOfTok (CTokGnuC   GnuCTok
_ (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokClangC   (Position, Int)
pos ClangCTok
_) = (Position, Int)
pos
posLenOfTok (CTokClKernel (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokClRdOnly (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokClWrOnly (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokClGlobal (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok (CTokClLocal  (Position, Int)
pos  ) = (Position, Int)
pos
posLenOfTok CToken
CTokEof = [Char] -> (Position, Int)
forall a. HasCallStack => [Char] -> a
error [Char]
"tokenPos: Eof"

instance Show CToken where
  showsPrec :: Int -> CToken -> ShowS
showsPrec Int
_ (CTokLParen   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"("
  showsPrec Int
_ (CTokRParen   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
")"
  showsPrec Int
_ (CTokLBracket (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"["
  showsPrec Int
_ (CTokRBracket (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"]"
  showsPrec Int
_ (CTokArrow    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"->"
  showsPrec Int
_ (CTokDot      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"."
  showsPrec Int
_ (CTokExclam   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"!"
  showsPrec Int
_ (CTokTilde    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"~"
  showsPrec Int
_ (CTokInc      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"++"
  showsPrec Int
_ (CTokDec      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"--"
  showsPrec Int
_ (CTokPlus     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"+"
  showsPrec Int
_ (CTokMinus    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"-"
  showsPrec Int
_ (CTokStar     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"*"
  showsPrec Int
_ (CTokSlash    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"/"
  showsPrec Int
_ (CTokPercent  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"%"
  showsPrec Int
_ (CTokAmper    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"&"
  showsPrec Int
_ (CTokShiftL   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"<<"
  showsPrec Int
_ (CTokShiftR   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
">>"
  showsPrec Int
_ (CTokLess     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"<"
  showsPrec Int
_ (CTokLessEq   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"<="
  showsPrec Int
_ (CTokHigh     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
">"
  showsPrec Int
_ (CTokHighEq   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
">="
  showsPrec Int
_ (CTokEqual    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"=="
  showsPrec Int
_ (CTokUnequal  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"!="
  showsPrec Int
_ (CTokHat      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"^"
  showsPrec Int
_ (CTokBar      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"|"
  showsPrec Int
_ (CTokAnd      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"&&"
  showsPrec Int
_ (CTokOr       (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"||"
  showsPrec Int
_ (CTokQuest    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"?"
  showsPrec Int
_ (CTokColon    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
":"
  showsPrec Int
_ (CTokAssign   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"="
  showsPrec Int
_ (CTokPlusAss  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"+="
  showsPrec Int
_ (CTokMinusAss (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"-="
  showsPrec Int
_ (CTokStarAss  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"*="
  showsPrec Int
_ (CTokSlashAss (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"/="
  showsPrec Int
_ (CTokPercAss  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"%="
  showsPrec Int
_ (CTokAmpAss   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"&="
  showsPrec Int
_ (CTokHatAss   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"^="
  showsPrec Int
_ (CTokBarAss   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"|="
  showsPrec Int
_ (CTokSLAss    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"<<="
  showsPrec Int
_ (CTokSRAss    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
">>="
  showsPrec Int
_ (CTokComma    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
","
  showsPrec Int
_ (CTokSemic    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
";"
  showsPrec Int
_ (CTokLBrace   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"{"
  showsPrec Int
_ (CTokRBrace   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"}"
  showsPrec Int
_ (CTokEllipsis (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"..."
  showsPrec Int
_ (CTokAlignof  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"alignof"
  showsPrec Int
_ (CTokAlignas  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Alignas"
  showsPrec Int
_ (CTokAsm      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"asm"
  showsPrec Int
_ (CTokAtomic      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Atomic"
  showsPrec Int
_ (CTokAuto     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"auto"
  showsPrec Int
_ (CTokBool (Position, Int)
_)       = [Char] -> ShowS
showString [Char]
"_Bool"
  showsPrec Int
_ (CTokBreak    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"break"
  showsPrec Int
_ (CTokCase     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"case"
  showsPrec Int
_ (CTokChar     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"char"
  showsPrec Int
_ (CTokComplex (Position, Int)
_)    = [Char] -> ShowS
showString [Char]
"_Complex"
  showsPrec Int
_ (CTokConst    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"const"
  showsPrec Int
_ (CTokContinue (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"continue"
  showsPrec Int
_ (CTokDefault  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"default"
  showsPrec Int
_ (CTokDouble   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"double"
  showsPrec Int
_ (CTokDo       (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"do"
  showsPrec Int
_ (CTokElse     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"else"
  showsPrec Int
_ (CTokEnum     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"enum"
  showsPrec Int
_ (CTokExtern   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"extern"
  showsPrec Int
_ (CTokFloat    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"float"
  showsPrec Int
_ (CTokFloatN Int
n Bool
x (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"_Float" ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Show a => a -> ShowS
shows Int
n ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                                   [Char] -> ShowS
showString (if Bool
x then [Char]
"x" else [Char]
"")
  showsPrec Int
_ (CTokFor      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"for"
  showsPrec Int
_ (CTokGeneric  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Generic"
  showsPrec Int
_ (CTokGoto     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"goto"
  showsPrec Int
_ (CTokIf       (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"if"
  showsPrec Int
_ (CTokInline   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"inline"
  showsPrec Int
_ (CTokInt      (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"int"
  showsPrec Int
_ (CTokInt128   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__int128"
  showsPrec Int
_ (CTokLong     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"long"
  showsPrec Int
_ (CTokLabel    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__label__"
  showsPrec Int
_ (CTokNoreturn    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Noreturn"
  showsPrec Int
_ (CTokNullable    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Nullable"
  showsPrec Int
_ (CTokNonnull     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Nonnull"
  showsPrec Int
_ (CTokRegister (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"register"
  showsPrec Int
_ (CTokRestrict (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"restrict"
  showsPrec Int
_ (CTokReturn   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"return"
  showsPrec Int
_ (CTokShort    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"short"
  showsPrec Int
_ (CTokSigned   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"signed"
  showsPrec Int
_ (CTokSizeof   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"sizeof"
  showsPrec Int
_ (CTokStatic   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"static"
  showsPrec Int
_ (CTokStaticAssert   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Static_assert"
  showsPrec Int
_ (CTokStruct   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"struct"
  showsPrec Int
_ (CTokSwitch   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"switch"
  showsPrec Int
_ (CTokTypedef  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"typedef"
  showsPrec Int
_ (CTokTypeof   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"typeof"
  showsPrec Int
_ (CTokThread   (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"_Thread_local"
  showsPrec Int
_ (CTokUInt128  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__uint128"
  showsPrec Int
_ (CTokUnion    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"union"
  showsPrec Int
_ (CTokUnsigned (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"unsigned"
  showsPrec Int
_ (CTokVoid     (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"void"
  showsPrec Int
_ (CTokVolatile (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"volatile"
  showsPrec Int
_ (CTokWhile    (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"while"
  showsPrec Int
_ (CTokCLit     (Position, Int)
_ CChar
c) = CChar -> ShowS
forall a. Show a => a -> ShowS
shows CChar
c
  showsPrec Int
_ (CTokILit     (Position, Int)
_ CInteger
i) = CInteger -> ShowS
forall a. Show a => a -> ShowS
shows CInteger
i
  showsPrec Int
_ (CTokFLit     (Position, Int)
_ CFloat
f) = CFloat -> ShowS
forall a. Show a => a -> ShowS
shows CFloat
f
  showsPrec Int
_ (CTokSLit     (Position, Int)
_ CString
s) = CString -> ShowS
forall a. Show a => a -> ShowS
shows CString
s
  showsPrec Int
_ (CTokIdent    (Position, Int)
_ Ident
i) = ([Char] -> ShowS
showString ([Char] -> ShowS) -> (Ident -> [Char]) -> Ident -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ident -> [Char]
identToString) Ident
i
  showsPrec Int
_ (CTokTyIdent  (Position, Int)
_ Ident
i) = ([Char] -> ShowS
showString ([Char] -> ShowS) -> (Ident -> [Char]) -> Ident -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ident -> [Char]
identToString) Ident
i
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCAttrTok (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__attribute__"
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCExtTok  (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__extension__"
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCComplexReal (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__real__"
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCComplexImag  (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__imag__"
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCVaArg    (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__builtin_va_arg"
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCOffsetof (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__builtin_offsetof"
  showsPrec Int
_ (CTokGnuC GnuCTok
GnuCTyCompat (Position, Int)
_) = [Char] -> ShowS
showString [Char]
"__builtin_types_compatible_p"
  showsPrec Int
_ (CTokClangC (Position, Int)
_ (ClangCVersionTok ClangCVersion
v)) = ClangCVersion -> ShowS
forall a. Show a => a -> ShowS
shows ClangCVersion
v
  showsPrec Int
_ (CTokClangC (Position, Int)
_ ClangCTok
ClangBuiltinConvertVector) = [Char] -> ShowS
showString [Char]
"__builtin_convertvector"
  showsPrec Int
_ (CTokClangC (Position, Int)
_ ClangCTok
ClangCBitCast) = [Char] -> ShowS
showString [Char]
"__builtin_bit_cast"
  showsPrec Int
_ (CTokClKernel (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__kernel"
  showsPrec Int
_ (CTokClRdOnly (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__read_only"
  showsPrec Int
_ (CTokClWrOnly (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__write_only"
  showsPrec Int
_ (CTokClGlobal (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__global"
  showsPrec Int
_ (CTokClLocal  (Position, Int)
_  ) = [Char] -> ShowS
showString [Char]
"__Local"
  showsPrec Int
_ CToken
CTokEof = [Char] -> ShowS
forall a. HasCallStack => [Char] -> a
error [Char]
"show CToken : CTokEof"