Skip to content

Commit 0d4a35b

Browse files
author
Hana Dusíková
committed
issue #60: fix for not needed backslash of caret [^^] or [aloha^], but it's still needed at beggining of the class [\^], also fix for allowing backslash minus for ranges in classes.
1 parent 64eba2d commit 0d4a35b

File tree

3 files changed

+124
-72
lines changed

3 files changed

+124
-72
lines changed

include/ctre/pcre.gram

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ block_name->alpha_characters,[push_name],<block_name2>
7171
block_name2->alphanum_characters,[push_name],<block_name2>|epsilon
7272

7373

74-
character_class->sopen,<set>,[set_make],sclose|sopen,caret,<set>,[set_make_negative],sclose
75-
set->minus,[push_character],[set_start],<set2>
76-
set-><setitem>,[set_start],<set2>
77-
set2-><setitem>,[set_combine],<set2>|epsilon
74+
character_class->sopen,<set>,[set_make],sclose|sopen,caret,<set2a>,[set_make_negative],sclose
75+
set->minus,[push_character],[set_start],<set2b>
76+
set-><setitem>,[set_start],<set2b>
77+
set2a-><setitem2>,[set_start],<set2b>|epsilon
78+
set2b-><setitem2>,[set_combine],<set2b>|epsilon
7879

7980
class_named->sopen,colon,<class_named_name>,colon,sclose | sopen,colon,caret,<class_named_name>,[negate_class_named],colon,sclose
8081
class_named_name->"alnum",[class_named_alnum]
@@ -97,6 +98,12 @@ setitem->other,[push_character],<range> | nonspecial_characters,[push_character]
9798
setitem-><class_named>,<range>
9899
setitem->backslash,<backslash_range>,<range> | backslash,<backslash_set>
99100

101+
setitem2->other,[push_character],<range> | nonspecial_characters,[push_character],<range> | nonspecial_characters_in_class,[push_character],<range>
102+
setitem2->caret,[push_character],<range>
103+
setitem2-><class_named>,<range>
104+
setitem2->backslash,<backslash_range>,<range> | backslash,<backslash_set>
105+
106+
100107
range->epsilon
101108
range->minus,other,[push_character],[make_range]|minus,nonspecial_characters,[push_character],[make_range]
102109
range->minus,backslash,<backslash_range>,[make_range]|minus,nonspecial_characters_in_class,[push_character],[make_range]
@@ -119,6 +126,7 @@ backslash_range->0,[push_character_null]
119126
backslash_range->a,[push_character_alarm]
120127
backslash_range->e,[push_character_escape]
121128
backslash_range->f,[push_character_formfeed]
129+
backslash_range->minus,[push_character]
122130

123131
backslash_set->d,[class_digit]|D,[class_nondigit]
124132
backslash_set->w,[class_word]|W,[class_nonword]

0 commit comments

Comments
 (0)