Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hamlet operator parsing from shakespeare#223 #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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