Пример #1
0
    private void internalAdd(INameDeclaration nameDeclaration) {

      if (nameDeclaration == null) {
        throw new InternalException("nameDeclaration may not be null");
      }

      String name = nameDeclaration.getName();
      if (this.nameMap.containsKey(name)) {
        throw SemanticException.duplicateDeclaration(nameDeclaration, this.nameMap.get(name));
      }
      this.nameMap.put(name, nameDeclaration);
    }
Пример #2
0
    private void add(Tree.TreeProduction treeProduction) {

      if (treeProduction == null) {
        throw new InternalException("treeProduction may not be null");
      }

      String name = treeProduction.getName();
      INameDeclaration nameDeclaration = this.globalNameSpace.getNameDeclaration(name);
      if (nameDeclaration == null
          || nameDeclaration instanceof Parser.ParserProduction
          || nameDeclaration instanceof Selector.ParserSelector.Selection) {
        this.nameMap.put(name, treeProduction);
      } else {
        throw SemanticException.duplicateDeclaration(treeProduction, nameDeclaration);
      }
    }