Parser module 🌲oniguruma-parser/parser
May 6, 2025 · View on GitHub
This module's parse function accepts an Oniguruma pattern with optional flags and other options, and returns an AST. This module also exports numerous functions and types that can be used when traversing, transforming, or manually creating an AST.
Note
Compared to the toOnigurumaAst wrapper from the root module, parse includes additional options for specialized use, but toOnigurumaAst is often easier to use since it automatically provides the appropriate Unicode property validation data. The data is available by importing OnigUnicodePropertyMap from 'oniguruma-parser/unicode'.
Import
import {parse} from 'oniguruma-parser/parser';
Type definition
function parse(
pattern: string,
options?: {
flags?: string;
normalizeUnknownPropertyNames?: boolean;
rules?: {
captureGroup?: boolean;
singleline?: boolean;
};
skipBackrefValidation?: boolean;
skipLookbehindValidation?: boolean;
skipPropertyNameValidation?: boolean;
unicodePropertyMap?: Map<string, string> | null;
}
): OnigurumaAst;
About
Created by Steven Levithan and contributors.
If you want to support this project, I'd love your help by contributing improvements (guide), sharing it with others, or sponsoring ongoing development.
MIT License.