railt/graphql

View on GitHub
resources/grammar/expression/literal/list.pp2

Summary

Maintainability
Test Coverage

/**
 * --------------------------------------------------------------------------
 *  GraphQL List Values
 * --------------------------------------------------------------------------
 *
 * Lists are ordered sequences of values wrapped in square‐brackets [ ].
 * The values of a List literal may be any value literal or variable
 * (ex. [1, 2, 3]).
 *
 * Commas are optional throughout GraphQL so trailing commas are allowed
 * and repeated commas do not represent missing values.
 *
 * @see https://facebook.github.io/graphql/June2018/#sec-List-Value
 */

ListLiteral -> {
    return new Expr\Literal\ListLiteralNode($children);
}
  : ::T_BRACKET_OPEN::
      (Expression() ::T_COMMA::?)*
    ::T_BRACKET_CLOSE::
  ;