protected void keywordParam() throws ParseException {
    if (!fInput.hasNext()) return;

    if (fInput.next().getTyp() == TSExpression.SYMBOL) {
      Symbol symbol = (Symbol) fInput.current();
      if (symbol.getSymbolName().equalsIgnoreCase(TOKEN_KEY)) {

        while (true) {
          if (!fInput.hasNext()) {
            break;
          }

          SExpression next = fInput.next();
          if (isSpecialSymbol(next)) {
            fInput.pushBack();
            break;
          }

          addKey(varInit(next));
        }

        allowOtherKeys();
      } else {
        fInput.pushBack();
      }
    } else {
      error("Unknown symbol in key list: &key expected", fInput.getInputSExpression());
    }
  }
  protected void optionalParam() throws ParseException {
    if (!fInput.hasNext()) return; // leere Lambda Liste

    if (fInput.next().getTyp() == TSExpression.SYMBOL) {
      Symbol symbol = (Symbol) fInput.current();
      if (symbol.getSymbolName().equalsIgnoreCase(TOKEN_OPTIONAL)) {

        // if(!fInput.hasNext()) { //&optional gesehen, aber kein weiteres symbol angegeben
        //	error("At least one &optional parameter must be specified",
        // fInput.getInputSExpression());
        // }
        // addOptional(varInit(fInput.next())); //mindesten ein Symbol ist angegeben

        while (true) {
          if (!fInput.hasNext()) {
            break;
          }

          SExpression next = fInput.next();
          if (isSpecialSymbol(next)) {
            fInput.pushBack();
            break;
          }

          addOptional(varInit(next));
        }

      } else {
        fInput.pushBack();
        return;
      }
    } else {
      error("Unknown symbol in optional parameter list: &optional expected", fInput.current());
    }
  }
 // where
 private String className(Symbol sym, boolean longform) {
   if (sym.name.len == 0 && (sym.flags() & COMPOUND) != 0) {
     StringBuffer s = new StringBuffer(supertype_field.toString());
     for (List<Type> is = interfaces_field; is.nonEmpty(); is = is.tail) {
       s.append("&");
       s.append(is.head.toString());
     }
     return s.toString();
   } else if (sym.name.len == 0) {
     String s;
     ClassType norm = (ClassType) tsym.type;
     if (norm == null) {
       s = Log.getLocalizedString("anonymous.class", (Object) null);
     } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
       s = Log.getLocalizedString("anonymous.class", norm.interfaces_field.head);
     } else {
       s = Log.getLocalizedString("anonymous.class", norm.supertype_field);
     }
     if (moreInfo) s += String.valueOf(sym.hashCode());
     return s;
   } else if (longform) {
     return sym.getQualifiedName().toString();
   } else {
     return sym.name.toString();
   }
 }
示例#4
0
 /**
  * Returns the type of an element when that element is viewed as a member of, or otherwise
  * directly contained by, a given type. For example, when viewed as a member of the parameterized
  * type {@code Set<String>}, the {@code Set.add} method is an {@code ExecutableType} whose
  * parameter is of type {@code String}.
  *
  * @param containing the containing type
  * @param element the element
  * @return the type of the element as viewed from the containing type
  * @throws IllegalArgumentException if the element is not a valid one for the given type
  */
 public TypeMirror asMemberOf(DeclaredType containing, Element element) {
   Type site = (Type) containing;
   Symbol sym = (Symbol) element;
   if (types.asSuper(site, sym.getEnclosingElement()) == null)
     throw new IllegalArgumentException(sym + "@" + site);
   return types.memberType(site, sym);
 }
示例#5
0
    public boolean postMortem(PostMortem pm) {
      boolean result = true;
      Symbol that = (Symbol) pm;

      if (this.integer != that.integer || this.weight != that.weight) {
        return false;
      }
      if ((this.back != null) != (that.back != null)) {
        return false;
      }
      Symbol zero = this.zero;
      Symbol one = this.one;
      if (zero == null) {
        if (that.zero != null) {
          return false;
        }
      } else {
        result = zero.postMortem(that.zero);
      }
      if (one == null) {
        if (that.one != null) {
          return false;
        }
      } else {
        result = one.postMortem(that.one);
      }
      return result;
    }
示例#6
0
 public static String GetValueElement(String elem, Vector memory) {
   Symbol var;
   // ------------------------- sinal -  -------------
   if (elem.charAt(0) == '-') {
     // --operador -
     if (elem.length() == 1) return elem;
     // ---resto
     String resto = elem.substring(1);
     var = Variable.getVariable(resto, memory);
     // valor negativo
     if (var == null) return elem + " ";
     // se for uma variavel vai selecionar o valor
     else if (var instanceof SymbolArray) {
       SymbolArray a = (SymbolArray) var;
       a.SetIndex(elem, memory);
       return " ( " + a.getValue() + " * -1 ) ";
     } else return " ( " + var.getValue() + " * -1 ) ";
   }
   // -------------------------------------------------------------
   //  variavel sem valor negativo
   // ------------------------------------------------------------
   var = Variable.getVariable(elem, memory);
   if (var == null) return elem + " ";
   else if (var instanceof SymbolArray) {
     SymbolArray a = (SymbolArray) var;
     a.SetIndex(elem, memory);
     return a.getValue() + " ";
   } else return var.getValue() + " ";
 }
 private void setRecentButtons(Symbol symbols[], float sx, float sy) {
   for (int k = 0; k < TDSetting.mRecentNr; ++k) {
     Symbol p = symbols[k];
     if (p == null) break;
     mRecent[k].reset(p.getPaint(), p.getPath(), sx, sy);
   }
 }
示例#8
0
      @Override
      public Query apply(Function input, Context context) throws IOException {
        List<Symbol> arguments = input.arguments();
        assert arguments.size() == 4 : "invalid number of arguments";
        assert Symbol.isLiteral(arguments.get(0), DataTypes.OBJECT);
        assert Symbol.isLiteral(arguments.get(1), DataTypes.STRING);
        assert Symbol.isLiteral(arguments.get(2), DataTypes.STRING);
        assert Symbol.isLiteral(arguments.get(3), DataTypes.OBJECT);

        @SuppressWarnings("unchecked")
        Map<String, Object> fields = (Map) ((Literal) arguments.get(0)).value();
        BytesRef queryString = (BytesRef) ((Literal) arguments.get(1)).value();
        BytesRef matchType = (BytesRef) ((Literal) arguments.get(2)).value();
        Map options = (Map) ((Literal) arguments.get(3)).value();

        checkArgument(queryString != null, "cannot use NULL as query term in match predicate");

        MatchQueryBuilder queryBuilder;
        if (fields.size() == 1) {
          queryBuilder =
              new MatchQueryBuilder(context.mapperService, context.indexCache, matchType, options);
        } else {
          queryBuilder =
              new MultiMatchQueryBuilder(
                  context.mapperService, context.indexCache, matchType, options);
        }
        return queryBuilder.query(fields, queryString);
      }
    @SuppressWarnings("ConstantConditions")
    public void onPreviewFrame(byte[] data, Camera incomingCamera) {
      try {
        if (System.currentTimeMillis() > lastSnapshotTime) {
          lastSnapshotTime = System.currentTimeMillis() + SNAPSHOT_DELAY;

          Camera.Parameters cameraParameters = incomingCamera.getParameters();
          Camera.Size previewSize = cameraParameters.getPreviewSize();
          Image barcode = new Image(previewSize.width, previewSize.height, GREY_COLOR_SPACE);
          barcode.setData(data);

          if (scanner.scanImage(barcode) != 0) {
            SymbolSet scannerResults = scanner.getResults();

            if (vibrator != null) vibrator.vibrate(VIBRATE_TIME);

            for (Symbol symbol : scannerResults)
              if (scannerListener == null)
                Toast.makeText(getActivity(), symbol.getData(), Toast.LENGTH_LONG).show();
              else scannerListener.onDataReceive(symbol.getData(), symbol.getType());
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
示例#10
0
 public boolean isNullable() {
   boolean result = true;
   for (Symbol symbol : rhs) {
     result &= symbol.isNullable();
   }
   return result;
 }
  public void put(String name, Object value) {
    log.info("Attempting to put " + name + " = " + value);

    // -- Put into local scope if it exists
    if (memorySpace != null) {
      Symbol symbol = new Symbol(name, value);
      log.info(
          "Pushing "
              + symbol
              + " into scope declared on line "
              + this.getLine()
              + " ("
              + this.toString()
              + " )");

      if (name == null) throw new NullPointerException();
      if (value == null) throw new NullPointerException();

      memorySpace.put(symbol.getName(), symbol);
    }

    // -- Recurse back up stack
    else if (getParent() != null) {
      log.info(this + " does not have a memory space, trying parent.");
      getParent().put(name, value);
    }

    // -- Global scope
    else {
      Symbol symbol = new Symbol(name, value);

      log.info("... storing into global scope.");
      globalMemorySpace.put(symbol.getName(), symbol);
    }
  }
  public static void reconstructHeaders(Iterable<NativeLibrary> libraries, PrintWriter out) {
    List<MemberRef> orphanMembers = new ArrayList<MemberRef>();
    Map<TypeRef, List<MemberRef>> membersByClass = new HashMap<TypeRef, List<MemberRef>>();
    for (NativeLibrary library : libraries) {
      for (Symbol symbol : library.getSymbols()) {
        MemberRef mr = symbol.getParsedRef();
        if (mr == null) continue;

        TypeRef et = mr.getEnclosingType();
        if (et == null) orphanMembers.add(mr);
        else {
          List<MemberRef> mrs = membersByClass.get(et);
          if (mrs == null) membersByClass.put(et, mrs = new ArrayList<MemberRef>());
          mrs.add(mr);
        }
      }
    }
    for (TypeRef tr : membersByClass.keySet()) out.println("class " + tr + ";");

    for (MemberRef mr : orphanMembers) out.println(mr + ";");

    for (Map.Entry<TypeRef, List<MemberRef>> e : membersByClass.entrySet()) {
      TypeRef tr = e.getKey();
      List<MemberRef> mrs = e.getValue();
      out.println("class " + tr + " \n{");
      for (MemberRef mr : mrs) {
        out.println("\t" + mr + ";");
      }
      out.println("}");
    }
  }
示例#13
0
  public PlanBuilder appendProjections(
      Iterable<Expression> expressions,
      SymbolAllocator symbolAllocator,
      PlanNodeIdAllocator idAllocator) {
    TranslationMap translations = copyTranslations();

    ImmutableMap.Builder<Symbol, Expression> projections = ImmutableMap.builder();

    // add an identity projection for underlying plan
    for (Symbol symbol : getRoot().getOutputSymbols()) {
      projections.put(symbol, symbol.toSymbolReference());
    }

    ImmutableMap.Builder<Symbol, Expression> newTranslations = ImmutableMap.builder();
    ParameterRewriter parameterRewriter = new ParameterRewriter(parameters, getAnalysis());
    for (Expression expression : expressions) {
      Expression rewritten = ExpressionTreeRewriter.rewriteWith(parameterRewriter, expression);
      translations.addIntermediateMapping(expression, rewritten);
      Symbol symbol =
          symbolAllocator.newSymbol(rewritten, getAnalysis().getTypeWithCoercions(expression));
      projections.put(symbol, translations.rewrite(rewritten));
      newTranslations.put(symbol, rewritten);
    }
    // Now append the new translations into the TranslationMap
    for (Map.Entry<Symbol, Expression> entry : newTranslations.build().entrySet()) {
      translations.put(entry.getValue(), entry.getKey());
    }

    return new PlanBuilder(
        translations,
        new ProjectNode(idAllocator.getNextId(), getRoot(), projections.build()),
        parameters);
  }
  private ArrayList<Symbol> getSymbolTable(byte[] encodedFileAsBytes) {
    // Finding the Divider in the file & separate the SymbolTable
    System.out.println("\nFileContent: ");
    System.out.println(Arrays.toString(encodedFileAsBytes));
    int i = getDividerIndexInArray(encodedFileAsBytes);

    // Reading the String of symbol table from the byteArray
    String symbolTableString = "";
    for (int j = 0; j < i; j++) {
      symbolTableString += String.valueOf((char) encodedFileAsBytes[j]);
    }
    // Generating the ArrayList<Symbol>
    String[] splitSymbolsAndCodes = symbolTableString.split(",");
    ArrayList<Symbol> symbols = new ArrayList<Symbol>();
    for (int j = 0; j < splitSymbolsAndCodes.length; j++) {
      String[] symbolCodePair = splitSymbolsAndCodes[j].split(":");
      Symbol symbol = new Symbol(0, symbolCodePair[0]);
      symbol.setCode(symbolCodePair[1]);
      symbols.add(symbol);
    }
    // Logging the Symbol List
    System.out.println("\nSymbol Table Retrived from the File");
    System.out.println(Symbol.symbolListToString(symbols));
    return symbols;
  }
示例#15
0
  /**
   * @param line - linha com a definicao
   * @param level - nivel do symbolo
   */
  public SymbolArray(String line, Memory mem, int level) throws LanguageException {
    super(Symbol.ARRAY, true);
    this.level = level;
    IteratorArray it = new IteratorArray(line);
    String mod = Symbol.getDefAlter(line);
    String type = Symbol.getDefType(line);
    String nameVar = Symbol.getDefName(it.getNext());

    // nome da variavel
    name = nameVar + getOriginalDims(line);

    int dimension = Integer.valueOf(it.getNext()); // numero de dimensoes

    data = new Vector<SymbolData>(dimension);

    nameVar = nameVar + it.getUnprocessed();

    nameVar = mod + " " + type + " " + nameVar;
    for (int i = 0; i < dimension; i++) {
      SymbolData var =
          Memory.makeNewSymbol(nameVar + Symbol.iniArray + i + Symbol.finArray, mem, level);
      var.normalizeName();
      data.add(var);
    }

    //        objectValue = data;

    // constructor
  }
示例#16
0
 @Nullable
 private Function rewriteAndValidateFields(Function function, Context context) {
   if (function.arguments().size() == 2) {
     Symbol left = function.arguments().get(0);
     Symbol right = function.arguments().get(1);
     if (left.symbolType() == SymbolType.REFERENCE && right.symbolType().isValueSymbol()) {
       Reference ref = (Reference) left;
       if (ref.info().ident().columnIdent().equals(DocSysColumns.ID)) {
         function.setArgument(
             0,
             new Reference(DocSysColumns.forTable(ref.ident().tableIdent(), DocSysColumns.UID)));
         function.setArgument(
             1,
             Literal.newLiteral(
                 Uid.createUid(
                     Constants.DEFAULT_MAPPING_TYPE, ValueSymbolVisitor.STRING.process(right))));
       } else {
         String unsupportedMessage =
             context.unsupportedMessage(ref.info().ident().columnIdent().name());
         if (unsupportedMessage != null) {
           throw new UnsupportedFeatureException(unsupportedMessage);
         }
       }
     }
   }
   return function;
 }
示例#17
0
文件: RTC.java 项目: carloca68/jtapi
 /**
  * Two RTCs are equal if both the trigger and action Symbols (respectively) are equal.
  *
  * @param other the Object to be compared to this RTC Object
  * @return true iff both RTCs have the same trigger and action Symbols.
  */
 public boolean equals(Object other) {
   return ((other instanceof RTC)
       && ((trigger == ((RTC) other).trigger)
           || ((trigger != null) && trigger.equals(((RTC) other).trigger)))
       && ((action == ((RTC) other).action)
           || ((action != null) && action.equals(((RTC) other).action))));
 }
示例#18
0
 /**
  * Converts a class name into a (possibly localized) string. Anonymous inner classes gets
  * converted into a localized string.
  *
  * @param t the type of the class whose name is to be rendered
  * @param longform if set, the class' fullname is displayed - if unset the short name is chosen
  *     (w/o package)
  * @param locale the locale in which the string is to be rendered
  * @return localized string representation
  */
 protected String className(ClassType t, boolean longform, Locale locale) {
   Symbol sym = t.tsym;
   if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
     StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
     for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
       s.append("&");
       s.append(visit(is.head, locale));
     }
     return s.toString();
   } else if (sym.name.length() == 0) {
     String s;
     ClassType norm = (ClassType) t.tsym.type;
     if (norm == null) {
       s = localize(locale, "compiler.misc.anonymous.class", (Object) null);
     } else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
       s =
           localize(
               locale, "compiler.misc.anonymous.class", visit(norm.interfaces_field.head, locale));
     } else {
       s = localize(locale, "compiler.misc.anonymous.class", visit(norm.supertype_field, locale));
     }
     return s;
   } else if (longform) {
     return sym.getQualifiedName().toString();
   } else {
     return sym.name.toString();
   }
 }
示例#19
0
  private PlanBuilder appendProjections(PlanBuilder subPlan, Iterable<Expression> expressions) {
    TranslationMap translations = new TranslationMap(subPlan.getRelationPlan(), analysis);

    // Carry over the translations from the source because we are appending projections
    translations.copyMappingsFrom(subPlan.getTranslations());

    ImmutableMap.Builder<Symbol, Expression> projections = ImmutableMap.builder();

    // add an identity projection for underlying plan
    for (Symbol symbol : subPlan.getRoot().getOutputSymbols()) {
      Expression expression = new QualifiedNameReference(symbol.toQualifiedName());
      projections.put(symbol, expression);
    }

    ImmutableMap.Builder<Symbol, Expression> newTranslations = ImmutableMap.builder();
    for (Expression expression : expressions) {
      Symbol symbol = symbolAllocator.newSymbol(expression, analysis.getType(expression));

      // TODO: CHECK IF THE REWRITE OF A SEMI JOINED EXPRESSION WILL WORK!!!!!!!

      projections.put(symbol, translations.rewrite(expression));
      newTranslations.put(symbol, expression);
    }
    // Now append the new translations into the TranslationMap
    for (Map.Entry<Symbol, Expression> entry : newTranslations.build().entrySet()) {
      translations.put(entry.getValue(), entry.getKey());
    }

    return new PlanBuilder(
        translations,
        new ProjectNode(idAllocator.getNextId(), subPlan.getRoot(), projections.build()),
        subPlan.getSampleWeight());
  }
 private int skipOptionalSize(Symbol sig, int index) {
   byte c = sig.getByteAt(index);
   while (c >= '0' && c <= '9') {
     ++index;
     c = sig.getByteAt(index);
   }
   return index;
 }
示例#21
0
 private List<ISymbol> convertToObjectSymbols(BlockExpression blk) {
   List<ISymbol> syms = new ArrayList<ISymbol>();
   for (ISymbol iSymbol : blk.getArgs()) {
     Symbol symbol = new Symbol((Symbol) iSymbol);
     symbol.setType(JavaTypes.OBJECT());
     syms.add(symbol);
   }
   return syms;
 }
示例#22
0
  @Override
  public void visitTopLevel(JCCompilationUnit tree) {
    JavaFileObject prev = log.useSource(tree.sourcefile);
    boolean addEnv = false;
    boolean isPkgInfo =
        tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
    if (tree.pid != null) {
      tree.packge = reader.enterPackage(TreeInfo.fullName(tree.pid));
      if (tree.packageAnnotations.nonEmpty() || pkginfoOpt == PkgInfo.ALWAYS) {
        if (isPkgInfo) {
          addEnv = true;
        } else {
          log.error(tree.packageAnnotations.head.pos(), "pkg.annotations.sb.in.package-info.java");
        }
      }
    } else {
      tree.packge = syms.unnamedPackage;
    }
    tree.packge.complete(); // Find all classes in package.
    Env<AttrContext> topEnv = topLevelEnv(tree);

    // Save environment of package-info.java file.
    if (isPkgInfo) {
      Env<AttrContext> env0 = typeEnvs.get(tree.packge);
      if (env0 == null) {
        typeEnvs.put(tree.packge, topEnv);
      } else {
        JCCompilationUnit tree0 = env0.toplevel;
        if (!fileManager.isSameFile(tree.sourcefile, tree0.sourcefile)) {
          log.warning(
              tree.pid != null ? tree.pid.pos() : null, "pkg-info.already.seen", tree.packge);
          if (addEnv
              || (tree0.packageAnnotations.isEmpty()
                  && tree.docComments != null
                  && tree.docComments.get(tree) != null)) {
            typeEnvs.put(tree.packge, topEnv);
          }
        }
      }

      for (Symbol q = tree.packge; q != null && q.kind == PCK; q = q.owner) q.flags_field |= EXISTS;

      Name name = names.package_info;
      ClassSymbol c = reader.enterClass(name, tree.packge);
      c.flatname = names.fromString(tree.packge + "." + name);
      c.sourcefile = tree.sourcefile;
      c.completer = null;
      c.members_field = new Scope(c);
      tree.packge.package_info = c;
    }
    classEnter(tree.defs, topEnv);
    if (addEnv) {
      todo.append(topEnv);
    }
    log.useSource(prev);
    result = null;
  }
示例#23
0
 @Override
 public String printObject() {
   try {
     final LispThread thread = LispThread.currentThread();
     // FIXME
     if (typep(Symbol.RESTART) != NIL) {
       Symbol PRINT_RESTART = PACKAGE_SYS.intern("PRINT-RESTART");
       LispObject fun = PRINT_RESTART.getSymbolFunction();
       StringOutputStream stream = new StringOutputStream();
       thread.execute(fun, this, stream);
       return stream.getString().getStringValue();
     }
     if (_PRINT_STRUCTURE_.symbolValue(thread) == NIL)
       return unreadableString(structureClass.getName().printObject());
     int maxLevel = Integer.MAX_VALUE;
     LispObject printLevel = Symbol.PRINT_LEVEL.symbolValue(thread);
     if (printLevel instanceof Fixnum) maxLevel = ((Fixnum) printLevel).value;
     LispObject currentPrintLevel = _CURRENT_PRINT_LEVEL_.symbolValue(thread);
     int currentLevel = Fixnum.getValue(currentPrintLevel);
     if (currentLevel >= maxLevel && slots.length > 0) return "#";
     StringBuilder sb = new StringBuilder("#S(");
     sb.append(structureClass.getName().printObject());
     if (currentLevel < maxLevel) {
       LispObject effectiveSlots = structureClass.getSlotDefinitions();
       LispObject[] effectiveSlotsArray = effectiveSlots.copyToArray();
       Debug.assertTrue(effectiveSlotsArray.length == slots.length);
       final LispObject printLength = Symbol.PRINT_LENGTH.symbolValue(thread);
       final int limit;
       if (printLength instanceof Fixnum)
         limit = Math.min(slots.length, ((Fixnum) printLength).value);
       else limit = slots.length;
       final boolean printCircle = (Symbol.PRINT_CIRCLE.symbolValue(thread) != NIL);
       for (int i = 0; i < limit; i++) {
         sb.append(' ');
         SimpleVector slotDefinition = (SimpleVector) effectiveSlotsArray[i];
         // FIXME AREF(1)
         LispObject slotName = slotDefinition.AREF(1);
         Debug.assertTrue(slotName instanceof Symbol);
         sb.append(':');
         sb.append(((Symbol) slotName).name.getStringValue());
         sb.append(' ');
         if (printCircle) {
           StringOutputStream stream = new StringOutputStream();
           thread.execute(Symbol.OUTPUT_OBJECT.getSymbolFunction(), slots[i], stream);
           sb.append(stream.getString().getStringValue());
         } else sb.append(slots[i].printObject());
       }
       if (limit < slots.length) sb.append(" ...");
     }
     sb.append(')');
     return sb.toString();
   } catch (StackOverflowError e) {
     error(new StorageCondition("Stack overflow."));
     return null; // Not reached.
   }
 }
 /** {@inheritDoc} */
 public Collection<ConstructorDeclaration> getConstructors() {
   ArrayList<ConstructorDeclaration> res = new ArrayList<ConstructorDeclaration>();
   for (Symbol s : getMembers(true)) {
     if (s.isConstructor()) {
       MethodSymbol m = (MethodSymbol) s;
       res.add((ConstructorDeclaration) env.declMaker.getExecutableDeclaration(m));
     }
   }
   return res;
 }
示例#25
0
 @Before
 public void setUp() {
   forms =
       new Form[] {
         new StringLiteral("docstr"),
         Symbol.create("abc"),
         new Attribute(Symbol.create("abc"), Symbol.create("def")),
         new NumberLiteral(123)
       };
   program = new Program(forms);
 }
 /** Only valid for T_ARRAY; throws unspecified exception otherwise */
 public ArrayInfo getArrayInfo() {
   int index = 1;
   int dim = 1;
   index = skipOptionalSize(signature, index);
   while (signature.getByteAt(index) == '[') {
     index++;
     dim++;
     skipOptionalSize(signature, index);
   }
   int elementType = BasicType.charToType((char) signature.getByteAt(index));
   return new ArrayInfo(dim, elementType);
 }
 @Override
 public void send(EventHandler e) {
   e.startNonterminal(name, begin);
   int pos = begin;
   for (Symbol c : children) {
     if (pos < c.begin) e.whitespace(pos, c.begin);
     c.send(e);
     pos = c.end;
   }
   if (pos < end) e.whitespace(pos, end);
   e.endNonterminal(name, end);
 }
示例#28
0
 boolean computeSubtypeOf(Klass k) {
   // An array is a subtype of Serializable, Clonable, and Object
   Symbol name = k.getName();
   if (name != null
       && (name.equals(javaIoSerializableName())
           || name.equals(javaLangCloneableName())
           || name.equals(javaLangObjectName()))) {
     return true;
   } else {
     return false;
   }
 }
示例#29
0
  // Verify if the number of items of list right member (on fedinition) is equal to left member
  public Boolean verifyNumberVarList(int num_var) {
    Iterator<Symbol> it1 = this.getMembers().iterator();
    Symbol sym1;
    int i;
    for (i = 1; i < num_var; i++) {
      sym1 = it1.next();
      if (sym1.getIsVariableSymbol() == false) break;
    }

    if (i == num_var) return true;
    else return false;
  }
示例#30
0
 public static String format(String messageTmpl, Symbol... symbols) {
   Object[] formattedSymbols = new String[symbols.length];
   for (int i = 0; i < symbols.length; i++) {
     Symbol s = symbols[i];
     if (s == null) {
       formattedSymbols[i] = "null";
     } else {
       formattedSymbols[i] = s.accept(INSTANCE, null);
     }
   }
   return String.format(Locale.ENGLISH, messageTmpl, formattedSymbols);
 }