3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-02-10 19:40:56 +01:00
pbot/modules
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 e00ba2e62fd4a72b9c1ac94894c2279884e55b60 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:

e00ba2e62fd4a72b9c1ac94894c2279884e55b60 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
..
2021-10-15 18:54:53 -07:00
2021-07-10 15:00:22 -07:00
2021-10-19 21:00:43 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-05-23 16:11:56 -07:00
2021-07-10 15:00:22 -07:00
2021-05-23 17:56:40 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2015-09-08 01:24:13 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-02-07 14:05:21 -08:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2020-02-15 14:38:32 -08:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2017-04-10 19:40:14 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2016-07-15 13:34:19 -07:00
2020-01-14 17:01:27 -08:00
2020-02-15 14:38:32 -08:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2012-07-22 19:22:30 +00:00
2013-11-18 15:00:14 +00:00
2014-08-31 20:23:27 +00:00
2012-07-22 19:22:30 +00:00
2013-11-18 15:00:14 +00:00
2020-02-15 14:38:32 -08:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2020-02-15 14:38:32 -08:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00
2021-07-10 15:00:22 -07:00