Skip to content

Commit 9fb6a5b

Browse files
committed
Add hamlet operator parsing from shakespeare#223
Corresponds to yesodweb/shakespeare#223 Bump xml-hamlet to 0.5.1
1 parent bff3d3d commit 9fb6a5b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

xml-hamlet/Text/Hamlet/XMLParse.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{-# LANGUAGE DeriveDataTypeable #-}
22
{-# LANGUAGE FlexibleContexts #-}
3-
{-# LANGUAGE CPP #-}
43
module Text.Hamlet.XMLParse
54
( Result (..)
65
, Content (..)
@@ -15,7 +14,7 @@ module Text.Hamlet.XMLParse
1514
import Text.Shakespeare.Base
1615
import Control.Applicative ((<$>), Applicative (..))
1716
import Control.Monad
18-
import Data.Char (isUpper)
17+
import Data.Char (GeneralCategory(..), generalCategory, isUpper)
1918
import Data.Data
2019
import Text.ParserCombinators.Parsec hiding (Line)
2120

@@ -223,7 +222,8 @@ parseLine = do
223222

224223
ident :: Parser Ident
225224
ident = do
226-
i <- many1 (alphaNum <|> char '_' <|> char '\'')
225+
i <- many1 (alphaNum <|> char '_' <|> char '\'') <|>
226+
(char '(' *> many1 (satisfy (\c -> generalCategory c == OtherPunctuation)) <* char ')')
227227
white
228228
return (Ident i)
229229
<?> "identifier"
@@ -247,7 +247,7 @@ parseLine = do
247247
isVariable (Ident (x:_)) = not (isUpper x)
248248
isVariable (Ident []) = error "isVariable: bad identifier"
249249

250-
isConstructor (Ident (x:_)) = isUpper x
250+
isConstructor (Ident (x:_)) = isUpper x || generalCategory x == OtherPunctuation
251251
isConstructor (Ident []) = error "isConstructor: bad identifier"
252252

253253
identPattern :: Parser Binding

xml-hamlet/xml-hamlet.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: xml-hamlet
2-
Version: 0.5.0
2+
Version: 0.5.1
33
Synopsis: Hamlet-style quasiquoter for XML content
44
Homepage: http://www.yesodweb.com/
55
License: BSD3

0 commit comments

Comments
 (0)