Changeset 7943
- Timestamp:
- 11/13/05 04:54:04 (3 years ago)
- Files:
-
- 3 modified
-
src/Pugs/Lexer.hs (modified) (2 diffs)
-
src/Pugs/Pretty.hs (modified) (1 diff)
-
t/builtins/perl.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Lexer.hs
r7901 r7943 61 61 maybeParens :: CharParser st a -> CharParser st a 62 62 maybeParens p = choice [ parens p, p ] 63 maybeBrackets :: CharParser st a -> CharParser st a 64 maybeBrackets p = choice [ brackets p, p ] 63 65 64 66 parens :: CharParser st a -> CharParser st a … … 204 206 charNum :: GenParser Char st Char 205 207 charNum = do{ code <- decimal 206 <|> do{ char 'o'; number 8 octDigit }207 <|> do{ char 'x'; number 16 hexDigit }208 <|> do{ char 'd'; number 10 digit }208 <|> do{ char 'o'; maybeBrackets $ number 8 octDigit } 209 <|> do{ char 'x'; maybeBrackets $ number 16 hexDigit } 210 <|> do{ char 'd'; maybeBrackets $ number 10 digit } 209 211 ; return (toEnum (fromInteger code)) 210 212 } -
src/Pugs/Pretty.hs
r7872 r7943 187 187 quoted '\r' = "\\r" 188 188 quoted '\n' = "\\n" 189 quoted x | x < ' ' = "{chr " ++ show (ord x) ++ "}" 190 -- XXX is there a more elegant way? Remember that 191 -- my $str = chr(12) ~ "3"; $str.perl 192 -- may not perlify to "\123"... 189 quoted '$' = "\\$" 190 quoted '@' = "\\@" 191 quoted '%' = "\\%" 192 quoted '&' = "\\&" 193 quoted x | x < ' ' || x > '~' = "\\d[" ++ show (ord x) ++ "]" 193 194 quoted x = [x] 194 195 -
t/builtins/perl.t
r7804 r7943 9 9 # Basic scalar values 10 10 42, 42/10, 4.2, sqrt(2), 3e5, Inf, -Inf, NaN, 11 "a string", "", "\0", "\t", "\n", "\r\n", "\7", '{', '}', "\123", 11 "a string", "", "\0", "\t", "\n", "\r\n", "\7", '{', '}', "\123", '$a @string %with &sigils()', 12 12 ?1, ?0, 13 13 undef,
