@@ -339,6 +339,8 @@ pSimpleExtExpr syn = do i <- getState
339 pExtensions syn (filter simple (syntax_rules i))
339 pExtensions syn (filter simple (syntax_rules i))
341 simple (Rule (Expr x:xs) _ _) = False
341 simple (Rule (Expr x:xs) _ _) = False
342+ simple (Rule [Keyword _] _ _) = True
343+ simple (Rule [Symbol _] _ _) = True
342 simple (Rule (_:xs) _ _) = case (last xs) of
344 simple (Rule (_:xs) _ _) = case (last xs) of
343 Keyword _ -> True
345 Keyword _ -> True
344 Symbol _ -> True
346 Symbol _ -> True
@@ -387,6 +389,7 @@ pExt syn (Rule (s:ssym) ptm _)
387 update ns (PApp fc t args) = PApp fc (update ns t) (map (fmap (update ns)) args)
389 update ns (PApp fc t args) = PApp fc (update ns t) (map (fmap (update ns)) args)
388 update ns (PPair fc l r) = PPair fc (update ns l) (update ns r)
390 update ns (PPair fc l r) = PPair fc (update ns l) (update ns r)
389 update ns (PDPair fc l t r) = PDPair fc (update ns l) (update ns t) (update ns r)
391 update ns (PDPair fc l t r) = PDPair fc (update ns l) (update ns t) (update ns r)
392+ update ns (PAlternative as) = PAlternative (map (update ns) as)
390 update ns (PHidden t) = PHidden (update ns t)
393 update ns (PHidden t) = PHidden (update ns t)
391 update ns (PDoBlock ds) = PDoBlock $ upd ns ds
394 update ns (PDoBlock ds) = PDoBlock $ upd ns ds
392 where upd ns (DoExp fc t : ds) = DoExp fc (update ns t) : upd ns ds
395 where upd ns (DoExp fc t : ds) = DoExp fc (update ns t) : upd ns ds
@@ -421,6 +424,7 @@ pSimpleExpr syn =
421 return (PTactics ts)
424 return (PTactics ts)
422 <|> try (do x <- pfName; fc <- pfc; return (PRef fc x))
425 <|> try (do x <- pfName; fc <- pfc; return (PRef fc x))
423 <|> try (pPair syn)
426 <|> try (pPair syn)
424 <|> try (do lchar '('; e <- pExpr syn; lchar ')'; return e)
428 <|> try (do lchar '('; e <- pExpr syn; lchar ')'; return e)
425 <|> try (do c <- pConstant; fc <- pfc
429 <|> try (do c <- pConstant; fc <- pfc
426 return (modifyConst syn fc (PConstant c)))
430 return (modifyConst syn fc (PConstant c)))
@@ -448,7 +452,11 @@ pPair syn = try (do lchar '('; l <- pExpr syn; op <- pairOp
449 pairOp = do lchar ','; return PPair
453 pairOp = do lchar ','; return PPair
450 <|> do reservedOp "**"; return (\f x y -> PDPair f x Placeholder y)
454 <|> do reservedOp "**"; return (\f x y -> PDPair f x Placeholder y)
456+pAlt syn = do symbol "(|";
457+ alts <- sepBy1 (pExpr' syn) (lchar ',')
459+ return (PAlternative alts)
453pHSimpleExpr syn
461pHSimpleExpr syn
454 = do lchar '.'
462 = do lchar '.'
@@ -792,6 +800,7 @@ expandDo dsl (PApp fc t args) = PApp fc (expandDo dsl t)
792expandDo dsl (PPair fc l r) = PPair fc (expandDo dsl l) (expandDo dsl r)
800expandDo dsl (PPair fc l r) = PPair fc (expandDo dsl l) (expandDo dsl r)
793expandDo dsl (PDPair fc l t r) = PDPair fc (expandDo dsl l) (expandDo dsl t)
801expandDo dsl (PDPair fc l t r) = PDPair fc (expandDo dsl l) (expandDo dsl t)
794 (expandDo dsl r)
802 (expandDo dsl r)
803+expandDo dsl (PAlternative as) = PAlternative (map (expandDo dsl) as)
795expandDo dsl (PHidden t) = PHidden (expandDo dsl t)
804expandDo dsl (PHidden t) = PHidden (expandDo dsl t)
796expandDo dsl (PReturn fc) = PRef fc (dsl_return dsl)
805expandDo dsl (PReturn fc) = PRef fc (dsl_return dsl)
797expandDo dsl (PDoBlock ds) = expandDo dsl $ block (dsl_bind dsl) ds
806expandDo dsl (PDoBlock ds) = expandDo dsl $ block (dsl_bind dsl) ds