Example #1
0
  /** Build an processor. */
  public BBProcessor build() {
    this.createdScopes = new HashMap<Scope, ProcScope>();
    this.codes = new HashMap<Code, ProcCode>();
    this.constants = new HashMap<Constant, PatternConstant>();

    BBProcessor processor = new BBProcessor();
    processor.setScope(createScope(conf.getRootScope()));
    processor.setPrefix(createTemplate(conf.getPrefix()));
    processor.setSuffix(createTemplate(conf.getSuffix()));
    processor.setParams(conf.getParams());
    processor.setConstants(new HashSet<PatternConstant>(constants.values()));
    processor.setNestingLimit(conf.getNestingLimit());
    processor.setPropagateNestingException(conf.isPropagateNestingException());

    // Init scopes
    for (ProcScope scope : createdScopes.values()) {
      scope.init();
    }

    return processor;
  }