1
1
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:
joshvera 2018-02-05 16:49:24 -05:00
parent 4a8c890f69
commit f347bf358d
2 changed files with 12 additions and 3 deletions

View File

@ -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

View File

@ -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)