A library and language for building parsers, interpreters, compilers, etc.
Browser bundles: ohm.js • ohm.min.js
\u{...}
) inside terminal expressions. This can be used to specify code points above 0xFFFF
."😇".."😈"
is now a valid range expression.Browser bundles: ohm.js • ohm.min.js
Browser bundles: ohm.js • ohm.min.js
Browser bundles: ohm.js • ohm.min.js
Ohm v16.1.0 adds one new feature: the built-in applySyntactic
rule, which allows a syntactic rule to be applied in a lexical context. See #136 for more details.
Browser bundles: ohm.js • ohm.min.js
Ohm v16 is primarily about improving the experience of using Ohm with TypeScript. In order to do that, we needed to make some minor breaking changes. With the major version change, we also took the opportunity to clean up and simplify some parts of the API.
All of the breaking changes are described below. For more information about how to modify your existing code to work with Ohm v16, see the upgrade guide.
API
grammarFromScriptElement
and grammarsFromScriptElements
have been removed._iter
and _nonterminal
actions now take a variable number of arguments, rather than a single Node[]
argument. Release notes: args to _iter and _nonterminal actions.
addOperation
, extendOperation
, addAttribute
, and extendAttribute
now have a required type parameter, which is the return type of the operation (or the type of the attribute). The related types Action
and ActionDict
are similarly parameterized by the return type of the semantic actions. Release notes: type parameters for operations and actions.
generateExample
method has been removed from the PExpr class. (It was never part of Ohm's public API.)ohm-js
executable, as it was only ever intended for internal use. The new @ohm-js/cli package can now be used to generate grammar bundles.