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

Assign until statements.

This commit is contained in:
Rob Rix 2017-05-01 16:37:13 -04:00
parent 5ab78c37b9
commit 8aad196202

View File

@ -78,6 +78,7 @@ statement = exit Statement.Return Return
<|> unlessModifier <|> unlessModifier
<|> while <|> while
<|> whileModifier <|> whileModifier
<|> until
<|> literal <|> literal
where exit construct sym = symbol sym *> term <*> (children (construct <$> optional (symbol ArgumentList *> children statement))) where exit construct sym = symbol sym *> term <*> (children (construct <$> optional (symbol ArgumentList *> children statement)))
@ -103,6 +104,9 @@ while = symbol While *> term <*> children (Statement.While <$> statement <*> (te
whileModifier :: Assignment (Node Grammar) (Term Syntax Location) whileModifier :: Assignment (Node Grammar) (Term Syntax Location)
whileModifier = symbol WhileModifier *> term <*> children (flip Statement.While <$> statement <*> statement) whileModifier = symbol WhileModifier *> term <*> children (flip Statement.While <$> statement <*> statement)
until :: Assignment (Node Grammar) (Term Syntax Location)
until = symbol Until *> term <*> children (Statement.While <$> (term <*> (Expression.Not <$> statement)) <*> (term <*> many statement))
literal :: Assignment (Node Grammar) (Term Syntax Location) literal :: Assignment (Node Grammar) (Term Syntax Location)
literal = leaf Language.Ruby.Syntax.True (const Literal.true) literal = leaf Language.Ruby.Syntax.True (const Literal.true)
<|> leaf Language.Ruby.Syntax.False (const Literal.false) <|> leaf Language.Ruby.Syntax.False (const Literal.false)