Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

looser treatment for xml-extended php; b'' todo

Summary: was failing on the codebase

Reviewed By: marcel

Test Plan: id

Revert Plan: ok
  • Loading branch information...
commit bba46b0637b07c75d11f8dd572f86ef830b41221 1 parent 54b938f
Daniel Corson authored
Showing with 11 additions and 5 deletions.
  1. +1 −0  README
  2. +4 −2 src/Lang/Php/Ast/Expr.hs
  3. +6 −3 src/Lang/Php/Ast/Lex.hs
View
1  README
@@ -28,6 +28,7 @@ to use
notes for those hacking on lex-pass itself
- todo
+ - php: b'' type string literals
- maintain cached asts for codebase somewhere so ppl don't have to wait on
their first lex-pass run?
- better error on one-arg transf's if args wrong?
View
6 src/Lang/Php/Ast/Expr.hs
@@ -562,8 +562,10 @@ eptOrWd = binOp BOrWd tokOrWdP
instance Parse Xml where
parse = tokLTP >> do
- tag <- many1 (oneOf $ [':', '-'] ++ ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'])
- attrs <- IC.intercalParser parse . liftM2 (,) genIdentifierParser $
+ tag <- many1 . oneOf $
+ -- i thought _ wasn't allowed but i guess when marcel's away e will play
+ [':', '-', '_'] ++ ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9']
+ attrs <- IC.intercalParser parse . liftM2 (,) xmlIdentifierParser $
Just <$> try (liftM2 (,) (liftM2 (,) parse (tokEqualsP >> parse)) $
(tokLBraceP >> Right <$> parse <* tokRBraceP) <|>
Left <$> parse) <|>
View
9 src/Lang/Php/Ast/Lex.hs
@@ -90,10 +90,13 @@ identXmlChars = identStartChars ++ ['0'..'9'] ++ ['-']
genIdentifierParser :: Parser String
genIdentifierParser =
- liftM2 (:) (satisfy (`elem` identStartChars))
- (many $ satisfy (`elem` identEndChars)) <|>
+ liftM2 (:) (oneOf identStartChars)
+ (many $ oneOf identEndChars) <|>
concat <$> many1
- (liftM2 (++) tokColonP . many1 $ satisfy (`elem` identXmlChars))
+ (liftM2 (++) tokColonP . many1 $ oneOf identXmlChars)
+
+xmlIdentifierParser :: Parser String
+xmlIdentifierParser = many1 $ oneOf identXmlChars
identifierParser :: Parser String
identifierParser = try $ do
Please sign in to comment.
Something went wrong with that request. Please try again.