本文整理了Java中org.antlr.v4.tool.Grammar.getAllImportedGrammars()
方法的一些代码示例,展示了Grammar.getAllImportedGrammars()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Grammar.getAllImportedGrammars()
方法的具体详情如下:
包路径:org.antlr.v4.tool.Grammar
类名称:Grammar
方法名:getAllImportedGrammars
[英]Get list of all imports from all grammars in the delegate subtree of g. The grammars are in import tree preorder. Don't include ourselves in list as we're not a delegate of ourselves.
[中]从g的委托子树中的所有语法中获取所有导入的列表。这些语法位于导入树的前序中。不要把我们自己列入名单,因为我们不是自己的代表。
代码示例来源:origin: org.antlr/antlr4
/** Get list of all imports from all grammars in the delegate subtree of g.
* The grammars are in import tree preorder. Don't include ourselves
* in list as we're not a delegate of ourselves.
*/
public List<Grammar> getAllImportedGrammars() {
if (importedGrammars == null) {
return null;
}
LinkedHashMap<String, Grammar> delegates = new LinkedHashMap<String, Grammar>();
for (Grammar d : importedGrammars) {
delegates.put(d.fileName, d);
List<Grammar> ds = d.getAllImportedGrammars();
if (ds != null) {
for (Grammar imported : ds) {
delegates.put(imported.fileName, imported);
}
}
}
return new ArrayList<Grammar>(delegates.values());
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/** Get list of all imports from all grammars in the delegate subtree of g.
* The grammars are in import tree preorder. Don't include ourselves
* in list as we're not a delegate of ourselves.
*/
public List<Grammar> getAllImportedGrammars() {
if (importedGrammars == null) {
return null;
}
LinkedHashMap<String, Grammar> delegates = new LinkedHashMap<String, Grammar>();
for (Grammar d : importedGrammars) {
delegates.put(d.fileName, d);
List<Grammar> ds = d.getAllImportedGrammars();
if (ds != null) {
for (Grammar imported : ds) {
delegates.put(imported.fileName, imported);
}
}
}
return new ArrayList<Grammar>(delegates.values());
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/** Get list of all imports from all grammars in the delegate subtree of g.
* The grammars are in import tree preorder. Don't include ourselves
* in list as we're not a delegate of ourselves.
*/
public List<Grammar> getAllImportedGrammars() {
if (importedGrammars == null) {
return null;
}
LinkedHashMap<String, Grammar> delegates = new LinkedHashMap<String, Grammar>();
for (Grammar d : importedGrammars) {
delegates.put(d.fileName, d);
List<Grammar> ds = d.getAllImportedGrammars();
if (ds != null) {
for (Grammar imported : ds) {
delegates.put(imported.fileName, imported);
}
}
}
return new ArrayList<Grammar>(delegates.values());
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4
/** Get list of all imports from all grammars in the delegate subtree of g.
* The grammars are in import tree preorder. Don't include ourselves
* in list as we're not a delegate of ourselves.
*/
public List<Grammar> getAllImportedGrammars() {
if (importedGrammars == null) {
return null;
}
LinkedHashMap<String, Grammar> delegates = new LinkedHashMap<String, Grammar>();
for (Grammar d : importedGrammars) {
delegates.put(d.fileName, d);
List<Grammar> ds = d.getAllImportedGrammars();
if (ds != null) {
for (Grammar imported : ds) {
delegates.put(imported.fileName, imported);
}
}
}
return new ArrayList<Grammar>(delegates.values());
}
代码示例来源:origin: uk.co.nichesolutions/antlr4
/** Get list of all imports from all grammars in the delegate subtree of g.
* The grammars are in import tree preorder. Don't include ourselves
* in list as we're not a delegate of ourselves.
*/
public List<Grammar> getAllImportedGrammars() {
if (importedGrammars == null) {
return null;
}
LinkedHashMap<String, Grammar> delegates = new LinkedHashMap<String, Grammar>();
for (Grammar d : importedGrammars) {
delegates.put(d.fileName, d);
List<Grammar> ds = d.getAllImportedGrammars();
if (ds != null) {
for (Grammar imported : ds) {
delegates.put(imported.fileName, imported);
}
}
}
return new ArrayList<Grammar>(delegates.values());
}
代码示例来源:origin: org.antlr/antlr4
/**
* Return a list of File objects that name files ANTLR will read
* to process T.g; This can be .tokens files if the grammar uses the tokenVocab option
* as well as any imported grammar files.
*/
public List<File> getDependenciesFileList() {
// Find all the things other than imported grammars
List<File> files = getNonImportDependenciesFileList();
// Handle imported grammars
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
String libdir = tool.libDirectory;
String fileName = groomQualifiedFileName(libdir, g.fileName);
files.add(new File(fileName));
}
}
if (files.isEmpty()) {
return null;
}
return files;
}
代码示例来源:origin: uk.co.nichesolutions/antlr4
/**
* Return a list of File objects that name files ANTLR will read
* to process T.g; This can be .tokens files if the grammar uses the tokenVocab option
* as well as any imported grammar files.
*/
public List<File> getDependenciesFileList() {
// Find all the things other than imported grammars
List<File> files = getNonImportDependenciesFileList();
// Handle imported grammars
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
String libdir = tool.libDirectory;
String fileName = groomQualifiedFileName(libdir, g.fileName);
files.add(new File(fileName));
}
}
if (files.isEmpty()) {
return null;
}
return files;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Return a list of File objects that name files ANTLR will read
* to process T.g; This can be .tokens files if the grammar uses the tokenVocab option
* as well as any imported grammar files.
*/
public List<File> getDependenciesFileList() {
// Find all the things other than imported grammars
List<File> files = getNonImportDependenciesFileList();
// Handle imported grammars
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
String libdir = tool.libDirectory;
String fileName = groomQualifiedFileName(libdir, g.fileName);
files.add(new File(fileName));
}
}
if (files.isEmpty()) {
return null;
}
return files;
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4
/**
* Return a list of File objects that name files ANTLR will read
* to process T.g; This can be .tokens files if the grammar uses the tokenVocab option
* as well as any imported grammar files.
*/
public List<File> getDependenciesFileList() {
// Find all the things other than imported grammars
List<File> files = getNonImportDependenciesFileList();
// Handle imported grammars
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
String libdir = tool.libDirectory;
String fileName = groomQualifiedFileName(libdir, g.fileName);
files.add(new File(fileName));
}
}
if (files.isEmpty()) {
return null;
}
return files;
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Return a list of File objects that name files ANTLR will read
* to process T.g; This can be .tokens files if the grammar uses the tokenVocab option
* as well as any imported grammar files.
*/
public List<File> getDependenciesFileList() {
// Find all the things other than imported grammars
List<File> files = getNonImportDependenciesFileList();
// Handle imported grammars
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
String libdir = tool.libDirectory;
String fileName = groomQualifiedFileName(libdir, g.fileName);
files.add(new File(fileName));
}
}
if (files.isEmpty()) {
return null;
}
return files;
}
代码示例来源:origin: org.antlr/antlr4
public void generateATNs(Grammar g) {
DOTGenerator dotGenerator = new DOTGenerator(g);
List<Grammar> grammars = new ArrayList<Grammar>();
grammars.add(g);
List<Grammar> imported = g.getAllImportedGrammars();
if ( imported!=null ) grammars.addAll(imported);
for (Grammar ig : grammars) {
for (Rule r : ig.rules.values()) {
try {
String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index], g.isLexer());
if (dot != null) {
writeDOTFile(g, r, dot);
}
}
catch (IOException ioe) {
errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe);
}
}
}
}
代码示例来源:origin: uk.co.nichesolutions/antlr4
public void generateATNs(Grammar g) {
DOTGenerator dotGenerator = new DOTGenerator(g);
List<Grammar> grammars = new ArrayList<Grammar>();
grammars.add(g);
List<Grammar> imported = g.getAllImportedGrammars();
if ( imported!=null ) grammars.addAll(imported);
for (Grammar ig : grammars) {
for (Rule r : ig.rules.values()) {
try {
String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index], g.isLexer());
if (dot != null) {
writeDOTFile(g, r, dot);
}
}
catch (IOException ioe) {
errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe);
}
}
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
public void generateATNs(Grammar g) {
DOTGenerator dotGenerator = new DOTGenerator(g);
List<Grammar> grammars = new ArrayList<Grammar>();
grammars.add(g);
List<Grammar> imported = g.getAllImportedGrammars();
if ( imported!=null ) grammars.addAll(imported);
for (Grammar ig : grammars) {
for (Rule r : ig.rules.values()) {
try {
String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index], g.isLexer());
if (dot != null) {
writeDOTFile(g, r, dot);
}
}
catch (IOException ioe) {
errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe);
}
}
}
}
代码示例来源:origin: com.tunnelvisionlabs/antlr4
public void generateATNs(Grammar g) {
DOTGenerator dotGenerator = new DOTGenerator(g);
List<Grammar> grammars = new ArrayList<Grammar>();
grammars.add(g);
List<Grammar> imported = g.getAllImportedGrammars();
if ( imported!=null ) grammars.addAll(imported);
for (Grammar ig : grammars) {
for (Rule r : ig.rules.values()) {
try {
String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index], g.isLexer());
if (dot != null) {
writeDOTFile(g, r, dot);
}
}
catch (IOException ioe) {
errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe);
}
}
}
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
public void generateATNs(Grammar g) {
DOTGenerator dotGenerator = new DOTGenerator(g);
List<Grammar> grammars = new ArrayList<Grammar>();
grammars.add(g);
List<Grammar> imported = g.getAllImportedGrammars();
if ( imported!=null ) grammars.addAll(imported);
for (Grammar ig : grammars) {
for (Rule r : ig.rules.values()) {
try {
String dot = dotGenerator.getDOT(g.atn.ruleToStartState[r.index], g.isLexer());
if (dot != null) {
writeDOTFile(g, r, dot);
}
}
catch (IOException ioe) {
errMgr.toolError(ErrorType.CANNOT_WRITE_FILE, ioe);
}
}
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
代码示例来源:origin: uk.co.nichesolutions/antlr4
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
代码示例来源:origin: com.tunnelvisionlabs/antlr4
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
代码示例来源:origin: org.antlr/antlr4
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
代码示例来源:origin: io.virtdata/virtdata-lib-realer
List<Grammar> imports = g.getAllImportedGrammars();
if ( imports!=null ) {
for (Grammar g : imports) {
内容来源于网络,如有侵权,请联系作者删除!