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
|
||||
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.For
|
||||
, Statement.ForEach
|
||||
, Statement.HashBang
|
||||
, Statement.If
|
||||
, Statement.Match
|
||||
, Statement.Pattern
|
||||
@ -598,6 +599,7 @@ statement = handleError everything
|
||||
, continueStatement
|
||||
, returnStatement
|
||||
, throwStatement
|
||||
, hashBang
|
||||
, emptyStatement
|
||||
, labeledStatement ]
|
||||
|
||||
@ -625,6 +627,9 @@ returnStatement = makeTerm <$> symbol ReturnStatement <*> children (Statement.Re
|
||||
throwStatement :: Assignment
|
||||
throwStatement = makeTerm <$> symbol Grammar.ThrowStatement <*> children (Statement.Throw <$> term expressions)
|
||||
|
||||
hashBang :: Assignment
|
||||
hashBang = makeTerm <$> symbol HashBangLine <*> (Statement.HashBang <$> source)
|
||||
|
||||
labeledStatement :: Assignment
|
||||
labeledStatement = makeTerm <$> symbol Grammar.LabeledStatement <*> children (TypeScript.Syntax.LabeledStatement <$> statementIdentifier <*> term statement)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user