graphql-language-service-parser

  • Version 1.10.4
  • Published
  • 206 kB
  • 1 dependency
  • MIT license

Install

npm i graphql-language-service-parser
yarn add graphql-language-service-parser
pnpm add graphql-language-service-parser

Overview

An online parser for GraphQL for use in syntax-highlighters and code intelligence tools

Index

Variables

variable AdditionalRuleKinds

const AdditionalRuleKinds: _AdditionalRuleKinds;

    variable LexRules

    const LexRules: {
    Name: RegExp;
    Punctuation: RegExp;
    Number: RegExp;
    String: RegExp;
    Comment: RegExp;
    };

      variable ParseRules

      const ParseRules: { [name: string]: ParseRule };

        variable RuleKinds

        const RuleKinds: {
        ALIASED_FIELD: 'AliasedField';
        ARGUMENTS: 'Arguments';
        SHORT_QUERY: 'ShortQuery';
        QUERY: 'Query';
        MUTATION: 'Mutation';
        SUBSCRIPTION: 'Subscription';
        TYPE_CONDITION: 'TypeCondition';
        INVALID: 'Invalid';
        COMMENT: 'Comment';
        SCHEMA_DEF: 'SchemaDef';
        SCALAR_DEF: 'ScalarDef';
        OBJECT_TYPE_DEF: 'ObjectTypeDef';
        OBJECT_VALUE: 'ObjectValue';
        LIST_VALUE: 'ListValue';
        INTERFACE_DEF: 'InterfaceDef';
        UNION_DEF: 'UnionDef';
        ENUM_DEF: 'EnumDef';
        ENUM_VALUE: 'EnumValue';
        FIELD_DEF: 'FieldDef';
        INPUT_DEF: 'InputDef';
        INPUT_VALUE_DEF: 'InputValueDef';
        ARGUMENTS_DEF: 'ArgumentsDef';
        EXTEND_DEF: 'ExtendDef';
        DIRECTIVE_DEF: 'DirectiveDef';
        IMPLEMENTS: 'Implements';
        VARIABLE_DEFINITIONS: 'VariableDefinitions';
        TYPE: 'Type';
        NAME: Kind.NAME;
        DOCUMENT: Kind.DOCUMENT;
        OPERATION_DEFINITION: Kind.OPERATION_DEFINITION;
        VARIABLE_DEFINITION: Kind.VARIABLE_DEFINITION;
        SELECTION_SET: Kind.SELECTION_SET;
        FIELD: Kind.FIELD;
        ARGUMENT: Kind.ARGUMENT;
        FRAGMENT_SPREAD: Kind.FRAGMENT_SPREAD;
        INLINE_FRAGMENT: Kind.INLINE_FRAGMENT;
        FRAGMENT_DEFINITION: Kind.FRAGMENT_DEFINITION;
        VARIABLE: Kind.VARIABLE;
        INT: Kind.INT;
        FLOAT: Kind.FLOAT;
        STRING: Kind.STRING;
        BOOLEAN: Kind.BOOLEAN;
        NULL: Kind.NULL;
        ENUM: Kind.ENUM;
        LIST: Kind.LIST;
        OBJECT: Kind.OBJECT;
        OBJECT_FIELD: Kind.OBJECT_FIELD;
        DIRECTIVE: Kind.DIRECTIVE;
        NAMED_TYPE: Kind.NAMED_TYPE;
        LIST_TYPE: Kind.LIST_TYPE;
        NON_NULL_TYPE: Kind.NON_NULL_TYPE;
        SCHEMA_DEFINITION: Kind.SCHEMA_DEFINITION;
        OPERATION_TYPE_DEFINITION: Kind.OPERATION_TYPE_DEFINITION;
        SCALAR_TYPE_DEFINITION: Kind.SCALAR_TYPE_DEFINITION;
        OBJECT_TYPE_DEFINITION: Kind.OBJECT_TYPE_DEFINITION;
        FIELD_DEFINITION: Kind.FIELD_DEFINITION;
        INPUT_VALUE_DEFINITION: Kind.INPUT_VALUE_DEFINITION;
        INTERFACE_TYPE_DEFINITION: Kind.INTERFACE_TYPE_DEFINITION;
        UNION_TYPE_DEFINITION: Kind.UNION_TYPE_DEFINITION;
        ENUM_TYPE_DEFINITION: Kind.ENUM_TYPE_DEFINITION;
        ENUM_VALUE_DEFINITION: Kind.ENUM_VALUE_DEFINITION;
        INPUT_OBJECT_TYPE_DEFINITION: Kind.INPUT_OBJECT_TYPE_DEFINITION;
        DIRECTIVE_DEFINITION: Kind.DIRECTIVE_DEFINITION;
        SCHEMA_EXTENSION: Kind.SCHEMA_EXTENSION;
        SCALAR_TYPE_EXTENSION: Kind.SCALAR_TYPE_EXTENSION;
        OBJECT_TYPE_EXTENSION: Kind.OBJECT_TYPE_EXTENSION;
        INTERFACE_TYPE_EXTENSION: Kind.INTERFACE_TYPE_EXTENSION;
        UNION_TYPE_EXTENSION: Kind.UNION_TYPE_EXTENSION;
        ENUM_TYPE_EXTENSION: Kind.ENUM_TYPE_EXTENSION;
        INPUT_OBJECT_TYPE_EXTENSION: Kind.INPUT_OBJECT_TYPE_EXTENSION;
        };

          Functions

          function butNot

          butNot: (rule: Rule, exclusions: Array<Rule>) => Rule;

            function isIgnored

            isIgnored: (ch: string) => boolean;

              function list

              list: (ofRule: Rule | string, separator?: string | Rule) => Rule;

                function onlineParser

                onlineParser: (options?: ParserOptions) => {
                startState: () => State;
                token: (stream: CharacterStream, state: State) => string;
                };

                  function opt

                  opt: (ofRule: Rule | string) => Rule;

                    function p

                    p: (value: string, style?: string) => Rule;

                      function t

                      t: (
                      kind: string,
                      style: string
                      ) => { style: string; match: (token: Token) => boolean };

                        Classes

                        class CharacterStream

                        class CharacterStream implements CharacterStreamInterface {}

                          constructor

                          constructor(sourceText: string);

                            property backUp

                            backUp: (num: number) => void;

                              property column

                              column: () => number;

                                property current

                                current: () => string;

                                  property eat

                                  eat: (pattern: TokenPattern) => string | undefined;

                                    property eatSpace

                                    eatSpace: () => boolean;

                                      property eatWhile

                                      eatWhile: (match: TokenPattern) => boolean;

                                        property eol

                                        eol: () => boolean;

                                          property getCurrentPosition

                                          getCurrentPosition: () => number;

                                            property getStartOfToken

                                            getStartOfToken: () => number;

                                              property indentation

                                              indentation: () => number;

                                                property match

                                                match: (
                                                pattern: TokenPattern,
                                                consume?: boolean | null | undefined,
                                                caseFold?: boolean | null | undefined
                                                ) => Array<string> | boolean;

                                                  property next

                                                  next: () => string;

                                                    property peek

                                                    peek: () => string | null;

                                                      property skipTo

                                                      skipTo: (position: number) => void;

                                                        property skipToEnd

                                                        skipToEnd: () => void;

                                                          property sol

                                                          sol: () => boolean;

                                                            Interfaces

                                                            interface CharacterStreamInterface

                                                            interface CharacterStreamInterface {}

                                                              property backUp

                                                              backUp: (num: number) => void;

                                                                property column

                                                                column: () => number;

                                                                  property current

                                                                  current: () => string;

                                                                    property eat

                                                                    eat: (pattern: TokenPattern) => string | undefined;

                                                                      property eatSpace

                                                                      eatSpace: () => boolean;

                                                                        property eatWhile

                                                                        eatWhile: (match: TokenPattern) => boolean;

                                                                          property eol

                                                                          eol: () => boolean;

                                                                            property getCurrentPosition

                                                                            getCurrentPosition: () => number;

                                                                              property getStartOfToken

                                                                              getStartOfToken: () => number;

                                                                                property indentation

                                                                                indentation: () => number;

                                                                                  property match

                                                                                  match: (
                                                                                  pattern: TokenPattern,
                                                                                  consume?: Maybe<boolean>,
                                                                                  caseFold?: Maybe<boolean>
                                                                                  ) => string[] | boolean;

                                                                                    property next

                                                                                    next: () => string;

                                                                                      property peek

                                                                                      peek: () => string | null;

                                                                                        property skipTo

                                                                                        skipTo: (position: number) => void;

                                                                                          property skipToEnd

                                                                                          skipToEnd: () => void;

                                                                                            property sol

                                                                                            sol: () => boolean;

                                                                                              Type Aliases

                                                                                              type ContextToken

                                                                                              type ContextToken = {
                                                                                              start: number;
                                                                                              end: number;
                                                                                              string: string;
                                                                                              state: State;
                                                                                              style?: string;
                                                                                              };

                                                                                                type ContextTokenForCodeMirror

                                                                                                type ContextTokenForCodeMirror = {
                                                                                                start: number;
                                                                                                end: number;
                                                                                                string: string;
                                                                                                type: string | null;
                                                                                                state: State;
                                                                                                };

                                                                                                  type ContextTokenUnion

                                                                                                  type ContextTokenUnion = ContextToken | ContextTokenForCodeMirror;

                                                                                                    type ParserOptions

                                                                                                    type ParserOptions = {
                                                                                                    eatWhitespace: (stream: CharacterStream) => boolean;
                                                                                                    lexRules: Partial<typeof LexRulesType>;
                                                                                                    parseRules: typeof ParseRulesType;
                                                                                                    editorConfig: {
                                                                                                    [name: string]: any;
                                                                                                    };
                                                                                                    };

                                                                                                      type ParseRule

                                                                                                      type ParseRule =
                                                                                                      | RuleOrString[]
                                                                                                      | ((token: Token, stream: CharacterStream) => string | null | void);

                                                                                                        type Rule

                                                                                                        type Rule = {
                                                                                                        style?: string;
                                                                                                        match?: (token: Token) => boolean;
                                                                                                        update?: (state: State, token: Token) => void;
                                                                                                        separator?: string | Rule;
                                                                                                        isList?: boolean;
                                                                                                        ofRule?: Rule | string;
                                                                                                        };

                                                                                                          type RuleKind

                                                                                                          type RuleKind = _RuleKinds[keyof _RuleKinds];

                                                                                                            type RuleKindEnum

                                                                                                            type RuleKindEnum = RuleKind;

                                                                                                              type RuleOrString

                                                                                                              type RuleOrString = Rule | string;

                                                                                                                type State

                                                                                                                type State = {
                                                                                                                level: number;
                                                                                                                levels?: number[];
                                                                                                                prevState: Maybe<State>;
                                                                                                                rule: Maybe<ParseRule>;
                                                                                                                kind: Maybe<RuleKind>;
                                                                                                                name: Maybe<string>;
                                                                                                                type: Maybe<string>;
                                                                                                                step: number;
                                                                                                                needsSeperator: boolean;
                                                                                                                needsAdvance?: boolean;
                                                                                                                indentLevel?: number;
                                                                                                                inBlockstring?: boolean;
                                                                                                                };

                                                                                                                  type Token

                                                                                                                  type Token = {
                                                                                                                  kind: string;
                                                                                                                  value: string;
                                                                                                                  };

                                                                                                                    type TokenPattern

                                                                                                                    type TokenPattern = string | ((char: string) => boolean) | RegExp;

                                                                                                                      Package Files (6)

                                                                                                                      Dependencies (1)

                                                                                                                      Dev Dependencies (8)

                                                                                                                      Peer Dependencies (1)

                                                                                                                      Badge

                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/graphql-language-service-parser.

                                                                                                                      • Markdown
                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/graphql-language-service-parser)
                                                                                                                      • HTML
                                                                                                                        <a href="https://www.jsdocs.io/package/graphql-language-service-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>