mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +03:00
Add declare directive
This commit is contained in:
parent
4a8c890f69
commit
f347bf358d
@ -106,6 +106,7 @@ type Syntax = '[
|
||||
, Syntax.Echo
|
||||
, Syntax.Unset
|
||||
, Syntax.Declare
|
||||
, Syntax.DeclareDirective
|
||||
, Statement.Finally
|
||||
, Statement.Catch
|
||||
, Statement.Try
|
||||
@ -576,11 +577,12 @@ finallyClause :: Assignment
|
||||
finallyClause = makeTerm <$> symbol FinallyClause <*> children (Statement.Finally <$> term compoundStatement)
|
||||
|
||||
declareStatement :: Assignment
|
||||
declareStatement = makeTerm <$> symbol DeclareStatement <*> children (Syntax.Declare <$> (term (declareDirective <|> statement <|> (makeTerm <$> location <*> manyTerm statement)) <|> emptyTerm))
|
||||
declareStatement = makeTerm <$> symbol DeclareStatement <*> children (Syntax.Declare <$> term declareDirective <*> (makeTerm <$> location <*> manyTerm statement))
|
||||
|
||||
|
||||
-- | TODO: Figure out how to parse assignment token
|
||||
declareDirective :: Assignment
|
||||
declareDirective = emptyTerm
|
||||
declareDirective = makeTerm <$> symbol DeclareDirective <*> children (Syntax.DeclareDirective <$> literal)
|
||||
|
||||
|
||||
echoStatement :: Assignment
|
||||
|
@ -376,13 +376,20 @@ instance Eq1 Unset where liftEq = genericLiftEq
|
||||
instance Ord1 Unset where liftCompare = genericLiftCompare
|
||||
instance Show1 Unset where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Declare a = Declare a
|
||||
data Declare a = Declare a a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 Declare where liftEq = genericLiftEq
|
||||
instance Ord1 Declare where liftCompare = genericLiftCompare
|
||||
instance Show1 Declare where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data DeclareDirective a = DeclareDirective a
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
instance Eq1 DeclareDirective where liftEq = genericLiftEq
|
||||
instance Ord1 DeclareDirective where liftCompare = genericLiftCompare
|
||||
instance Show1 DeclareDirective where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
data LabeledStatement a = LabeledStatement { _labeledStatementIdentifier :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user