How to use the graphql-language-service-parser.p function in graphql-language-service-parser

To help you get started, we’ve selected a few graphql-language-service-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graphql / graphiql / packages / codemirror-graphql / src / variables / mode.js View on Github external
case 'true':
          case 'false':
            return 'BooleanValue';
          case 'null':
            return 'NullValue';
        }
        return null;
    }
  },
  NumberValue: [t('Number', 'number')],
  StringValue: [t('String', 'string')],
  BooleanValue: [t('Keyword', 'builtin')],
  NullValue: [t('Keyword', 'keyword')],
  ListValue: [p('['), list('Value', opt(p(','))), p(']')],
  ObjectValue: [p('{'), list('ObjectField', opt(p(','))), p('}')],
  ObjectField: [namedKey('attribute'), p(':'), 'Value'],
};

// A namedKey Token which will decorate the state with a `name`
function namedKey(style) {
  return {
    style,
    match: token => token.kind === 'String',
    update(state, token) {
      state.name = token.value.slice(1, -1); // Remove quotes.
    },
  };
}