mirror of
https://github.com/RubyMetric/chsrc
synced 2025-07-16 04:07:27 +08:00
Deal with more illegal chars in C variable
This commit is contained in:
parent
78001c002f
commit
4ac8ae9cc0
@ -80,7 +80,12 @@ my class CVariableNameGenerator {
|
||||
$global-config.get('keep-postfix', 'true').as-bool();
|
||||
|
||||
my $name = $section-config.get('name', $title.lc).as-string();
|
||||
$name = $name.subst(/\s+/, '_', :g);
|
||||
# 替换非法字符
|
||||
$name = $name.subst(/<-[a..z A..Z 0..9 _]>/, '_', :g);
|
||||
# 合并连续的下划线
|
||||
$name = $name.subst(/_+/, '_', :g);
|
||||
# 移除结尾的下划线
|
||||
$name = $name.subst(/_+$/, '');
|
||||
|
||||
# 组装变量名
|
||||
my $var-name = "";
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
unit module Version;
|
||||
|
||||
constant VERSION = "0.1.0.1";
|
||||
constant VERSION = "0.1.0.2";
|
||||
constant RELEASE_DATE = "2025/07/14";
|
||||
|
||||
constant Maintain_URL = "https://github.com/RubyMetric/chsrc/blob/dev/tool/rawstr4c";
|
||||
|
Loading…
x
Reference in New Issue
Block a user