JSPM

  • Created
  • Published
  • Downloads 49241
  • Score
    100M100P100Q161651F
  • License MIT

Lezer-based FEEL grammar

Package Exports

  • lezer-feel

Readme

lezer-feel

CI

This is a DMN 1.3 FEEL grammar for the Lezer parser system.

Supports context sensitive language parsing.

Usage

Parse FEEL to a Tree:

import {
  parser
} from 'lezer-feel';

// parse <Expressions>
parser.parse('foo > 1');

// parse <UnaryTests>
parser.configure({
  top: 'UnaryTests'
}).parse('> 100');

To enable context sensitive parsing based on inputs, configure the parser accordingly:

import {
  parser,
  trackVariables
} from 'lezer-feel';

const contextTracker = trackVariables({
  'if foo then bar': 1
});

const contextualParser = parser.configure({
  contextTracker
});

// recognizes <if foo then bar> as a <VariableName>
contextualParser.parse('if foo then bar');

License

The code is licensed under an MIT license.