mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Add ScopedTypeVariables to Syntax
This commit is contained in:
parent
e22b723b6a
commit
44bb5cfe5b
@ -1,4 +1,4 @@
|
|||||||
{-# LANGUAGE DeriveAnyClass #-}
|
{-# LANGUAGE DeriveAnyClass, ScopedTypeVariables #-}
|
||||||
module Syntax where
|
module Syntax where
|
||||||
|
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
@ -109,26 +109,26 @@ data Syntax a f
|
|||||||
deriving (Eq, Foldable, Functor, Generic, Generic1, Mergeable, Ord, Show, Traversable, ToJSON, NFData)
|
deriving (Eq, Foldable, Functor, Generic, Generic1, Mergeable, Ord, Show, Traversable, ToJSON, NFData)
|
||||||
|
|
||||||
|
|
||||||
extractLeafValue :: forall b leaf. S.Syntax leaf b -> Maybe leaf
|
extractLeafValue :: forall b leaf. Syntax leaf b -> Maybe leaf
|
||||||
extractLeafValue syntax = case syntax of
|
extractLeafValue syntax = case syntax of
|
||||||
S.Leaf a -> Just a
|
Leaf a -> Just a
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
maybeIdentifier :: forall leaf identifier. S.Syntax leaf identifier -> Maybe identifier
|
maybeIdentifier :: forall leaf identifier. Syntax leaf identifier -> Maybe identifier
|
||||||
maybeIdentifier syntax = case syntax of
|
maybeIdentifier syntax = case syntax of
|
||||||
S.Assignment f _ -> Just f
|
Assignment f _ -> Just f
|
||||||
S.Class f _ _ -> Just f
|
Class f _ _ -> Just f
|
||||||
S.Export f _ -> f
|
Export f _ -> f
|
||||||
S.Function f _ _ _ -> Just f
|
Function f _ _ _ -> Just f
|
||||||
S.FunctionCall f _ -> Just f
|
FunctionCall f _ -> Just f
|
||||||
S.Import f _ -> Just f
|
Import f _ -> Just f
|
||||||
S.Method f _ _ _ _ -> Just f
|
Method f _ _ _ _ -> Just f
|
||||||
S.MethodCall _ f _ -> Just f
|
MethodCall _ f _ -> Just f
|
||||||
S.Module f _ -> Just f
|
Module f _ -> Just f
|
||||||
S.OperatorAssignment f _ -> Just f
|
OperatorAssignment f _ -> Just f
|
||||||
S.SubscriptAccess f _ -> Just f
|
SubscriptAccess f _ -> Just f
|
||||||
S.TypeDecl f _ -> Just f
|
TypeDecl f _ -> Just f
|
||||||
S.VarAssignment f _ -> Just f
|
VarAssignment f _ -> Just f
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
|
|
||||||
-- Instances
|
-- Instances
|
||||||
|
Loading…
Reference in New Issue
Block a user