mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Add require once
This commit is contained in:
parent
c2ccf00aa2
commit
35b49454cd
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user