Function stringLiteral

  • Match a string literal.

    Escape (\) will be handled correctly for quote, not for the string content, so you have to parse those escaped content by yourself.

    E.g. stringLiteral('"') will match "abc\"def" and return "abc\"def".

    Set multiline: true to allow multiline string literals.

    Parameters

    • open: string

      The open quote.

    • Optional options: {
          acceptUnclosed?: boolean;
          close?: string;
          escape?: boolean;
          multiline?: boolean;
          unclosedError?: any;
      }
      • Optional acceptUnclosed?: boolean

        If true (by default), unclosed string(\n or EOF for single line string, and EOF for multiline string) will also be accepted and marked as options.unclosedError.

      • Optional close?: string

        The close quote. Equals to the open quote by default.

      • Optional escape?: boolean

        Default: true.

      • Optional multiline?: boolean

        Default: false.

      • Optional unclosedError?: any

        Default: 'unclosed string'

    Returns Action

Generated using TypeDoc