Exemple #1
0
  /*
   * functionParameters
   *   : "(" functionParameter{","}? ")" // default values
   *   ;
   *
   * functionParameter
   *   : modifiers functionParameterRest
   *   ;
   *
   * functionParameterRest
   *   : parameter ("=" element)?
   *   ;
   */
  void parseValueParameterList(boolean isFunctionTypeContents, TokenSet recoverySet) {
    assert _at(LPAR);
    PsiBuilder.Marker parameters = mark();

    myBuilder.disableNewlines();
    advance(); // LPAR

    if (!parseIdeTemplate()) {
      if (!at(RPAR) && !atSet(recoverySet)) {
        while (true) {
          if (at(COMMA)) {
            errorAndAdvance("Expecting a parameter declaration");
          } else if (at(RPAR)) {
            error("Expecting a parameter declaration");
            break;
          }
          if (isFunctionTypeContents) {
            if (!tryParseValueParameter()) {
              PsiBuilder.Marker valueParameter = mark();
              parseModifierList(MODIFIER_LIST, false); // lazy, out, ref
              parseTypeRef();
              valueParameter.done(VALUE_PARAMETER);
            }
          } else {
            parseValueParameter();
          }
          if (at(COMMA)) {
            advance(); // COMMA
          } else if (!atSet(VALUE_PARAMETER_FIRST)) break;
        }
      }
    }

    expect(RPAR, "Expecting ')'", recoverySet);
    myBuilder.restoreNewlinesState();

    parameters.done(VALUE_PARAMETER_LIST);
  }
Exemple #2
0
 public void parseValueParameter() {
   parseValueParameter(false);
 }