コード例 #1
0
ファイル: Grammar.java プロジェクト: kferrio/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;
   List<Grammar> delegates = new ArrayList<Grammar>();
   for (Grammar d : importedGrammars) {
     delegates.add(d);
     List<Grammar> ds = d.getAllImportedGrammars();
     if (ds != null) delegates.addAll(ds);
   }
   return delegates;
 }
コード例 #2
0
ファイル: Grammar.java プロジェクト: ramons03/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;
   List<Grammar> delegates = new ArrayList<Grammar>();
   for (int i = 0; i < importedGrammars.size(); i++) {
     Grammar d = importedGrammars.get(i);
     delegates.add(d);
     List<Grammar> ds = d.getAllImportedGrammars();
     if (ds != null) delegates.addAll(ds);
   }
   return delegates;
 }
コード例 #3
0
ファイル: Grammar.java プロジェクト: HackShare/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());
  }