1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +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 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.
--

View File

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