Socket
Socket
Sign inDemoInstall

pegjs-override-action

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pegjs-override-action

Override action (PEGjs plugin)


Version published
Weekly downloads
4
Maintainers
1
Created
Weekly downloads
 

Readme

Source

pegjs-override-action

Override action (PEGjs plugin)

Reason

This plugin came to life, as part of a process of referencing basic PEGs and build structure outside of the PEGs. In essence, it gives the possibility for reusable PEGs.

E.g. A collection of core PEGjs grammars (RFC, ISO, etc.)

Usage

npm install pegjs-override-action
peg = require 'peg'
overrideAction = require 'pegjs-override-action'

parser = PEG.buildParser "start = 'a' / 'b' / 'c' / 'd' { return 'd' }",
  plugins: [overrideAction]
  overrideActionPlugin:
    rules:
      start: [
        () -> "b"
        "return 'a';"
        undefined
        '__skip__' # equivalent to undefined atm
      ]

parser.parse 'a' # 'b'
parser.parse 'a' # 'b'
parser.parse 'c' # 'c'
parser.parse 'd' # 'd'

License

MIT

Keywords

FAQs

Last updated on 01 Jun 2013

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc