Esempio n. 1
0
  public Macro getMacro(TIdentifier identifier) {

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

    String name = identifier.getText();

    if (this.macroMap.containsKey(name)) {
      return this.macroMap.get(name);
    }

    if (this.parent != null) {
      return this.parent.getMacro(identifier);
    }

    return getGlobalIndex().getTopMacro(identifier);
  }
Esempio n. 2
0
  void addContext(AParserContext node) {

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

    TIdentifier nameToken = node.getName();
    String name = nameToken == null ? null : nameToken.getText();
    Context context = this.nameToContextMap.get(name);

    if (context == null) {
      context = new Context(this.globalIndex, name);
      this.nameToContextMap.put(name, context);
      this.contexts.add(context);
    }

    this.nodeToContextMap.put(node, context);
    context.setDeclaration(node);
  }