Grammar
Nearley
Lexer
Nearley
Rule
Nearley
Token
Nearley
Symbol
id
grammar
Index
Interfaces
Grammar
Nearley
Lexer
Nearley
Rule
Nearley
Token
Type aliases
Nearley
Symbol
Functions
id
Object literals
grammar
Type aliases
Nearley
Symbol
Nearley
Symbol
:
string
|
{
literal
:
any
}
|
{
test
:
(
token
:
any
)
=>
boolean
}
Functions
id
id
(
d
:
any
[]
)
:
any
Parameters
d:
any
[]
Returns
any
Object literals
Const
grammar
grammar
:
object
Lexer
Lexer
:
undefined
= undefined
Parser
Rules
Parser
Rules
:
(
{
name
:
string
;
symbols
:
(
string
|
{
literal
:
string
}
)
[]
;
postprocess
:
any
}
|
{
name
:
string
;
postprocess
:
id
;
symbols
:
{
literal
:
string
}
[]
}
|
{
name
:
string
;
symbols
:
RegExp
[]
}
|
{
name
:
string
;
symbols
:
(
string
|
RegExp
)
[]
;
postprocess
:
any
}
)
[]
= [{"name": "BracketExpr", "symbols": [{"literal":"<"}, "Modifier", "ModKey", {"literal":">"}], "postprocess": bexpr=>bexpr.slice(1,-1)},{"name": "BracketExpr", "symbols": [{"literal":"<"}, "Key", {"literal":">"}], "postprocess": bexpr=>[{}].concat(bexpr.slice(1,-1))},{"name": "Modifier$ebnf$1", "symbols": [/[acmsACMS]/], "postprocess": id},{"name": "Modifier$ebnf$1", "symbols": [], "postprocess": () => null},{"name": "Modifier$ebnf$2", "symbols": [/[acmsACMS]/], "postprocess": id},{"name": "Modifier$ebnf$2", "symbols": [], "postprocess": () => null},{"name": "Modifier$ebnf$3", "symbols": [/[acmsACMS]/], "postprocess": id},{"name": "Modifier$ebnf$3", "symbols": [], "postprocess": () => null},{"name": "Modifier$ebnf$4", "symbols": [/[acmsACMS]/], "postprocess": id},{"name": "Modifier$ebnf$4", "symbols": [], "postprocess": () => null},{"name": "Modifier", "symbols": ["Modifier$ebnf$1", "Modifier$ebnf$2", "Modifier$ebnf$3", "Modifier$ebnf$4", {"literal":"-"}], "postprocess":/** For each modifier present,add its long name as an attribute set to true to an object */(mods, _, reject) => {const longNames = new Map([["A", "altKey"],["C", "ctrlKey"],["M", "metaKey"],["S", "shiftKey"],])let modifiersObj = {}for (let mod of mods) {if (mod === null || mod === "-") continuelet longName = longNames.get(mod.toUpperCase())if (longName) {// Reject if the same name is used twice.if (longName in modifiersObj) return rejectelse modifiersObj[longName] = true}}return modifiersObj}},{"name": "ModKey", "symbols": [{"literal":"<"}], "postprocess": id},{"name": "ModKey", "symbols": [{"literal":">"}], "postprocess": id},{"name": "ModKey", "symbols": [{"literal":"-"}], "postprocess": id},{"name": "ModKey", "symbols": ["Key"], "postprocess": id},{"name": "Key$ebnf$1", "symbols": [/[^\s<>-]/]},{"name": "Key$ebnf$1", "symbols": ["Key$ebnf$1", /[^\s<>-]/], "postprocess": (d) => d[0].concat([d[1]])},{"name": "Key", "symbols": ["Key$ebnf$1"], "postprocess": (key)=>key[0].join("")}]
Parser
Start
Parser
Start
:
string
= "BracketExpr"