mirror of
https://github.com/github/semantic.git
synced 2024-12-30 10:27:45 +03:00
Produce program syntaxes (for ruby at least)
This commit is contained in:
parent
dec0de378c
commit
9618db2cdb
@ -32,6 +32,12 @@ newtype Identifier a = Identifier ByteString
|
||||
instance Eq1 Identifier where liftEq = genericLiftEq
|
||||
instance Show1 Identifier where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
newtype Program a = Program [a]
|
||||
deriving (Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
|
||||
|
||||
instance Eq1 Program where liftEq = genericLiftEq
|
||||
instance Show1 Program where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
|
||||
-- | Empty syntax, with essentially no-op semantics.
|
||||
--
|
||||
|
@ -67,6 +67,7 @@ type Syntax = '[
|
||||
, Syntax.Empty
|
||||
, Syntax.Error
|
||||
, Syntax.Identifier
|
||||
, Syntax.Program
|
||||
, []
|
||||
]
|
||||
|
||||
@ -76,7 +77,9 @@ type Assignment = HasCallStack => Assignment.Assignment (AST Grammar) Grammar Te
|
||||
|
||||
-- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax.
|
||||
assignment :: Assignment
|
||||
assignment = makeTerm <$> symbol Program <*> children (many statement) <|> parseError
|
||||
assignment =
|
||||
makeTerm <$> symbol Program <*> children (Syntax.Program <$> many statement)
|
||||
<|> parseError
|
||||
|
||||
statement :: Assignment
|
||||
statement =
|
||||
|
Loading…
Reference in New Issue
Block a user