Merge branch 'dev'
This commit is contained in:
commit
5cec4721ab
|
@ -119,12 +119,7 @@ package org.antlr.v4.parse;
|
||||||
|
|
||||||
|
|
||||||
@members {
|
@members {
|
||||||
public Token prevToken;
|
public boolean isLexer = false;
|
||||||
@Override
|
|
||||||
public void emit(Token token) {
|
|
||||||
super.emit(token);
|
|
||||||
if ( token.getChannel()==Token.DEFAULT_CHANNEL ) prevToken = token;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
|
@ -227,8 +222,8 @@ COMMENT
|
||||||
|
|
||||||
ARG_OR_CHARSET
|
ARG_OR_CHARSET
|
||||||
options {k=1;}
|
options {k=1;}
|
||||||
: {prevToken.getType()!=RULE_REF}?=> LEXER_CHAR_SET {$type=LEXER_CHAR_SET;}
|
: {isLexer}?=> LEXER_CHAR_SET {$type=LEXER_CHAR_SET;}
|
||||||
| {prevToken.getType()==RULE_REF}?=> ARG_ACTION {$type=ARG_ACTION;}
|
| {!isLexer}?=> ARG_ACTION {$type=ARG_ACTION;}
|
||||||
;
|
;
|
||||||
|
|
||||||
fragment
|
fragment
|
||||||
|
@ -412,7 +407,7 @@ TOKENS_SPEC : 'tokens' WSNLCHARS* '{' ;
|
||||||
|
|
||||||
IMPORT : 'import' ;
|
IMPORT : 'import' ;
|
||||||
FRAGMENT : 'fragment' ;
|
FRAGMENT : 'fragment' ;
|
||||||
LEXER : 'lexer' ;
|
LEXER : 'lexer' {isLexer=true;} ;
|
||||||
PARSER : 'parser' ;
|
PARSER : 'parser' ;
|
||||||
GRAMMAR : 'grammar' ;
|
GRAMMAR : 'grammar' ;
|
||||||
PROTECTED : 'protected' ;
|
PROTECTED : 'protected' ;
|
||||||
|
|
Loading…
Reference in New Issue