Skip to content

Commit cb6c261

Browse files
author
Pascal "Pixel" Rigaux
committed
1 parent 131cfd3 commit cb6c261

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

Perl5Parser/Serialize.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ to_s_QuoteLike Glob s = "<" ++ s ++ ">"
6464
to_s_QuoteLike Readline s = "<" ++ s ++ ">"
6565
to_s_QuoteLike Backstick s = "`" ++ s ++ "`"
6666
to_s_QuoteLike (Words t) s = "qw" ++ to_s_structure t s
67+
to_s_QuoteLike (Command t) s = "qx" ++ to_s_structure t s
6768

6869
to_s_Regexp (Match Nothing s opt) = "/" ++ s ++ "/" ++ opt
6970
to_s_Regexp (Match (Just t) s opt) = "m" ++ to_s_structure t s ++ opt

Perl5Parser/Token.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ p_Token = do pcons p spaces_comments
8282
<|> fmap Regexp Perl5Parser.Token.Regexp.p_Transliterate
8383
<|> fmap Regexp Perl5Parser.Token.Regexp.p_Qr
8484
<|> fmap to_QuoteLike Perl5Parser.Token.QuoteLike.p_Backstick
85+
<|> fmap to_QuoteLike Perl5Parser.Token.QuoteLike.p_Qx
8586
<|> fmap to_QuoteLike Perl5Parser.Token.QuoteLike.p_Words
8687

8788
-- !! HereDoc before Readline and Glob !!

Perl5Parser/Token/QuoteLike.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Perl5Parser.Token.QuoteLike
33
, p_Glob
44
, p_Words
55
, p_Backstick
6+
, p_Qx
67
) where
78

89
import Perl5Parser.Types
@@ -33,3 +34,7 @@ p_Backstick :: Perl5Parser (QuoteLikeT, String)
3334
p_Backstick = do char '`'
3435
(_, s) <- inside_string '`'
3536
return (Backstick, s)
37+
38+
p_Qx :: Perl5Parser (QuoteLikeT, String)
39+
p_Qx = do (structure, s) <- user_delimited_string "qx"
40+
return (Command structure, s)

Perl5Parser/Types.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ data QuoteLikeT =
4545
| Readline
4646
| Backstick
4747
| Words LiteralT
48+
| Command LiteralT
4849
deriving Show
4950

5051
type RegexpOptionT = String

test.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ ok_exprs = [
112112
-- exprs
113113
, ("(sub { 1 }, 2)", "((sub { 1 }), 2)")
114114
, ("(sub => 1, 2)", "((sub => 1), 2)")
115+
, ("qw (1 2)", "qw (1 2)")
116+
, ("qx (1 2)", "qx (1 2)")
117+
, ("qr (1 2)", "qr (1 2)")
115118
-- regexp
116119
, ("/\\//", "/\\//")
117120
, ("$s =~ s {1} {2}", "$s =~ s {1} {2}")

0 commit comments

Comments
 (0)