1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 13:34:31 +03:00

Handle errors at the top level.

This commit is contained in:
Rob Rix 2017-08-08 12:14:42 -04:00
parent 38f5648af9
commit 5d5f027e40

View File

@ -14,7 +14,7 @@ import Data.Functor.Classes.Show.Generic
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe)
import Data.Tuple (swap) import Data.Tuple (swap)
import Data.Record import Data.Record
import Data.Syntax (emptyTerm, handleError, makeTerm, parseError) import Data.Syntax (emptyTerm, handleError, makeTerm)
import qualified Data.Syntax as Syntax import qualified Data.Syntax as Syntax
import Data.Syntax.Assignment hiding (Assignment, Error) import Data.Syntax.Assignment hiding (Assignment, Error)
import qualified Data.Syntax.Assignment as Assignment import qualified Data.Syntax.Assignment as Assignment
@ -102,7 +102,7 @@ instance Show1 Redirect where liftShowsPrec = genericLiftShowsPrec
-- | Assignment from AST in Python's grammar onto a program in Python's syntax. -- | Assignment from AST in Python's grammar onto a program in Python's syntax.
assignment :: Assignment assignment :: Assignment
assignment = makeTerm <$> symbol Module <*> children (Syntax.Program <$> many expression) <|> parseError assignment = handleError $ makeTerm <$> symbol Module <*> children (Syntax.Program <$> many expression)
expression :: Assignment expression :: Assignment
expression = handleError $ expression = handleError $