New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

clarity-pattern-parser

Package Overview
Dependencies
Maintainers
1
Versions
176
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clarity-pattern-parser

Parsers === OrValue AndValue RepeatValue LiteralValue AnyOfThese

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
5.5K
decreased by-25.2%
Maintainers
1
Weekly downloads
 
Created
Source

Parsers

OrValue AndValue RepeatValue LiteralValue AnyOfThese

OrComposite AndComposite RepeatComposite

Optional

When a parser cannot match against a cursor it will:

  • A - Throw an error if it wasn't a optional parser, or
  • B - return null if its an optional parser.

All parsers are responsible to increment to the next slot if a match has been made, unless it has reached the end, in which case the cursor remains at the end.

If a child parser throws, the parent parser is responsible to recover from the error.

null is a implicit optional no match. So they can be filtered out.


const letter = new AnyOfThese("letter", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
const digit = new AnyOfThese("digit", "0987654321");
const alphaNumericCharacter = new OrValue([letter, digit]);
const alphaNumeric = new RepeatValue("alpha-numeric", alphaNumericCharacter);
const identifier = new AndValue("identifier", [letter, new Optional(alphaNumeric)]);


Min Max on Repeat as well as divider Parser.

Patterns can give intellisense with traversing the patterns. Pattern validation happens during parsing, and value validation happens when visiting the nodes.

FAQs

Package last updated on 13 Nov 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc