Skip to content

Commit

Permalink
Add hamlet operator parsing from shakespeare#223
Browse files Browse the repository at this point in the history
Corresponds to yesodweb/shakespeare#223

Bump xml-hamlet to 0.5.1
  • Loading branch information
dylex committed Sep 14, 2018
1 parent bff3d3d commit 9fb6a5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions xml-hamlet/Text/Hamlet/XMLParse.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
module Text.Hamlet.XMLParse
( Result (..)
, Content (..)
Expand All @@ -15,7 +14,7 @@ module Text.Hamlet.XMLParse
import Text.Shakespeare.Base
import Control.Applicative ((<$>), Applicative (..))
import Control.Monad
import Data.Char (isUpper)
import Data.Char (GeneralCategory(..), generalCategory, isUpper)
import Data.Data
import Text.ParserCombinators.Parsec hiding (Line)

Expand Down Expand Up @@ -223,7 +222,8 @@ parseLine = do

ident :: Parser Ident
ident = do
i <- many1 (alphaNum <|> char '_' <|> char '\'')
i <- many1 (alphaNum <|> char '_' <|> char '\'') <|>
(char '(' *> many1 (satisfy (\c -> generalCategory c == OtherPunctuation)) <* char ')')
white
return (Ident i)
<?> "identifier"
Expand All @@ -247,7 +247,7 @@ parseLine = do
isVariable (Ident (x:_)) = not (isUpper x)
isVariable (Ident []) = error "isVariable: bad identifier"

isConstructor (Ident (x:_)) = isUpper x
isConstructor (Ident (x:_)) = isUpper x || generalCategory x == OtherPunctuation
isConstructor (Ident []) = error "isConstructor: bad identifier"

identPattern :: Parser Binding
Expand Down
2 changes: 1 addition & 1 deletion xml-hamlet/xml-hamlet.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: xml-hamlet
Version: 0.5.0
Version: 0.5.1
Synopsis: Hamlet-style quasiquoter for XML content
Homepage: http://www.yesodweb.com/
License: BSD3
Expand Down

0 comments on commit 9fb6a5b

Please sign in to comment.