graphql-language-service-parser

  • Version 1.10.0
  • Published
  • 131 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: any;
        DOCUMENT: any;
        OPERATION_DEFINITION: any;
        VARIABLE_DEFINITION: any;
        SELECTION_SET: any;
        FIELD: any;
        ARGUMENT: any;
        FRAGMENT_SPREAD: any;
        INLINE_FRAGMENT: any;
        FRAGMENT_DEFINITION: any;
        VARIABLE: any;
        INT: any;
        FLOAT: any;
        STRING: any;
        BOOLEAN: any;
        NULL: any;
        ENUM: any;
        LIST: any;
        OBJECT: any;
        OBJECT_FIELD: any;
        DIRECTIVE: any;
        NAMED_TYPE: any;
        LIST_TYPE: any;
        NON_NULL_TYPE: any;
        SCHEMA_DEFINITION: any;
        OPERATION_TYPE_DEFINITION: any;
        SCALAR_TYPE_DEFINITION: any;
        OBJECT_TYPE_DEFINITION: any;
        FIELD_DEFINITION: any;
        INPUT_VALUE_DEFINITION: any;
        INTERFACE_TYPE_DEFINITION: any;
        UNION_TYPE_DEFINITION: any;
        ENUM_TYPE_DEFINITION: any;
        ENUM_VALUE_DEFINITION: any;
        INPUT_OBJECT_TYPE_DEFINITION: any;
        DIRECTIVE_DEFINITION: any;
        SCHEMA_EXTENSION: any;
        SCALAR_TYPE_EXTENSION: any;
        OBJECT_TYPE_EXTENSION: any;
        INTERFACE_TYPE_EXTENSION: any;
        UNION_TYPE_EXTENSION: any;
        ENUM_TYPE_EXTENSION: any;
        INPUT_OBJECT_TYPE_EXTENSION: any;
        };

          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>