Skip to content

Commit a9aa772

Browse files
Enum and tags
1 parent f106b96 commit a9aa772

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

faster.regex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
(?<qualifonly>((?&identifierpure))(?(?{checkqualifonly()})|(*F)))
1010

1111
(?<fasterdecls>(?(?=(?{push2 \@matches, {}})(?<declbod>((?(<tagend>)(*F))(\s*+(?&typeorqualifortypdf)\s*+
12-
|\s*+\b(?<tagtype>struct|union|enum)\b\s*+(?<identtag>((?&identifierpure))(?{eval {$matches[-1]{strc}=$^N}}))?+\s*+((?&brackets)(?{register_taggable()}))?+\s*+((?<tagend>;)(?{dispatch_file_scope_stm(pos(),$minlen)}))?+))*+
12+
|(\s*+\b(?<tagtype>struct|union)\b\s*+(?<identtag>((?&identifierpure)?+))(?{eval {$matches[-1]{strc}=$^N}})\s*+
13+
((?&brackets)(?{register_taggable()}))?+\s*+
14+
|\s*+\benum\b\s*+(?<ident_enum>((?&identifierpure)?+))(?{eval {$matches[-1]{strc}=$^N}})\s*+
15+
(\{\s*+(?{push2 \@matches, {}})
16+
(((?&normal_rec)(?&init_q)?+,)*+
17+
(?&normal_rec)(?&init_q)?+,?+)?+
18+
(?{pop2 \@matches})\s*+\}\s*+)?+)((?<tagend>;)(?{dispatch_file_scope_stm(pos(),$minlen)}))?+
19+
))*+
1320
(?(<tagend>)|(?&identoutter)
1421
(\s*+(?&parens)\s*+)*+(?&init_q)?+((,(?&identoutter)(\s*+(?&parens)\s*+)*+(?<init_q>=((?&parens)|(?&brackets)|(?&strunus)|[^\[\]\(\)\{\}'";,])*+)?+)*+
1522
(;(?{dispatch_file_scope_stm(pos(),$minlen)}))
@@ -20,5 +27,5 @@
2027
(?<rndbrcksdecl>\s*\((?<inparen>(?<inparenin>\s*+(?&ptr)*+\s*+((?<identinside>(?&identifierpure))(?{register_normal_decl($+{identinside})})|(?&rndbrcksdecl))(\s*+(?&parens)\s*+)*+\s*)*+
2128
((?&inparenin)(?&inparen))?+)\)\s*)
2229

23-
(?<identoutter>\s*+(?&ptr)*+((?&rndbrcksdecl)|(?<identnormal>(?&identifierpure))(?{register_normal_decl($+{identnormal})}))\s*+)
30+
(?<identoutter>\s*+(?&ptr)*+((?&rndbrcksdecl)|(?<normal_rec>\s*+(?<identnormal>(?&identifierpure))(?{register_normal_decl($+{identnormal})})\s*+))\s*+)
2431

faster.regex.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sub dispatch_file_scope_stm {
2020
}
2121

2222
sub register_taggable {
23-
push_decl($lastcurpos, $+{tagtype} . " " . $+{identtag})
23+
push_decl($lastcurpos, $+{tagtype} . " " . $+{identtag}) if ($+{identtag})
2424
}
2525

2626
sub register_normal_decl {

0 commit comments

Comments
 (0)