1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 10:27:45 +03:00

Assign try statements

This commit is contained in:
Rick Winfrey 2017-06-08 16:47:25 -07:00
parent ab67d72bef
commit 508ead4cbb

View File

@ -62,6 +62,7 @@ type Syntax =
, Statement.NoOp
, Statement.Return
, Statement.Throw
, Statement.Try
, Statement.While
, Statement.Yield
, Language.Python.Syntax.Ellipsis
@ -118,6 +119,7 @@ statement = assertStatement
<|> printStatement
<|> raiseStatement
<|> returnStatement
<|> tryStatement
<|> whileStatement
expressionStatement :: Assignment
@ -151,6 +153,10 @@ forStatement = makeTerm <$> symbol ForStatement <*> children (Statement.ForEach
whileStatement :: Assignment
whileStatement = makeTerm <$> symbol WhileStatement <*> children (Statement.While <$> expression <*> (makeTerm <$> location <*> many expression))
-- TODO:: Assign try else clauses
tryStatement :: Assignment
tryStatement = makeTerm <$> symbol TryStatement <*> children (Statement.Try <$> expression <*> (many expression))
exceptClause :: Assignment
exceptClause = makeTerm <$> symbol ExceptClause <*> children (Statement.Catch <$> optional (makeTerm <$> location <*> many expression <* symbol AnonColon) <*> expression)
finallyClause :: Assignment