3.0.0 • Published 9 years ago

parsly v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Parsly

A small PEG based parser library.
An opinionated JavaScript port of Parslet.

NPM version Build Status

Install

npm install --save parsly

Usage

// There is 2 ways to access Parsly APIs.

// Parser API:
import {Parser} from 'parsly'
import {alt, seq, match, str, any, custom, lazy} from 'parsly/parser'

// Transform API:
import {Transformer} from 'parsly'
import Transformer, {simple, sequence, subtree} from 'parsly/transformer'

Parser API

Atoms

  • alt(...parsers)
  • seq(...parsers)
  • match(expr)
  • str(string)
  • any()
  • custom(fn)
  • lazy(fn)

Chain

  • as(name)
  • maybe()
  • many()
  • times(n)
  • repeat(min, max)

Transform API

  • Transform
  • Node
  • simple(node)
  • sequence(node)
  • subtree(node)

Transform class

  • Transform(rules)
  • Transform#rule(matchFn, transformFn)
  • Transform#run(ast, context)
3.0.0

9 years ago

2.2.1

9 years ago

2.2.0

9 years ago

2.1.0

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago