1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Add AccessibilityModifier to Syntax

This commit is contained in:
joshvera 2017-08-10 19:17:45 -04:00
parent 2084f1704b
commit b3badde393
2 changed files with 11 additions and 0 deletions

View File

@ -62,6 +62,13 @@ newtype Program a = Program [a]
instance Eq1 Program where liftEq = genericLiftEq instance Eq1 Program where liftEq = genericLiftEq
instance Show1 Program where liftShowsPrec = genericLiftShowsPrec instance Show1 Program where liftShowsPrec = genericLiftShowsPrec
-- | An accessibility modifier, e.g. private, public, protected, etc.
newtype AccessibilityModifier a = AccessibilityModifier ByteString
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Show, Traversable)
instance Eq1 AccessibilityModifier where liftEq = genericLiftEq
instance Show1 AccessibilityModifier where liftShowsPrec = genericLiftShowsPrec
-- | Empty syntax, with essentially no-op semantics. -- | Empty syntax, with essentially no-op semantics.
-- --

View File

@ -67,6 +67,7 @@ type Syntax = '[
, Statement.Try , Statement.Try
, Statement.While , Statement.While
, Statement.Yield , Statement.Yield
, Syntax.AccessibilityModifier
, Syntax.Empty , Syntax.Empty
, Syntax.Error , Syntax.Error
, Syntax.Identifier , Syntax.Identifier
@ -154,6 +155,9 @@ parameter =
<|> optionalParameter <|> optionalParameter
<|> parseError <|> parseError
accessibilityModifier :: Assignment
accessibilityModifier = makeTerm <$> symbol AccessibilityModifier <*> (Syntax.AccessibilityModifier <$> source)
requiredParameter :: Assignment requiredParameter :: Assignment
requiredParameter = makeTerm <$> symbol RequiredParameter <*> children ((,,,) <$> optional accessibilityModifier <*> (identifier <|> destructuringPattern) <*> optional typeAnnotation <*> optional initializer) requiredParameter = makeTerm <$> symbol RequiredParameter <*> children ((,,,) <$> optional accessibilityModifier <*> (identifier <|> destructuringPattern) <*> optional typeAnnotation <*> optional initializer)