Semicolon?

evilrat evilrat666 at gmail.com
Thu Apr 1 19:32:17 UTC 2021


On Thursday, 1 April 2021 at 17:10:02 UTC, jmh530 wrote:
>
> The only thing I can think of is that when the compiler sees an 
> error, it can check if the prior line ends with a semicolon, 
> then it can check if the error would be generated if a 
> semicolon is added. Finally, display an error about missing a 
> semicolon.

I think in languages where it is optional the rules are a bit 
different.

e.g. the only thing that can force a newline NOT to be treated as 
semicolon is AFTER following symbols:
```
* / - + : ! @ . , ( { [
```

They are like normal punctuation in a real sentence, if you put 
it you are going to end a sentence, which is natural, otherwise 
it is abrupt and doesn't makes sense.

So a junk like

   int a = b
   *c

in no way is equal to

   int a = b * c


More information about the Digitalmars-d mailing list