BasicSemanticChecks.checkGrammarName: allow null filenames.
checkGrammarName assumes that all grammars come from actual files, but grammars loaded using Tool.parseGrammarFromString use input streams without source file names. This patch changes checkGrammarName to only verify that grammar names and file names correspond when a file name is available.
This commit is contained in:
parent
c0dda79dff
commit
a74005972d
|
@ -290,6 +290,11 @@ public class BasicSemanticChecks extends GrammarTreeVisitor {
|
|||
|
||||
void checkGrammarName(Token nameToken) {
|
||||
String fullyQualifiedName = nameToken.getInputStream().getSourceName();
|
||||
if (fullyQualifiedName == null) {
|
||||
// This wasn't read from a file.
|
||||
return;
|
||||
}
|
||||
|
||||
File f = new File(fullyQualifiedName);
|
||||
String fileName = f.getName();
|
||||
if ( g.originalGrammar!=null ) return; // don't warn about diff if this is implicit lexer
|
||||
|
|
Loading…
Reference in New Issue