same literal different modes gens no literal in .tokens, rm warning
This commit is contained in:
parent
6d12cbfddb
commit
4090621beb
|
@ -1,19 +1,4 @@
|
|||
grammar T;
|
||||
lexer grammar T;
|
||||
|
||||
s: expr_or_assign* ;
|
||||
|
||||
expr_or_assign
|
||||
: expr '++'
|
||||
| expr
|
||||
;
|
||||
|
||||
expr : expr_primary ('<-' ID)? ;
|
||||
|
||||
expr_primary
|
||||
: '(' ID ')'
|
||||
| ID '(' ID ')'
|
||||
| ID
|
||||
;
|
||||
|
||||
ID : [a-z]+ ;
|
||||
WS : [ \t\r\n]+ -> skip ;
|
||||
A : 'a' ;
|
||||
B : 'a' ;
|
||||
|
|
|
@ -171,9 +171,10 @@ public class SemanticPipeline {
|
|||
G.defineTokenAlias(nameAST.getText(), litAST.getText());
|
||||
}
|
||||
else {
|
||||
g.tool.errMgr.grammarError(ErrorType.ALIAS_REASSIGNMENT,
|
||||
g.fileName, nameAST.token,
|
||||
litAST.getText(), nameAST.getText());
|
||||
// oops two literal defs in two rules (within or across
|
||||
// modes). Remove literal in either case so it's not
|
||||
// found by parser.
|
||||
G.stringLiteralToTypeMap.remove(litAST.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ public enum ErrorType {
|
|||
ALT_LABEL_CONFLICTS_WITH_RULE(124, "rule alt label <arg> conflicts with rule <arg2>", ErrorSeverity.ERROR),
|
||||
IMPLICIT_TOKEN_DEFINITION(125, "implicit definition of token <arg> in parser", ErrorSeverity.WARNING),
|
||||
IMPLICIT_STRING_DEFINITION(126, "cannot create implicit token for string literal <arg> in non-combined grammar", ErrorSeverity.ERROR),
|
||||
ALIAS_REASSIGNMENT(127, "token literal <arg> aliased to new token name <arg2>", ErrorSeverity.WARNING),
|
||||
// ALIAS_REASSIGNMENT(127, "token literal <arg> aliased to new token name <arg2>", ErrorSeverity.WARNING),
|
||||
|
||||
/** Documentation comment is unterminated */
|
||||
//UNTERMINATED_DOC_COMMENT(, "", ErrorSeverity.ERROR),
|
||||
|
|
Loading…
Reference in New Issue