1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | class HasTokens a where
firstTok :: a -> TT
instance HasTokens (Statement TT) where
firstTok (FunDecl x _ _ _) = x
firstTok (VarDecl x _ _) = x
firstTok (Return x _ _) = x
firstTok (While x _ _) = x
firstTok (DoWhile x _ _ _ _) = x
firstTok (For x _ _ _ _ _) = x
firstTok (If x _ _ _) = x
firstTok (Else x _) = x
firstTok (With x _ _) = x
firstTok (Comm x) = x
firstTok (Expr x _) = firstTok x
instance HasTokens (Parameters TT) where
firstTok (Parameters x _ _) = x
firstTok (ParErr x) = x
|