You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.2 KiB
JavaScript
74 lines
1.2 KiB
JavaScript
"use strict";
|
|
|
|
module.exports = {
|
|
zeroOrMore: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "zeroOrMore",
|
|
rule: rule
|
|
};
|
|
},
|
|
oneOrMore: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "oneOrMore",
|
|
rule: rule
|
|
};
|
|
},
|
|
either: (options) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "either",
|
|
options: options
|
|
};
|
|
},
|
|
until: (rule, allowEnd = true) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "until",
|
|
rule: rule,
|
|
// FIXME: Should allowEnd have a different default?
|
|
allowEnd: allowEnd
|
|
};
|
|
},
|
|
optional: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "optional",
|
|
rule: rule
|
|
};
|
|
},
|
|
peek: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "peek",
|
|
rule: rule
|
|
};
|
|
},
|
|
test: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "test",
|
|
rule: rule
|
|
};
|
|
},
|
|
wholeMatch: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "wholeMatch",
|
|
rule: rule
|
|
};
|
|
},
|
|
trackPosition: (rule) => {
|
|
return {
|
|
__protocolKitInstruction: true,
|
|
type: "trackPosition",
|
|
rule: rule
|
|
};
|
|
},
|
|
EndOfInput: {
|
|
__protocolKitInstruction: true,
|
|
type: "endOfInput"
|
|
},
|
|
};
|