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

Add require once

This commit is contained in:
joshvera 2017-12-15 16:12:40 -08:00
parent c2ccf00aa2
commit 35b49454cd
2 changed files with 13 additions and 5 deletions

View File

@ -35,6 +35,7 @@ type Syntax = '[
, Declaration.VariableDeclaration
, Syntax.Identifier
, Syntax.VariableName
, Syntax.RequireOnce
, [] ]
type Term = Term.Term (Data.Union.Union Syntax) (Record Location)
@ -84,10 +85,12 @@ expression = choice [
-- includeExpression,
-- includeOnceExpression,
-- requireExpression,
-- requireOnceExpression
requireOnceExpression
]
-- TODO: Does this keep the range of VariableName?
requireOnceExpression :: Assignment
requireOnceExpression = makeTerm <$> symbol RequireOnceExpression <*> children (Syntax.RequireOnce <$> expression)
variableName :: Assignment
variableName = makeTerm <$> symbol VariableName <*> children (Syntax.VariableName <$> name)

View File

@ -8,7 +8,6 @@ import Data.Functor.Classes.Generic
import Data.Mergeable
import GHC.Generics
-- | Lookup type for a type-level key in a typescript map.
newtype Text a = Text ByteString
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
@ -16,10 +15,16 @@ instance Eq1 Text where liftEq = genericLiftEq
instance Ord1 Text where liftCompare = genericLiftCompare
instance Show1 Text where liftShowsPrec = genericLiftShowsPrec
-- | Lookup type for a type-level key in a typescript map.
data VariableName a = VariableName a
newtype VariableName a = VariableName a
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Eq1 VariableName where liftEq = genericLiftEq
instance Ord1 VariableName where liftCompare = genericLiftCompare
instance Show1 VariableName where liftShowsPrec = genericLiftShowsPrec
newtype RequireOnce a = RequireOnce a
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
instance Eq1 RequireOnce where liftEq = genericLiftEq
instance Ord1 RequireOnce where liftCompare = genericLiftCompare
instance Show1 RequireOnce where liftShowsPrec = genericLiftShowsPrec