expressionjs-compiler

0.1.1 • Public • Published

Expression Compiler

  1. write a custom grammar
  2. in your grammar, return one of the token types for javascript (i.e. define how the AST should look)
  3. the compiler will automatically convert that to a function for you, to call against a scope

Install

node:

$ npm install expressionjs-compiler

browser:

$ component install expressionjs/compiler

API

  • hash-with-interpolation
  • hash
  • attribute
  • filters
  • filter
  • interpolations
  • interpolation
  • call
  • assignment
  • ternary
  • binary
  • unary
  • literal

Notes

iterator
hash-with-interpolation
hash
attribute
filters
filter
interpolations
interpolation
call
assignment
ternary
binary
unary
literal

filter-expression: exp1 | filter1:exp2 | filtern: expn
iterator-expression: exp1 for name in exp2
iterator-expression: exp1 group by exp2 for name in exp3
hash-expression: key1: exp1, key2: exp2, ..., key2: expn
hash-expression: key1: string + {{exp1}} + ... + {{expn}}
expression: string + {{exp1}} + ... + {{expn}}

Licence

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i expressionjs-compiler

Weekly Downloads

3

Version

0.1.1

License

none

Last publish

Collaborators

  • viatropos