no more than once
This commit is contained in:
parent
9f8624d2c7
commit
58e3c8e237
|
@ -9,6 +9,7 @@ import Control.Monad.Combinators.Expr
|
|||
import Data.Text (Text, unpack)
|
||||
import Data.Char (isLetter, isSpace)
|
||||
import Data.List (elemIndex)
|
||||
import Data.Maybe (maybeToList)
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.Monad (guard)
|
||||
|
||||
|
@ -69,7 +70,7 @@ parseSyn ctx = ns (makeExprParser (parseInnerSyn ctx) opTable)
|
|||
parseInnerSyn :: Ctx -> Parser Syn
|
||||
parseInnerSyn ctx = do
|
||||
l <- many (ns goL)
|
||||
r <- many (ns goR)
|
||||
r <- maybeToList <$> optional (ns goR)
|
||||
let lr = l ++ r
|
||||
guard (not (null lr))
|
||||
pure (foldl1 App lr)
|
||||
|
|
Loading…
Reference in New Issue
Block a user