www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there a way to tell LDC2 to only check the syntax of the source

reply realhet <real_het hotmail.com> writes:
Hello,

I can turn off linking with      -c
I can turn off compiling with    -o-
How can I turn it off before the semantic passes?

I'm experimenting with a nasty trink: I prepend "__undefinied__ 
_;" into the tested code. And if I get an error:
Error: undefined identifier `__undefinied__`
I know it started to do the semantic analysis, but I wonder if 
there is a prettier way to do this...

```
__undefinied__ _;void removeCard(Card card)
{
	if(card.shortName !in cardMap) return;
         /+More code here, also the syntax could be broken. I 
wan't to detect exactly that.+/
}
```
Dec 06 2023
parent realhet <real_het hotmail.com> writes:
On Wednesday, 6 December 2023 at 11:53:09 UTC, realhet wrote:
 Hello,
I've found another trick: - prepend "version(none):" in front of the source. - ignore the optional "Error: declaration expected, not `module`" message - Take seriously all the other errors, those are only syntax errors, semantically the whole file equals to 'none'. I can also change the line numbers: with the #line directive. Most of the time I will pass it function bodies, not the whole source file.
Dec 06 2023