Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
pegjs-override-action
Advanced tools
Readme
Override action (PEGjs plugin)
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.)
npm install pegjs-override-action
PEG = require 'pegjs'
overrideAction = require 'pegjs-override-action'
parser = PEG.buildParser "start = 'a' / 'b' / 'c' / 'd' { return 'd' } / 'e'",
plugins: [overrideAction]
overrideActionPlugin:
initializer: "_ = require('lodash');"
rules:
start: [
() -> "b"
"return 'a';"
undefined
'__skip__' # equivalent to undefined atm
() -> _.VERSION
]
parser.parse 'a' # 'b'
parser.parse 'b' # 'a'
parser.parse 'c' # 'c'
parser.parse 'd' # 'd'
parser.parse 'e' # e.g. 1.3.1
When defining an action as a function, it will be stringified and injected into a different scope, which breaks variable closure. Any data or functions that need to be shared between rule actions should be defined in your initializer block. When using require
in your actions or initializer, it is a good idea to resolve an absolute path (e.g. using require.resolve
as the code is also executed in a different path than where it is defined.
PEG = require 'pegjs'
{makeBuildParser} = require 'pegjs-override-action'
buildParser = makeParser {
PEG
grammar: "start = 'a' / 'b' / 'c' / 'd' { return 'd' } / 'e'"
initializer: "_ = require('lodash');"
rules:
start: [
() -> "b"
"return 'a';"
undefined
'__skip__' # equivalent to undefined atm
() -> _.VERSION
]
mixins: {} # list of default rules
parser = buildParser {
startRule: 'start'
options: {} #
}
parser.parse 'a' # 'b'
parser.parse 'b' # 'a'
parser.parse 'c' # 'c'
parser.parse 'd' # 'd'
parser.parse 'e' # e.g. 1.3.1
FAQs
security holding package
The npm package pegjs-override-action receives a total of 4 weekly downloads. As such, pegjs-override-action popularity was classified as not popular.
We found that pegjs-override-action demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.