Skip to content

Commit b469b42

Browse files
committed
\x{} now recommends \x[]
1 parent 8adbc60 commit b469b42

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

STD.pm6

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ token charspec {
425425
| :dba('character name') '[' ~ ']' <charnames>
426426
| \d+
427427
| <[ ?..Z \\.._ ]>
428+
| <.obsbrack>
428429
| <?> <.sorry: "Unrecognized \\c character"> .
429430
]
430431
}
@@ -849,6 +850,8 @@ token rad_number {
849850
]
850851
}
851852

853+
token obsbrack { '{' <.obs('curly brackets','square brackets')> }
854+
852855
token terminator:sym<)>
853856
{ <sym> <O(|%terminator)> }
854857

@@ -4290,10 +4293,10 @@ grammar Q is STD {
42904293
<sym>
42914294
[ <?before '{'> <.worryobs('\N{...}', '\c[...]')> ]?
42924295
}
4293-
token backslash:o { :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> ] }
4296+
token backslash:o { :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> ] | <.obsbrack> }
42944297
token backslash:r { <sym> }
42954298
token backslash:t { <sym> }
4296-
token backslash:x { :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> ] }
4299+
token backslash:x { :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> | <.obsbrack> ] }
42974300
token backslash:sym<0> { <sym> }
42984301
}
42994302

@@ -4464,13 +4467,13 @@ grammar Q is STD {
44644467
token backslash:f { :i <sym> }
44654468
token backslash:h { :i <sym> { $*CCSTATE = '' } }
44664469
token backslash:n { :i <sym> }
4467-
token backslash:o { :i :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> ] }
4470+
token backslash:o { :i :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> | <.obsbrack> ] }
44684471
token backslash:r { :i <sym> }
44694472
token backslash:s { :i <sym> { $*CCSTATE = '' } }
44704473
token backslash:t { :i <sym> }
44714474
token backslash:v { :i <sym> { $*CCSTATE = '' } }
44724475
token backslash:w { :i <sym> { $*CCSTATE = '' } }
4473-
token backslash:x { :i :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> ] }
4476+
token backslash:x { :i :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> ] | <.obsbrack> }
44744477
token backslash:sym<0> { <sym> }
44754478

44764479
# keep random backslashes like qq does
@@ -5127,7 +5130,7 @@ grammar Regex is STD {
51275130
<sym> <.SIGOK>
51285131
[ <?before '{'> <.worryobs('\N{...}', '\c[...], or disambiguate with whitespace')> ]?
51295132
}
5130-
token backslash:o { :i :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> ] <.SIGOK> }
5133+
token backslash:o { :i :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> | <.obsbrack> ] <.SIGOK> }
51315134
token backslash:p {
51325135
:my $s;
51335136
:my $m;
@@ -5146,7 +5149,7 @@ grammar Regex is STD {
51465149
token backslash:t { :i <sym> <.SIGOK> }
51475150
token backslash:v { :i <sym> <.SIGOK> }
51485151
token backslash:w { :i <sym> <.SIGOK> }
5149-
token backslash:x { :i :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> ] <.SIGOK> }
5152+
token backslash:x { :i :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> | <.obsbrack> ] <.SIGOK> }
51505153
token backslash:z { <sym> <.obs('\\z as end-of-string matcher', '$')> }
51515154
token backslash:Z { <sym> <.obs('\\Z as end-of-string matcher', '\\n?$')> }
51525155
token backslash:misc { $<litchar>=(\W) <.SIGOK> }

0 commit comments

Comments
 (0)