3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-01 17:16:39 +02:00

compiler_vm: fix leading whitespace in $func_regex (#61)

Fixes the issue where a function has a trailing whitespace before a line
break.

example:
```
void foo(){}
int main(){return 0;}
```
This commit is contained in:
0xACE 2021-10-06 18:06:55 +00:00 committed by GitHub
parent 347e4ac69f
commit 7692b57f58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,7 +237,7 @@ sub preprocess_code {
print "looking for functions, has main: $has_main\n" if $self->{debug} >= 2;
my $func_regex = qr/^([ *\w]+)\s+([ ()*\w:\\]+)\s*\(([^;{]*)\s*\)\s*(\{.*|<%.*|\?\?<.*)/ims;
my $func_regex = qr/^\s*([ *\w]+)\s+([ ()*\w:\\]+)\s*\(([^;{]*)\s*\)\s*(\{.*|<%.*|\?\?<.*)/ims;
# look for potential functions to extract
while($preprecode =~ /$func_regex/ms) {