alliedmodders/sourcemod — pull request #88 by dvander (2014-07-12 07:16:07+00:00)
Title: Fix and formalize newline and semicolon behavior in methodmaps. (bug 6175)

This patch formalizes line endings a bit for methodmaps. The new rules are:
* The body of a methodmap or class may end in a semicolon.
* Native declarations in a methodmap or class may end in a semicolon.
* "Assignment" declarations in a methodmap may end in a semicolon.
* Function and property bodies may not end in a semicolon.
* All declarations in a methodmap or class, including the body itself, must end in a newline. If a semicolon is present, the semicolon must be on the same line as both the newline and the terminating token.

The way this is implemented is via a new `peek_same_line` construct in the lexer. This will return either end-of-line, or a token ID that is not on the same line. The lexer now attaches line/col information into token data to make this work.

I am gunning to remove `#pragma semicolon` in a future version of SourcePawn, and to revise official style to dissuade them. If we can get there, this patch will be mostly pointless, but for now I've tried to match what other Pawn constructs do. Getting the correct newline behavior at least is a step forward.