module Jikka.Python.Parse.Token where
import Data.Int (Int8)
import Jikka.Common.Location
data CmpOp
= DoubleEqual
| NotEqual
| LessThan
| LessEqual
| GreaterThan
| GreaterEqual
deriving (CmpOp -> CmpOp -> Bool
(CmpOp -> CmpOp -> Bool) -> (CmpOp -> CmpOp -> Bool) -> Eq CmpOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CmpOp -> CmpOp -> Bool
$c/= :: CmpOp -> CmpOp -> Bool
== :: CmpOp -> CmpOp -> Bool
$c== :: CmpOp -> CmpOp -> Bool
Eq, Eq CmpOp
Eq CmpOp
-> (CmpOp -> CmpOp -> Ordering)
-> (CmpOp -> CmpOp -> Bool)
-> (CmpOp -> CmpOp -> Bool)
-> (CmpOp -> CmpOp -> Bool)
-> (CmpOp -> CmpOp -> Bool)
-> (CmpOp -> CmpOp -> CmpOp)
-> (CmpOp -> CmpOp -> CmpOp)
-> Ord CmpOp
CmpOp -> CmpOp -> Bool
CmpOp -> CmpOp -> Ordering
CmpOp -> CmpOp -> CmpOp
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CmpOp -> CmpOp -> CmpOp
$cmin :: CmpOp -> CmpOp -> CmpOp
max :: CmpOp -> CmpOp -> CmpOp
$cmax :: CmpOp -> CmpOp -> CmpOp
>= :: CmpOp -> CmpOp -> Bool
$c>= :: CmpOp -> CmpOp -> Bool
> :: CmpOp -> CmpOp -> Bool
$c> :: CmpOp -> CmpOp -> Bool
<= :: CmpOp -> CmpOp -> Bool
$c<= :: CmpOp -> CmpOp -> Bool
< :: CmpOp -> CmpOp -> Bool
$c< :: CmpOp -> CmpOp -> Bool
compare :: CmpOp -> CmpOp -> Ordering
$ccompare :: CmpOp -> CmpOp -> Ordering
$cp1Ord :: Eq CmpOp
Ord, Int -> CmpOp -> ShowS
[CmpOp] -> ShowS
CmpOp -> String
(Int -> CmpOp -> ShowS)
-> (CmpOp -> String) -> ([CmpOp] -> ShowS) -> Show CmpOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CmpOp] -> ShowS
$cshowList :: [CmpOp] -> ShowS
show :: CmpOp -> String
$cshow :: CmpOp -> String
showsPrec :: Int -> CmpOp -> ShowS
$cshowsPrec :: Int -> CmpOp -> ShowS
Show, ReadPrec [CmpOp]
ReadPrec CmpOp
Int -> ReadS CmpOp
ReadS [CmpOp]
(Int -> ReadS CmpOp)
-> ReadS [CmpOp]
-> ReadPrec CmpOp
-> ReadPrec [CmpOp]
-> Read CmpOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CmpOp]
$creadListPrec :: ReadPrec [CmpOp]
readPrec :: ReadPrec CmpOp
$creadPrec :: ReadPrec CmpOp
readList :: ReadS [CmpOp]
$creadList :: ReadS [CmpOp]
readsPrec :: Int -> ReadS CmpOp
$creadsPrec :: Int -> ReadS CmpOp
Read)
data DivModOp
= Div
| FloorDiv
| FloorMod
| CeilDiv
| CeilMod
deriving (DivModOp -> DivModOp -> Bool
(DivModOp -> DivModOp -> Bool)
-> (DivModOp -> DivModOp -> Bool) -> Eq DivModOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DivModOp -> DivModOp -> Bool
$c/= :: DivModOp -> DivModOp -> Bool
== :: DivModOp -> DivModOp -> Bool
$c== :: DivModOp -> DivModOp -> Bool
Eq, Eq DivModOp
Eq DivModOp
-> (DivModOp -> DivModOp -> Ordering)
-> (DivModOp -> DivModOp -> Bool)
-> (DivModOp -> DivModOp -> Bool)
-> (DivModOp -> DivModOp -> Bool)
-> (DivModOp -> DivModOp -> Bool)
-> (DivModOp -> DivModOp -> DivModOp)
-> (DivModOp -> DivModOp -> DivModOp)
-> Ord DivModOp
DivModOp -> DivModOp -> Bool
DivModOp -> DivModOp -> Ordering
DivModOp -> DivModOp -> DivModOp
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DivModOp -> DivModOp -> DivModOp
$cmin :: DivModOp -> DivModOp -> DivModOp
max :: DivModOp -> DivModOp -> DivModOp
$cmax :: DivModOp -> DivModOp -> DivModOp
>= :: DivModOp -> DivModOp -> Bool
$c>= :: DivModOp -> DivModOp -> Bool
> :: DivModOp -> DivModOp -> Bool
$c> :: DivModOp -> DivModOp -> Bool
<= :: DivModOp -> DivModOp -> Bool
$c<= :: DivModOp -> DivModOp -> Bool
< :: DivModOp -> DivModOp -> Bool
$c< :: DivModOp -> DivModOp -> Bool
compare :: DivModOp -> DivModOp -> Ordering
$ccompare :: DivModOp -> DivModOp -> Ordering
$cp1Ord :: Eq DivModOp
Ord, Int -> DivModOp -> ShowS
[DivModOp] -> ShowS
DivModOp -> String
(Int -> DivModOp -> ShowS)
-> (DivModOp -> String) -> ([DivModOp] -> ShowS) -> Show DivModOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DivModOp] -> ShowS
$cshowList :: [DivModOp] -> ShowS
show :: DivModOp -> String
$cshow :: DivModOp -> String
showsPrec :: Int -> DivModOp -> ShowS
$cshowsPrec :: Int -> DivModOp -> ShowS
Show, ReadPrec [DivModOp]
ReadPrec DivModOp
Int -> ReadS DivModOp
ReadS [DivModOp]
(Int -> ReadS DivModOp)
-> ReadS [DivModOp]
-> ReadPrec DivModOp
-> ReadPrec [DivModOp]
-> Read DivModOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DivModOp]
$creadListPrec :: ReadPrec [DivModOp]
readPrec :: ReadPrec DivModOp
$creadPrec :: ReadPrec DivModOp
readList :: ReadS [DivModOp]
$creadList :: ReadS [DivModOp]
readsPrec :: Int -> ReadS DivModOp
$creadsPrec :: Int -> ReadS DivModOp
Read)
data AugOp
= AugAdd
| AugSub
| AugMul
| AugAt
| AugDiv
| AugFloorDiv
| AugFloorMod
| AugCeilDiv
| AugCeilMod
| AugPow
| AugBitRShift
| AugBitLShift
| AugBitAnd
| AugBitXor
| AugBitOr
| AugMin
| AugMax
deriving (AugOp -> AugOp -> Bool
(AugOp -> AugOp -> Bool) -> (AugOp -> AugOp -> Bool) -> Eq AugOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AugOp -> AugOp -> Bool
$c/= :: AugOp -> AugOp -> Bool
== :: AugOp -> AugOp -> Bool
$c== :: AugOp -> AugOp -> Bool
Eq, Eq AugOp
Eq AugOp
-> (AugOp -> AugOp -> Ordering)
-> (AugOp -> AugOp -> Bool)
-> (AugOp -> AugOp -> Bool)
-> (AugOp -> AugOp -> Bool)
-> (AugOp -> AugOp -> Bool)
-> (AugOp -> AugOp -> AugOp)
-> (AugOp -> AugOp -> AugOp)
-> Ord AugOp
AugOp -> AugOp -> Bool
AugOp -> AugOp -> Ordering
AugOp -> AugOp -> AugOp
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AugOp -> AugOp -> AugOp
$cmin :: AugOp -> AugOp -> AugOp
max :: AugOp -> AugOp -> AugOp
$cmax :: AugOp -> AugOp -> AugOp
>= :: AugOp -> AugOp -> Bool
$c>= :: AugOp -> AugOp -> Bool
> :: AugOp -> AugOp -> Bool
$c> :: AugOp -> AugOp -> Bool
<= :: AugOp -> AugOp -> Bool
$c<= :: AugOp -> AugOp -> Bool
< :: AugOp -> AugOp -> Bool
$c< :: AugOp -> AugOp -> Bool
compare :: AugOp -> AugOp -> Ordering
$ccompare :: AugOp -> AugOp -> Ordering
$cp1Ord :: Eq AugOp
Ord, Int -> AugOp -> ShowS
[AugOp] -> ShowS
AugOp -> String
(Int -> AugOp -> ShowS)
-> (AugOp -> String) -> ([AugOp] -> ShowS) -> Show AugOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AugOp] -> ShowS
$cshowList :: [AugOp] -> ShowS
show :: AugOp -> String
$cshow :: AugOp -> String
showsPrec :: Int -> AugOp -> ShowS
$cshowsPrec :: Int -> AugOp -> ShowS
Show, ReadPrec [AugOp]
ReadPrec AugOp
Int -> ReadS AugOp
ReadS [AugOp]
(Int -> ReadS AugOp)
-> ReadS [AugOp]
-> ReadPrec AugOp
-> ReadPrec [AugOp]
-> Read AugOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AugOp]
$creadListPrec :: ReadPrec [AugOp]
readPrec :: ReadPrec AugOp
$creadPrec :: ReadPrec AugOp
readList :: ReadS [AugOp]
$creadList :: ReadS [AugOp]
readsPrec :: Int -> ReadS AugOp
$creadsPrec :: Int -> ReadS AugOp
Read)
data Token
=
None
| Int Integer
| Bool Bool
| String String
| Bytes [Int8]
| Float Double
| Imaginary Double
|
Def
| If
| Elif
| Else
| For
| In
| Assert
| Return
| Lambda
|
Arrow
| Colon
| Semicolon
| Comma
| Dot
| Equal
| Underscore
|
OpenBrace
| OpenBracket
| OpenParen
| CloseBrace
| CloseBracket
| CloseParen
|
Ident String
|
WalrusOp
| ImpliesOp
| OrOp
| AndOp
| NotOp
| CmpOp CmpOp
| MinOp
| MaxOp
| BitOrOp
| BitXorOp
| BitAndOp
| BitLShiftOp
| BitRShiftOp
| PlusOp
| MinusOp
| MulOp
| DivModOp DivModOp
| AtOp
| BitNotOp
| PowOp
| AugOp AugOp
|
Newline
| Indent
| Dedent
|
As
| Async
| Await
| Break
| Class
| Continue
| Del
| Except
| Finally
| From
| Global
| Import
| Is
| Nonlocal
| Pass
| Raise
| Try
| While
| With
| Yield
deriving (Token -> Token -> Bool
(Token -> Token -> Bool) -> (Token -> Token -> Bool) -> Eq Token
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Token -> Token -> Bool
$c/= :: Token -> Token -> Bool
== :: Token -> Token -> Bool
$c== :: Token -> Token -> Bool
Eq, Eq Token
Eq Token
-> (Token -> Token -> Ordering)
-> (Token -> Token -> Bool)
-> (Token -> Token -> Bool)
-> (Token -> Token -> Bool)
-> (Token -> Token -> Bool)
-> (Token -> Token -> Token)
-> (Token -> Token -> Token)
-> Ord Token
Token -> Token -> Bool
Token -> Token -> Ordering
Token -> Token -> Token
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Token -> Token -> Token
$cmin :: Token -> Token -> Token
max :: Token -> Token -> Token
$cmax :: Token -> Token -> Token
>= :: Token -> Token -> Bool
$c>= :: Token -> Token -> Bool
> :: Token -> Token -> Bool
$c> :: Token -> Token -> Bool
<= :: Token -> Token -> Bool
$c<= :: Token -> Token -> Bool
< :: Token -> Token -> Bool
$c< :: Token -> Token -> Bool
compare :: Token -> Token -> Ordering
$ccompare :: Token -> Token -> Ordering
$cp1Ord :: Eq Token
Ord, Int -> Token -> ShowS
[Token] -> ShowS
Token -> String
(Int -> Token -> ShowS)
-> (Token -> String) -> ([Token] -> ShowS) -> Show Token
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Token] -> ShowS
$cshowList :: [Token] -> ShowS
show :: Token -> String
$cshow :: Token -> String
showsPrec :: Int -> Token -> ShowS
$cshowsPrec :: Int -> Token -> ShowS
Show, ReadPrec [Token]
ReadPrec Token
Int -> ReadS Token
ReadS [Token]
(Int -> ReadS Token)
-> ReadS [Token]
-> ReadPrec Token
-> ReadPrec [Token]
-> Read Token
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Token]
$creadListPrec :: ReadPrec [Token]
readPrec :: ReadPrec Token
$creadPrec :: ReadPrec Token
readList :: ReadS [Token]
$creadList :: ReadS [Token]
readsPrec :: Int -> ReadS Token
$creadsPrec :: Int -> ReadS Token
Read)
type Token' = WithLoc Token