anchor.diff:   */
   grammar Golang;
   
  +@parser::members {
  +
  +    /**
  +     * Returns {@code true} iff on the current index of the parser's
  +     * token stream a token exists on the {@code HIDDEN} channel which
  +     * either is a line terminator, or is a multi line comment that
  +     * contains a line terminator.
  +     *
  +     * @return {@code true} iff on the current index of the parser's
  +     * token stream a token exists on the {@code HIDDEN} channel which
  +     * either is a line terminator, or is a multi line comment that
  +     * contains a line terminator.
  +     */
  +    private boolean lineTerminatorAhead() {
  +        // Get the token ahead of the current index.
  +        int possibleIndexEosToken = this.getCurrentToken().getTokenIndex() - 1;
  +        Token ahead = _input.get(possibleIndexEosToken);
  +        if (ahead.getChannel() != Lexer.HIDDEN) {
  +            // We're only interested in tokens on the HIDDEN channel.
  +            return false;
  +        }
  +
  +        if (ahead.getType() == TERMINATOR) {
  +            // There is definitely a line terminator ahead.
  +            return true;
  +        }
  +
  +        if (ahead.getType() == WS) {
  +            // Get the token ahead of the current whitespaces.
  +            possibleIndexEosToken = this.getCurrentToken().getTokenIndex() - 2;
  +            ahead = _input.get(possibleIndexEosToken);
  +        }
  +
  +        // Get the token's text and type.
  +        String text = ahead.getText();
  +        int type = ahead.getType();
  +
  +        // Check if the token is, or contains a line terminator.
  +        return (type == COMMENT && (text.contains("\r") || text.contains("\n"))) ||
  +                (type == TERMINATOR);
  +    }
  +}
  +
  +@lexer::members {
  +
  +    // The most recently produced token.
  +    private Token lastToken = null;
  +
  +    /**
  +     * Return the next token from the character stream and records this last
  +     * token in case it resides on the default channel. This recorded token
  +     * is used to determine when the lexer could possibly match a regex
  +     * literal.
  +     *
  +     * @return the next token from the character stream.
  +     */
  +    @Override
  +    public Token nextToken() {
  +
  +        // Get the next token.
  +        Token next = super.nextToken();
  +
  +        if (next.getChannel() == Token.DEFAULT_CHANNEL) {
  +            // Keep track of the last token on the default channel.
  +            this.lastToken = next;
  +        }
  +
  +        return next;
  +    }
  +}
  +
   //SourceFile       = PackageClause ";" { ImportDecl ";" } { TopLevelDecl ";" } .
   sourceFile
  -    : packageClause ';'? ( importDecl ';'? )* ( topLevelDecl ';'?)*
  +    : packageClause eos ( importDecl eos )* ( topLevelDecl eos)*
       ;
   
   //PackageClause  = "package" PackageName .
  
positive.code: 
  //ConstDecl      = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) .
  constDecl
      : 'const' ( constSpec | '(' ( constSpec ';'? )* ')' )   // TODO EOS optional?
      ;
  
  //ConstSpec      = IdentifierList [ [ Type ] "=" ExpressionList ] .
  
negative.code: // Whitespace and comments
  //
  
  WS  :  [ \t]+ -> channel(HIDDEN)
      ;
  
  COMMENT
      :   '/*' .*? '*/' -> channel(HIDDEN)
      ;
  
  TERMINATOR
  	: [\r\n]+ -> channel(HIDDEN)
  	;
  
  
  LINE_COMMENT
      :   '//' ~[\r\n]* -> skip
  