mirror of
https://github.com/github/semantic.git
synced 2024-12-22 06:11:49 +03:00
Assign HashBangLines in JavaScript/TypeScript
This commit is contained in:
parent
01d3e7d547
commit
a9e5ff6a11
@ -303,3 +303,14 @@ instance Show1 ScopeExit where liftShowsPrec = genericLiftShowsPrec
|
|||||||
|
|
||||||
-- TODO: Implement Eval instance for ScopeExit
|
-- TODO: Implement Eval instance for ScopeExit
|
||||||
instance Evaluatable ScopeExit
|
instance Evaluatable ScopeExit
|
||||||
|
|
||||||
|
-- | HashBang line (e.g. `#!/usr/bin/env node`)
|
||||||
|
newtype HashBang a = HashBang ByteString
|
||||||
|
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
|
||||||
|
|
||||||
|
instance Eq1 HashBang where liftEq = genericLiftEq
|
||||||
|
instance Ord1 HashBang where liftCompare = genericLiftCompare
|
||||||
|
instance Show1 HashBang where liftShowsPrec = genericLiftShowsPrec
|
||||||
|
|
||||||
|
-- TODO: Implement Eval instance for HashBang
|
||||||
|
instance Evaluatable HashBang
|
||||||
|
@ -70,6 +70,7 @@ type Syntax = '[
|
|||||||
, Statement.Finally
|
, Statement.Finally
|
||||||
, Statement.For
|
, Statement.For
|
||||||
, Statement.ForEach
|
, Statement.ForEach
|
||||||
|
, Statement.HashBang
|
||||||
, Statement.If
|
, Statement.If
|
||||||
, Statement.Match
|
, Statement.Match
|
||||||
, Statement.Pattern
|
, Statement.Pattern
|
||||||
@ -598,6 +599,7 @@ statement = handleError everything
|
|||||||
, continueStatement
|
, continueStatement
|
||||||
, returnStatement
|
, returnStatement
|
||||||
, throwStatement
|
, throwStatement
|
||||||
|
, hashBang
|
||||||
, emptyStatement
|
, emptyStatement
|
||||||
, labeledStatement ]
|
, labeledStatement ]
|
||||||
|
|
||||||
@ -625,6 +627,9 @@ returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Re
|
|||||||
throwStatement :: Assignment
|
throwStatement :: Assignment
|
||||||
throwStatement = makeTerm <$> symbol Grammar.ThrowStatement <*> children (Statement.Throw <$> term expressions)
|
throwStatement = makeTerm <$> symbol Grammar.ThrowStatement <*> children (Statement.Throw <$> term expressions)
|
||||||
|
|
||||||
|
hashBang :: Assignment
|
||||||
|
hashBang = makeTerm <$> symbol HashBangLine <*> (Statement.HashBang <$> source)
|
||||||
|
|
||||||
labeledStatement :: Assignment
|
labeledStatement :: Assignment
|
||||||
labeledStatement = makeTerm <$> symbol Grammar.LabeledStatement <*> children (TypeScript.Syntax.LabeledStatement <$> statementIdentifier <*> term statement)
|
labeledStatement = makeTerm <$> symbol Grammar.LabeledStatement <*> children (TypeScript.Syntax.LabeledStatement <$> statementIdentifier <*> term statement)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user