![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
fruitsconfits
Advanced tools
FruitsConfits - A well typed and sugared parser combinator framework for TypeScript/JavaScript.
npm install fruitsconfits
NOTICE:
Use withwebpack >= 5
If you get the error:
Module not found: Error: Can't resolve '(importing/path/to/filename)' in '(path/to/node_modules/path/to/dirname)' Did you mean '(filename).js'?`
Add following setting to your
webpack.config.js
.
{ test: /\.m?js/, resolve: { fullySpecified: false, }, },
On
webpack >= 5
, the extension in the request is mandatory for it to be fully specified if the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"'.
See CHANGELOG.md.
Get the string parser generators.
export function getStringParsers<C, R>(
params: {
rawToToken: (rawToken: string) => R,
concatTokens: (tokens: R[]) => R[],
});
rawToToken
: function to convert string token to AST element.concatTokens
: function to merge two AST elements into one AST element.returns an object that containing the parsers.
seq(needle: string)
needle
cls(...needles: string[])
needles
notCls(...needles: string[])
needles
clsFn(needle: (src: string) => number)
needle
alpha
upper
lower
num
nonzero
0
bin
oct
hex
alnum
space
spaceWithinSingleLine
ctrl
newline
word
any
bin(...prefixes: StringParserFnWithCtx<C, R>[])
oct(...prefixes: StringParserFnWithCtx<C, R>[])
hex(...prefixes: StringParserFnWithCtx<C, R>[])
int
bigint
float
isParam(criteria: (o: any) => boolean, conv?: (o: any) => any)
cat(...parsers: StringParserFnWithCtx<C, R>[])
parsers
once(parser: StringParserFnWithCtx<C, R>)
parser
repeat(parser: StringParserFnWithCtx<C, R>)
parser
qty(min?: number, max?: number) => (parser: StringParserFnWithCtx<C, R>)
parser
repeat
parserzeroWidth(helper?: () => R)
helper
err(message: string)
message
beginning(helper?: () => R)
helper
end(helper?: () => R)
helper
first(...parsers: StringParserFnWithCtx<C, R>[])
parsers
or(...parsers: StringParserFnWithCtx<C, R>[])
parsers
combine(...parsers: StringParserFnWithCtx<C, R>[])
parsers
erase(...parsers: StringParserFnWithCtx<C, R>[])
parsers
and return empty result []
trans(fn: (tokens: R[]) => R[]) => (...parsers: StringParserFnWithCtx<C, R>[])
parsers
and transform the result by fn
ahead(...parsers: StringParserFnWithCtx<C, R>[])
parsers
behind(n: number, helper?: () => R)(...parsers: StringParserFnWithCtx<C, R>[])
parsers
and return result that is provided by helper
rules(args: ApplyProductionRulesArg<string, C, R>) => (lexer: StringParserFnWithCtx<C, R>)
args
makeProgram
ParseError
thrown to a return valueGet the object list parser generators.
export function getObjectParsers<T extends ArrayLike<T[number]>, C, R>(
params: {
rawToToken: (rawToken: T[number]) => R,
concatTokens: (tokens: R[]) => R[],
comparator: (a: T[number], b: T[number]) => boolean,
});
rawToToken
: function to convert the input object list item to AST element.concatTokens
: function to merge two AST elements into one AST element.comparator
: function to compare two input object list items.returns an object that containing the parsers.
seq(needle: T)
needle
cls(...needles: T[number][])
needles
notCls(...needles: T[number][])
needles
clsFn(needle: (src: T[number]) => boolean)
needle
any
cat(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
once(parser: ParserFnWithCtx<T, C, R>)
parser
repeat(parser: ParserFnWithCtx<T, C, R>)
parser
qty(min?: number, max?: number) => (parser: ParserFnWithCtx<T, C, R>)
parser
repeat
parserzeroWidth(helper?: () => R)
helper
err(message: string)
message
beginning(helper?: () => R)
helper
end(helper?: () => R)
helper
first(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
or(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
combine(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
erase(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
and return empty result []
trans(fn: (tokens: R[]) => R[]) => (...parsers: ParserFnWithCtx<T, C, R>[])
parsers
and transform the result by fn
ahead(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
behind(n: number, helper?: () => R)(...parsers: ParserFnWithCtx<T, C, R>[])
parsers
and return result that is provided by helper
rules(args: ApplyProductionRulesArg<T, C, R>) => (lexer: ParserFnWithCtx<T, C, R>)
args
makeProgram
ParseError
thrown to a return valueBuild a parser input.
Example:
...
const program = makeProgram(trans(tokens => tokens)(
erase(repeat(commentOrSpace)),
first(listValue, objectValue, constExpr(end())),
erase(repeat(commentOrSpace)),
end(), ));
export function parse(s: string) {
const z = program(parserInput(s));
if (! z.succeeded) {
throw new Error(formatErrorMessage(z));
}
return z.tokens[0].value;
}
Build a parser input from ES6 template strings.
Example:
const program = makeProgram(combine(
seq('Hello,'),
isParam(o => String(o) === 'world'),
seq('!'),
end(), ));
export function parse(strings: TemplateStringsArray, ...values: any[]) {
const z = program(templateStringsParserInput(strings, values));
if (! z.succeeded) {
throw new Error(formatErrorMessage(z));
}
return z.tokens;
}
ISC
Copyright (c) 2019 Shellyl_N and Authors.
v0.5.0
FAQs
FruitsConfits - A well typed and sugared parser combinator framework for TypeScript/JavaScript.
We found that fruitsconfits demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.