{-# LANGUAGE LambdaCase        #-}
{-# LANGUAGE OverloadedStrings #-}
module Language.Rzk.VSCode.Tokenize where

import           Language.LSP.Protocol.Types (SemanticTokenAbsolute (..),
                                              SemanticTokenModifiers (..),
                                              SemanticTokenTypes (..))
import           Language.Rzk.Syntax

tokenizeModule :: Module -> [SemanticTokenAbsolute]
tokenizeModule :: Module -> [SemanticTokenAbsolute]
tokenizeModule (Module BNFC'Position
_loc LanguageDecl' BNFC'Position
langDecl [Command' BNFC'Position]
commands) = [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
  [ LanguageDecl' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeLanguageDecl LanguageDecl' BNFC'Position
langDecl
  , (Command' BNFC'Position -> [SemanticTokenAbsolute])
-> [Command' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Command' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeCommand [Command' BNFC'Position]
commands
  ]

tokenizeLanguageDecl :: LanguageDecl -> [SemanticTokenAbsolute]
tokenizeLanguageDecl :: LanguageDecl' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeLanguageDecl LanguageDecl' BNFC'Position
_ = []

tokenizeCommand :: Command -> [SemanticTokenAbsolute]
tokenizeCommand :: Command' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeCommand Command' BNFC'Position
command = case Command' BNFC'Position
command of
  CommandSetOption{}   -> []    -- NOTE: fallback to TextMate
  CommandUnsetOption{} -> []    -- NOTE: fallback to TextMate
  CommandCheck        BNFC'Position
_loc Term' BNFC'Position
term Term' BNFC'Position
type_ -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm [Term' BNFC'Position
term, Term' BNFC'Position
type_]
  CommandCompute      BNFC'Position
_loc Term' BNFC'Position
term -> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
term
  CommandComputeNF    BNFC'Position
_loc Term' BNFC'Position
term -> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
term
  CommandComputeWHNF  BNFC'Position
_loc Term' BNFC'Position
term -> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
term

  CommandPostulate BNFC'Position
_loc VarIdent' BNFC'Position
name DeclUsedVars' BNFC'Position
_declUsedVars [Param' BNFC'Position]
params Term' BNFC'Position
type_ -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken VarIdent' BNFC'Position
name SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_Declaration]
    , (Param' BNFC'Position -> [SemanticTokenAbsolute])
-> [Param' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Param' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParam [Param' BNFC'Position]
params
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_
    ]
  CommandDefine BNFC'Position
_loc VarIdent' BNFC'Position
name DeclUsedVars' BNFC'Position
_declUsedVars [Param' BNFC'Position]
params Term' BNFC'Position
type_ Term' BNFC'Position
term -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken VarIdent' BNFC'Position
name SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_Declaration]
    , (Param' BNFC'Position -> [SemanticTokenAbsolute])
-> [Param' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Param' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParam [Param' BNFC'Position]
params
    , (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm [Term' BNFC'Position
type_, Term' BNFC'Position
term]
    ]

  CommandAssume BNFC'Position
_loc [VarIdent' BNFC'Position]
vars Term' BNFC'Position
type_ -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ (VarIdent' BNFC'Position -> [SemanticTokenAbsolute])
-> [VarIdent' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap (\VarIdent' BNFC'Position
var -> VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken VarIdent' BNFC'Position
var SemanticTokenTypes
SemanticTokenTypes_Parameter [SemanticTokenModifiers
SemanticTokenModifiers_Declaration]) [VarIdent' BNFC'Position]
vars
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_
    ]
  CommandSection    BNFC'Position
_loc SectionName' BNFC'Position
_nameStart -> []
  CommandSectionEnd BNFC'Position
_loc SectionName' BNFC'Position
_nameEnd -> []

tokenizeParam :: Param -> [SemanticTokenAbsolute]
tokenizeParam :: Param' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParam = \case
  ParamPattern BNFC'Position
_loc Pattern
pat -> Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat
  ParamPatternType BNFC'Position
_loc [Pattern]
pats Term' BNFC'Position
type_ -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ (Pattern -> [SemanticTokenAbsolute])
-> [Pattern] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Pattern -> [SemanticTokenAbsolute]
tokenizePattern [Pattern]
pats
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_ ]
  ParamPatternShape BNFC'Position
_loc [Pattern]
pats Term' BNFC'Position
cube Term' BNFC'Position
tope -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ (Pattern -> [SemanticTokenAbsolute])
-> [Pattern] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Pattern -> [SemanticTokenAbsolute]
tokenizePattern [Pattern]
pats
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
cube
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope Term' BNFC'Position
tope ]
  ParamPatternShapeDeprecated BNFC'Position
_loc Pattern
pat Term' BNFC'Position
cube Term' BNFC'Position
tope -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
cube
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope Term' BNFC'Position
tope ]

tokenizePattern :: Pattern -> [SemanticTokenAbsolute]
tokenizePattern :: Pattern -> [SemanticTokenAbsolute]
tokenizePattern = \case
  PatternVar BNFC'Position
_loc VarIdent' BNFC'Position
var    -> VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken VarIdent' BNFC'Position
var SemanticTokenTypes
SemanticTokenTypes_Parameter [SemanticTokenModifiers
SemanticTokenModifiers_Declaration]
  PatternPair BNFC'Position
_loc Pattern
l Pattern
r   -> (Pattern -> [SemanticTokenAbsolute])
-> [Pattern] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Pattern -> [SemanticTokenAbsolute]
tokenizePattern [Pattern
l, Pattern
r]
  pat :: Pattern
pat@(PatternUnit BNFC'Position
_loc) -> Pattern
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Pattern
pat SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_Declaration]
  PatternTuple BNFC'Position
_loc Pattern
p1 Pattern
p2 [Pattern]
ps -> (Pattern -> [SemanticTokenAbsolute])
-> [Pattern] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Pattern -> [SemanticTokenAbsolute]
tokenizePattern (Pattern
p1 Pattern -> [Pattern] -> [Pattern]
forall a. a -> [a] -> [a]
: Pattern
p2 Pattern -> [Pattern] -> [Pattern]
forall a. a -> [a] -> [a]
: [Pattern]
ps)

tokenizeTope :: Term -> [SemanticTokenAbsolute]
tokenizeTope :: Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope = Maybe SemanticTokenTypes
-> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm' (SemanticTokenTypes -> Maybe SemanticTokenTypes
forall a. a -> Maybe a
Just SemanticTokenTypes
SemanticTokenTypes_String)

tokenizeTerm :: Term -> [SemanticTokenAbsolute]
tokenizeTerm :: Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm = Maybe SemanticTokenTypes
-> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm' Maybe SemanticTokenTypes
forall a. Maybe a
Nothing

tokenizeTerm' :: Maybe SemanticTokenTypes -> Term -> [SemanticTokenAbsolute]
tokenizeTerm' :: Maybe SemanticTokenTypes
-> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm' Maybe SemanticTokenTypes
varTokenType = Term' BNFC'Position -> [SemanticTokenAbsolute]
go
  where
    go :: Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
term = case Term' BNFC'Position
term of
      Hole{} -> [] -- FIXME
      Var{} -> case Maybe SemanticTokenTypes
varTokenType of
                 Maybe SemanticTokenTypes
Nothing         -> []
                 Just SemanticTokenTypes
token_type -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
token_type []

      Universe{}           -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      UniverseCube{}       -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      UniverseTope{}       -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]

      CubeUnit{}           -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Enum [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      CubeUnitStar{}       -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      ASCII_CubeUnitStar{} -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]

      Cube2{}              -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Enum [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      Cube2_0{}            -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      ASCII_Cube2_0{}      -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      Cube2_1{}            -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      ASCII_Cube2_1{}      -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]

      CubeProduct BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
l, Term' BNFC'Position
r]

      TopeTop{}            -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_String [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      ASCII_TopeTop{}            -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_String [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      TopeBottom{}         -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_String [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      ASCII_TopeBottom{}         -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_String [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      TopeAnd BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      ASCII_TopeAnd BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      TopeOr  BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      ASCII_TopeOr  BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      TopeEQ  BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      ASCII_TopeEQ  BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      TopeLEQ BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]
      ASCII_TopeLEQ BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r     -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope [Term' BNFC'Position
l, Term' BNFC'Position
r]

      RecBottom{}          -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      RecOr BNFC'Position
_loc [Restriction' BNFC'Position]
rs -> (Restriction' BNFC'Position -> [SemanticTokenAbsolute])
-> [Restriction' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Restriction' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeRestriction [Restriction' BNFC'Position]
rs

      TypeFun BNFC'Position
_loc ParamDecl' BNFC'Position
paramDecl Term' BNFC'Position
ret -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ ParamDecl' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParamDecl ParamDecl' BNFC'Position
paramDecl
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
ret ]
      ASCII_TypeFun BNFC'Position
_loc ParamDecl' BNFC'Position
paramDecl Term' BNFC'Position
ret -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ ParamDecl' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParamDecl ParamDecl' BNFC'Position
paramDecl
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
ret ]
      TypeSigma BNFC'Position
loc Pattern
pat Term' BNFC'Position
a Term' BNFC'Position
b -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"∑") SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat
        , (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
a, Term' BNFC'Position
b] ]
      ASCII_TypeSigma BNFC'Position
loc Pattern
pat Term' BNFC'Position
a Term' BNFC'Position
b -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"Sigma") SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat
        , (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
a, Term' BNFC'Position
b] ]
      TypeSigmaTuple BNFC'Position
loc SigmaParam' BNFC'Position
p [SigmaParam' BNFC'Position]
ps Term' BNFC'Position
tN -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat 
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"∑") SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , (SigmaParam' BNFC'Position -> [SemanticTokenAbsolute])
-> [SigmaParam' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap SigmaParam' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeSigmaParam (SigmaParam' BNFC'Position
p SigmaParam' BNFC'Position
-> [SigmaParam' BNFC'Position] -> [SigmaParam' BNFC'Position]
forall a. a -> [a] -> [a]
: [SigmaParam' BNFC'Position]
ps)
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
tN ]
      ASCII_TypeSigmaTuple BNFC'Position
loc SigmaParam' BNFC'Position
p [SigmaParam' BNFC'Position]
ps Term' BNFC'Position
tN -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat 
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"Sigma") SemanticTokenTypes
SemanticTokenTypes_Class [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , (SigmaParam' BNFC'Position -> [SemanticTokenAbsolute])
-> [SigmaParam' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap SigmaParam' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeSigmaParam (SigmaParam' BNFC'Position
p SigmaParam' BNFC'Position
-> [SigmaParam' BNFC'Position] -> [SigmaParam' BNFC'Position]
forall a. a -> [a] -> [a]
: [SigmaParam' BNFC'Position]
ps)
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
tN ]
      TypeId BNFC'Position
_loc Term' BNFC'Position
x Term' BNFC'Position
a Term' BNFC'Position
y -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
x, Term' BNFC'Position
a, Term' BNFC'Position
y]
      TypeIdSimple BNFC'Position
_loc Term' BNFC'Position
x Term' BNFC'Position
y -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
x, Term' BNFC'Position
y]
        

      TypeRestricted BNFC'Position
_loc Term' BNFC'Position
type_ [Restriction' BNFC'Position]
rs -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
type_
        , (Restriction' BNFC'Position -> [SemanticTokenAbsolute])
-> [Restriction' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Restriction' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeRestriction [Restriction' BNFC'Position]
rs ]

      App BNFC'Position
_loc Term' BNFC'Position
f Term' BNFC'Position
x -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
f, Term' BNFC'Position
x]
      Lambda BNFC'Position
_loc [Param' BNFC'Position]
params Term' BNFC'Position
body -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ (Param' BNFC'Position -> [SemanticTokenAbsolute])
-> [Param' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Param' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParam [Param' BNFC'Position]
params
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
body ]
      ASCII_Lambda BNFC'Position
loc [Param' BNFC'Position]
params Term' BNFC'Position
body -> Term' BNFC'Position -> [SemanticTokenAbsolute]
go (BNFC'Position
-> [Param' BNFC'Position]
-> Term' BNFC'Position
-> Term' BNFC'Position
forall a. a -> [Param' a] -> Term' a -> Term' a
Lambda BNFC'Position
loc [Param' BNFC'Position]
params Term' BNFC'Position
body)

      Pair BNFC'Position
_loc Term' BNFC'Position
l Term' BNFC'Position
r -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
l, Term' BNFC'Position
r]
      Tuple BNFC'Position
_loc Term' BNFC'Position
p1 Term' BNFC'Position
p2 [Term' BNFC'Position]
ps -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go (Term' BNFC'Position
p1Term' BNFC'Position
-> [Term' BNFC'Position] -> [Term' BNFC'Position]
forall a. a -> [a] -> [a]
:Term' BNFC'Position
p2Term' BNFC'Position
-> [Term' BNFC'Position] -> [Term' BNFC'Position]
forall a. a -> [a] -> [a]
:[Term' BNFC'Position]
ps)
      First BNFC'Position
loc Term' BNFC'Position
t -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"π₁") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
t ]
      ASCII_First BNFC'Position
loc Term' BNFC'Position
t -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"first") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
t ]
      Second BNFC'Position
loc Term' BNFC'Position
t -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"π₂") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
t ]
      ASCII_Second BNFC'Position
loc Term' BNFC'Position
t -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"second") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
t ]

      TypeUnit BNFC'Position
_loc -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Enum [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      Unit BNFC'Position
_loc -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_EnumMember [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]

      Refl{} -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
      ReflTerm BNFC'Position
loc Term' BNFC'Position
x -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"refl") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , Term' BNFC'Position -> [SemanticTokenAbsolute]
go Term' BNFC'Position
x ]
      ReflTermType BNFC'Position
loc Term' BNFC'Position
x Term' BNFC'Position
a -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"refl") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
x, Term' BNFC'Position
a] ]

      IdJ BNFC'Position
loc Term' BNFC'Position
a Term' BNFC'Position
b Term' BNFC'Position
c Term' BNFC'Position
d Term' BNFC'Position
e Term' BNFC'Position
f -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
        [ VarIdent' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken (BNFC'Position -> VarIdentToken -> VarIdent' BNFC'Position
forall a. a -> VarIdentToken -> VarIdent' a
VarIdent BNFC'Position
loc VarIdentToken
"J") SemanticTokenTypes
SemanticTokenTypes_Function [SemanticTokenModifiers
SemanticTokenModifiers_DefaultLibrary]
        , (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
a, Term' BNFC'Position
b, Term' BNFC'Position
c, Term' BNFC'Position
d, Term' BNFC'Position
e, Term' BNFC'Position
f] ]

      TypeAsc BNFC'Position
_loc Term' BNFC'Position
t Term' BNFC'Position
type_ -> (Term' BNFC'Position -> [SemanticTokenAbsolute])
-> [Term' BNFC'Position] -> [SemanticTokenAbsolute]
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap Term' BNFC'Position -> [SemanticTokenAbsolute]
go [Term' BNFC'Position
t, Term' BNFC'Position
type_]

      RecOrDeprecated{} -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Regexp [SemanticTokenModifiers
SemanticTokenModifiers_Deprecated]
      TypeExtensionDeprecated{} -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Regexp [SemanticTokenModifiers
SemanticTokenModifiers_Deprecated]
      ASCII_TypeExtensionDeprecated{} -> Term' BNFC'Position
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken Term' BNFC'Position
term SemanticTokenTypes
SemanticTokenTypes_Regexp [SemanticTokenModifiers
SemanticTokenModifiers_Deprecated]

tokenizeRestriction :: Restriction -> [SemanticTokenAbsolute]
tokenizeRestriction :: Restriction' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeRestriction (Restriction BNFC'Position
_loc Term' BNFC'Position
tope Term' BNFC'Position
term) = [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
  [ Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope Term' BNFC'Position
tope
  , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
term ]
tokenizeRestriction (ASCII_Restriction BNFC'Position
_loc Term' BNFC'Position
tope Term' BNFC'Position
term) = [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
  [ Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope Term' BNFC'Position
tope
  , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
term ]

tokenizeParamDecl :: ParamDecl -> [SemanticTokenAbsolute]
tokenizeParamDecl :: ParamDecl' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeParamDecl = \case
  ParamType BNFC'Position
_loc Term' BNFC'Position
type_ -> Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_
  ParamTermType BNFC'Position
_loc Term' BNFC'Position
pat Term' BNFC'Position
type_ -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
pat
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_ ]
  ParamTermShape BNFC'Position
_loc Term' BNFC'Position
pat Term' BNFC'Position
cube Term' BNFC'Position
tope -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
pat
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
cube
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope Term' BNFC'Position
tope
    ]
  ParamTermTypeDeprecated BNFC'Position
_loc Pattern
pat Term' BNFC'Position
type_ -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_ ]
  ParamVarShapeDeprecated BNFC'Position
_loc Pattern
pat Term' BNFC'Position
cube Term' BNFC'Position
tope -> [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
    [ Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
cube
    , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTope Term' BNFC'Position
tope
    ]

tokenizeSigmaParam :: SigmaParam -> [SemanticTokenAbsolute]
tokenizeSigmaParam :: SigmaParam' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeSigmaParam (SigmaParam BNFC'Position
_loc Pattern
pat Term' BNFC'Position
type_) = [[SemanticTokenAbsolute]] -> [SemanticTokenAbsolute]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat 
  [ Pattern -> [SemanticTokenAbsolute]
tokenizePattern Pattern
pat 
  , Term' BNFC'Position -> [SemanticTokenAbsolute]
tokenizeTerm Term' BNFC'Position
type_ ]

mkToken :: (HasPosition a, Print a) => a -> SemanticTokenTypes -> [SemanticTokenModifiers] -> [SemanticTokenAbsolute]
mkToken :: forall a.
(HasPosition a, Print a) =>
a
-> SemanticTokenTypes
-> [SemanticTokenModifiers]
-> [SemanticTokenAbsolute]
mkToken a
x SemanticTokenTypes
tokenType [SemanticTokenModifiers]
tokenModifiers =
  case a -> BNFC'Position
forall a. HasPosition a => a -> BNFC'Position
hasPosition a
x of
    BNFC'Position
Nothing -> []
    Just (Int
line, Int
col) -> do
      [ SemanticTokenAbsolute
        { _tokenType :: SemanticTokenTypes
_tokenType = SemanticTokenTypes
tokenType
        , _tokenModifiers :: [SemanticTokenModifiers]
_tokenModifiers = [SemanticTokenModifiers]
tokenModifiers
        , _startChar :: UInt
_startChar = Int -> UInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
col UInt -> UInt -> UInt
forall a. Num a => a -> a -> a
- UInt
1    -- NOTE: 0-indexed output for VS Code
        ,  _line :: UInt
_line = Int -> UInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
line UInt -> UInt -> UInt
forall a. Num a => a -> a -> a
- UInt
1             -- NOTE: 0-indexed output for VS Code
        ,  _length :: UInt
_length = Int -> UInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> UInt) -> Int -> UInt
forall a b. (a -> b) -> a -> b
$ [Char] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length (a -> [Char]
forall a. Print a => a -> [Char]
printTree a
x)
        }
        ]