1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 23:11:50 +03:00

Add include, include once expressions

This commit is contained in:
joshvera 2017-12-15 16:21:10 -08:00
parent c8cd20fdf5
commit 57496d5877
2 changed files with 25 additions and 2 deletions

View File

@ -35,6 +35,8 @@ type Syntax = '[
, Declaration.VariableDeclaration
, Syntax.Identifier
, Syntax.VariableName
, Syntax.IncludeOnce
, Syntax.Include
, Syntax.RequireOnce
, Syntax.Require
, [] ]
@ -83,12 +85,19 @@ expression = choice [
-- yieldExpression,
-- unaryExpression,
-- binaryExpression,
-- includeExpression,
-- includeOnceExpression,
includeExpression,
includeOnceExpression,
requireExpression,
requireOnceExpression
]
includeExpression :: Assignment
includeExpression = makeTerm <$> symbol IncludeExpression <*> children (Syntax.Include <$> expression)
includeOnceExpression :: Assignment
includeOnceExpression = makeTerm <$> symbol IncludeOnceExpression <*> children (Syntax.IncludeOnce <$> expression)
requireExpression :: Assignment
requireExpression = makeTerm <$> symbol RequireExpression <*> children (Syntax.Require <$> expression)

View File

@ -35,3 +35,17 @@ newtype Require a = Require a
instance Eq1 Require where liftEq = genericLiftEq
instance Ord1 Require where liftCompare = genericLiftCompare
instance Show1 Require where liftShowsPrec = genericLiftShowsPrec
newtype Include a = Include a
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Eq1 Include where liftEq = genericLiftEq
instance Ord1 Include where liftCompare = genericLiftCompare
instance Show1 Include where liftShowsPrec = genericLiftShowsPrec
newtype IncludeOnce a = IncludeOnce a
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Eq1 IncludeOnce where liftEq = genericLiftEq
instance Ord1 IncludeOnce where liftCompare = genericLiftCompare
instance Show1 IncludeOnce where liftShowsPrec = genericLiftShowsPrec