I don't know Go, I am just studying various languages syntax.
From Go FAQ: "Go borrows a trick from BCPL: the semicolons that separate statements are in the formal grammar but are injected automatically, without lookahead, by the lexer at the end of any line that could be the end of a statement."
I wonder how it is done, I took a look at lex.go
but maybe I don't know Go enough (very little actually) but I didn't find any reference to "statement" or "semicolon".
So – how can you detect at lexer stage end of the valid statement without even lookahead?