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 and update stackage build
  • Loading branch information
dylex committed Sep 13, 2018
1 parent bff3d3d commit ecfb61f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
9 changes: 1 addition & 8 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ packages:
- xml-conduit/
- xml-hamlet/
- html-conduit/
resolver: lts-10.3
extra-deps:
- conduit-1.3.0
- conduit-extra-1.3.0
- resourcet-1.2.0
- mono-traversable-1.0.8.1
- unliftio-core-0.1.1.0
- typed-process-0.2.1.0
resolver: lts-11.22
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 ecfb61f

Please sign in to comment.