anchor.diff:  	|	lexerRule
   	;
   
  -// The specification of an EBNF rule in ANTLR style, with all the
  -// rule level parameters, declarations, actions, rewrite specs and so
  -// on.
  -//
  -// Note that here we allow any number of rule declaration sections (such
  -// as scope, returns, etc) in any order and we let the upcoming semantic
  -// verification of the AST determine if things are repeated or if a
  -// particular functional element is not valid in the context of the
  -// grammar type, such as using returns in lexer rules and so on.
   parserRuleSpec
  -	:	// A rule may start with an optional documentation comment
  -		DOC_COMMENT?
  -
  -		// Following the documentation, we can declare a rule to be
  -		// public, private and so on. This is only valid for some
  -		// language targets of course but the target will ignore these
  -		// modifiers if they make no sense in that language.
  -		ruleModifiers?
  -
  -		// Next comes the rule name. Here we do not distinguish between
  -		// parser or lexer rules, the semantic verification phase will
  -		// reject any rules that make no sense, such as lexer rules in
  -		// a pure parser or tree parser.
  -		name=RULE_REF
  -
  -		// Immediately following the rulename, there may be a specification
  -		// of input parameters for the rule. We do not do anything with the
  -		// parameters here except gather them for future phases such as
  -		// semantic verifcation, type assignment etc. We require that
  -		// the input parameters are the next syntactically significant element
  -		// following the rule id.
  -		argActionParameters?
  -
  -		ruleReturns?
  -
  -		throwsSpec?
  -
  -		localsSpec?
  -
  -		// Now, before the rule specification itself, which is introduced
  -		// with a COLON, we may have zero or more configuration sections.
  -		// As usual we just accept anything that is syntactically valid for
  -		// one form of the rule or another and let the semantic verification
  -		// phase throw out anything that is invalid.
  -
  -		// At the rule level, a programmer may specify a number of sections, such
  -		// as scope declarations, rule return elements, @ sections (which may be
  -		// language target specific) and so on. We allow any number of these in any
  -		// order here and as usual rely onthe semantic verification phase to reject
  -		// anything invalid using its addinotal context information. Here we are
  -		// context free and just accept anything that is a syntactically correct
  -		// construct.
  -		//
  -		rulePrequels
  -
  +	:	DOC_COMMENT?
  +        ruleModifiers? RULE_REF ARG_ACTION?
  +        ruleReturns? throwsSpec? localsSpec?
  +		rulePrequel*
   		COLON
  -
  -		// The rule is, at the top level, just a list of alts, with
  -		// finer grained structure defined within the alts.
  -		ruleBlock
  -
  -		';'
  -
  +            ruleBlock
  +		SEMI
   		exceptionGroup
   	;
   
  -// Many language targets support exceptions and the rule will
  -// generally be able to throw the language target equivalent
  -// of a recognition exception. The grammar programmar can
  -// specify a list of exceptions to catch or a generic catch all
  -// and the target language code generation template is
  -// responsible for generating code that makes sense.
   exceptionGroup
   	:	exceptionHandler* finallyClause?
   	;
   
  -// Specifies a handler for a particular type of exception
  -// thrown by a rule
   exceptionHandler
  -	:	CATCH argActionBlock actionBlock
  +	:	CATCH ARG_ACTION ACTION
   	;
   
   finallyClause
  -	:	FINALLY actionBlock
  -	;
  -
  -rulePrequels
  -	:	rulePrequel*
  -	;
  -
  -// An individual rule level configuration as referenced by the ruleActions
  -// rule above.
  -//
  +	:	FINALLY ACTION
  +	;
  +
   rulePrequel
  -	:	optionsDef
  +	:	optionsSpec
   	|	ruleAction
   	;
   
  -// A rule can return elements that it constructs as it executes.
  -// The return values are specified in a 'returns' prequel element,
  -// which contains ',' separated declarations, where the declaration
  -// is target language specific. Here we see the returns declaration
  -// as a single lexical action element, to be processed later.
  -//
   ruleReturns
  -	:	RETURNS argActionParameters
  -	;
  -
  -// --------------
  -// Exception spec
  -//
  -// Some target languages, such as Java and C# support exceptions
  -// and they are specified as a prequel element for each rule that
  -// wishes to throw its own exception type. Note that the name of the
  -// exception is just a single word, so the header section of the grammar
  -// must specify the correct import statements (or language equivalent).
  -// Target languages that do not support exceptions just safely ignore
  -// them.
  -//
  +	:	RETURNS ARG_ACTION
  +	;
  +
   throwsSpec
  -	:	THROWS id (',' id)*
  +	:	THROWS id (COMMA id)*
   	;
   
   localsSpec
  -	:	LOCALS argActionParameters
  -	;
  -
  -// @ Sections are generally target language specific things
  -// such as local variable declarations, code to run before the
  -// rule starts and so on. Fir instance most targets support the
  -// @init {} section where declarations and code can be placed
  -// to run before the rule is entered. The C target also has
  -// an @declarations {} section, where local variables are declared
  -// in order that the generated code is C89 copmliant.
  -//
  +	:	LOCALS ARG_ACTION
  +	;
  +
   /** Match stuff like @init {int i;} */
   ruleAction
  -	:	AT id actionBlock
  -	;
  -
  -// A set of access modifiers that may be applied to rule declarations
  -// and which may or may not mean something to the target language.
  -// Note that the parser allows any number of these in any order and the
  -// semantic pass will throw out invalid combinations.
  -//
  +	:	AT id ACTION
  +	;
  +
   ruleModifiers
   	:	ruleModifier+
   	;
  
positive.code: 	:	LPAREN lexerAltList RPAREN
  	;
  
  // channel=HIDDEN, skip, more, mode(INSIDE), push(INSIDE), pop
  lexerCommands
  	:	RARROW lexerCommand (',' lexerCommand)*
  	;
  
  lexerCommand
  
negative.code: 
  lexerRule
  	:	DOC_COMMENT? FRAGMENT?
  		TOKEN_REF COLON lexerRuleBlock SEMI
  	;
  
  lexerRuleBlock
  