3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-28 21:52:35 +01:00
pbot/modules/compiler_vm/languages
0xACE 1dae484e3f
compiler_vm: C removed unnecessary regex replace (#63)
This problem has previously been encountered. And my last solution was
not satisfactory.

It seems like there were 2 regex lines, one targeting `//` and another
targeting `/* */`.

Originally they were basically meant to perform this:

Search for

```c
;<COMMENT>;\n
```

and replacing it with

```c
;<COMMENT>
```

In e00ba2e62f I provided a patch to add
another `;` for `//` as it would eat the first `;` after the `<COMMENT>`

After thinking for some time, I came to the conclusion that the lines of
REGEX serve no purpose and should be removed.

For future reference:

e00ba2e62f was targeting this problem:

```c
printf("why is the last ; missing?"); // foo \n int a=42;
```

which generated something along the lines of

```c
    printf("why is the last ; missing?");
// foo
    int a = 42return 0;
```

Where it would strip a `;` from the first line after a `//` comment

And this commit additionally targeted:

```c
printf("foo\n");
//printf("bar\n");
printf("baz\n");
// only happens if the line ends with ; eg:
printf("hello\n");
// deny with ;
printf("world\n");
```
output:

    foo
    hello

expected:

    foo
    baz
    hello
    world

where it generated the code:

```c
    printf("foo\n");
//printf("bar\n" );printf("baz\n" );
// only happens if the line ends with ; eg:
    printf("hello\n");
// deny with ;printf("world\n" );
```

Thus this should fix #62 and the original problem
2021-11-03 14:31:07 -07:00
..
server modules/compiler_vm: ASAN now works 2021-10-19 21:03:34 -07:00
_c_base.pm compiler_vm: C removed unnecessary regex replace (#63) 2021-11-03 14:31:07 -07:00
_default.pm modules/compiler_vm: replace ix.io with 0x0.st for pastes 2021-09-17 13:38:04 -07:00
bash.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
bc.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
bf.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
c11.pm modules/compiler_vm: ASAN now works 2021-10-19 21:03:34 -07:00
c89.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
c99.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
clang11.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
clang89.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
clang99.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
clang.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
clangpp.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
clisp.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
cpp.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
freebasic.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
go.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
haskell.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
java.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
javascript.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
ksh.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
lua.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
perl.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
php.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
python3.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
python.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
qbasic.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
ruby.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
scheme.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
sh.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
tcl.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
tendra.pm Relicense under MIT 2021-07-10 15:00:22 -07:00
zsh.pm Relicense under MIT 2021-07-10 15:00:22 -07:00