How to use the snapdragon.Renderer function in snapdragon

To help you get started, we’ve selected a few snapdragon 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 micromatch / extglob / lib / renderer.js View on Github external
switch (node.prefix) {
      case '!':
      case '^':
        return '(?:(?!(?:';
      case '@':
      case '+':
      case '*':
      case '?':
        return '(?:';
      default: {
        return node.val;
      }
    }
  }

  return new snapdragon.Renderer(extend({}, options))
    .set('negation', function(node)  {
      return '(?!^(?:';
    })
    .set('escaped', function(node)  {
      return node.val;
    })

    /**
     * Parens
     */

    .set('parens.open', extglobOpen)
    .set('parens.empty', function(node)  {
      return '.?';
    })
    .set('extglob.open', extglobOpen)

snapdragon

Easy-to-use plugin system for creating powerful, fast and versatile parsers and compilers, with built-in source-map support.

MIT
Latest version published 3 years ago

Package Health Score

71 / 100
Full package analysis