3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-02 00:49:26 +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 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
..
c2english modules/c2english: fix #pragma 2021-10-15 18:54:53 -07:00
cjeopardy Relicense under MIT 2021-07-10 15:00:22 -07:00
compiler_vm compiler_vm: C removed unnecessary regex replace (#63) 2021-11-03 14:31:07 -07:00
paren modules/paren: specify python2 in shebang 2021-09-09 11:55:31 -07:00
qrpn Add qrpn module 2021-10-19 21:00:43 -07:00
ago.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
bashfaq.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
bashfaq.txt Add bash faq 2021-05-23 16:11:56 -07:00
bashpf.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
bashpf.txt Add bash pitfalls module 2021-05-23 17:56:40 -07:00
c2english.pl modules/c2english.pl: limit cpu time on semantic checker 2021-10-19 20:59:40 -07:00
c11std.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
c99std.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
cdecl.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
cfacts.txt Remove useless cfacts 2015-09-08 01:24:13 -07:00
cfaq-questions.html Update C-Faq module to use latest questions and links 2014-04-22 15:10:10 +00:00
cfaq.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
codepad.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
compiler_block.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
compiler_client.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
compliment Relicense under MIT 2021-07-10 15:00:22 -07:00
compliments.txt Add surreal "compliments" offline text file 2016-07-13 10:13:03 -07:00
date.sh modules/date.sh: use TZDIR 2021-02-07 14:05:21 -08:00
define.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
dice_roll.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
dict.org.pl Tidy things up 2020-02-15 14:38:32 -08:00
excuse.sh Relicense under MIT 2021-07-10 15:00:22 -07:00
excuses.txt Misc updates to modules/compiler_vm 2013-08-16 17:28:17 +00:00
expand_macros.pl modules/expand_macros.pl: add some default #includes and use -ftrack-macro-expansion=0 to omit macro tracking noise added in recentish GCC upgrade 2021-08-08 14:13:02 -07:00
fnord.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
fnord.txt Update modules 2017-04-10 19:40:14 -07:00
funnyish_quote.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
gdefine.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
gen_cfacts.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
gencstd.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
get_title.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
getcfact.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
headlines.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
horoscope Relicense under MIT 2021-07-10 15:00:22 -07:00
horrorscope Relicense under MIT 2021-07-10 15:00:22 -07:00
insult.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
insults.txt Add insults offline text file 2016-07-15 13:34:19 -07:00
jisho.sh Add modules/jisho.sh 2020-01-14 17:01:27 -08:00
lookupbot.pl Tidy things up 2020-02-15 14:38:32 -08:00
love_quote.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
man.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
map.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
math.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
n1256.html Misc bug fixes and tweaks 2012-07-22 19:22:30 +00:00
n1256.out Add n1256.out and n1570.out 2013-11-18 15:00:14 +00:00
n1256.txt Updated c99std and c11std to index footnotes 2012-01-23 22:24:51 +00:00
n1570-cfact.txt Update C facts module 2014-08-31 20:23:27 +00:00
n1570.html Misc bug fixes and tweaks 2012-07-22 19:22:30 +00:00
n1570.out Add n1256.out and n1570.out 2013-11-18 15:00:14 +00:00
n1570.txt Updated c99std and c11std to index footnotes 2012-01-23 22:24:51 +00:00
nickometer.pl Tidy things up 2020-02-15 14:38:32 -08:00
prototype.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
qalc.pl modules/qalc.pl: refactor and clean-up ugly code 2021-08-02 17:52:38 -07:00
random_quote.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
rpn.pl Tidy things up 2020-02-15 14:38:32 -08:00
trans.pl modules/trans.pl: use -no-ansi instead of regex 2021-01-19 02:23:10 -08:00
urban Relicense under MIT 2021-07-10 15:00:22 -07:00
wikipedia.pl Relicense under MIT 2021-07-10 15:00:22 -07:00
wiktionary.pl modules/wiktionary.pl: always show all entries 2021-10-19 21:01:45 -07:00
wiktionary.py Relicense under MIT 2021-07-10 15:00:22 -07:00