From dfbe85e5a0d296a40cefbcec2e23ecd84e70301b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 14 Aug 2017 16:56:40 -0400 Subject: [PATCH] Define a helper to contextualize infix terms. --- src/Language/Python/Syntax.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 9baa9dd77..23c0a661a 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -13,7 +13,7 @@ import Data.Functor.Classes.Eq.Generic import Data.Functor.Classes.Show.Generic import Data.Maybe (fromMaybe) import Data.Record -import Data.Syntax (contextualize, emptyTerm, handleError, makeTerm, makeTerm', makeTerm1) +import Data.Syntax (contextualize, emptyTerm, handleError, infixContext, makeTerm, makeTerm', makeTerm1) import qualified Data.Syntax as Syntax import Data.Syntax.Assignment hiding (Assignment, Error) import qualified Data.Syntax.Assignment as Assignment @@ -471,3 +471,10 @@ conditionalExpression = makeTerm <$> symbol ConditionalExpression <*> children ( term :: Assignment -> Assignment term = contextualize comment + +infixTerm :: HasCallStack + => Assignment + -> Assignment + -> [Assignment.Assignment (AST Grammar) Grammar (Term -> Term -> Union Syntax Term)] + -> Assignment.Assignment (AST Grammar) Grammar (Union Syntax Term) +infixTerm = infixContext comment