Skip to main content
Module

x/ohm_js/test/helpers/testUtil.js

A library and language for building parsers, interpreters, compilers, etc.
Go to Latest
File
'use strict';
// --------------------------------------------------------------------// Imports// --------------------------------------------------------------------
const ohm = require('../..');
// --------------------------------------------------------------------// Private stuff// --------------------------------------------------------------------
let nextId = 0;
function uniqueId() { return nextId++;}
function makeGrammar(source, optNamespace) { if (Array.isArray(source)) { source = source.join('\n'); } return ohm.grammar(source, optNamespace);}
// --------------------------------------------------------------------// Exports// --------------------------------------------------------------------
module.exports = { makeGrammar, uniqueId,};