Skip to content
Snippets Groups Projects
Commit cf01cbd3 authored by Jonas Zohren's avatar Jonas Zohren
Browse files

Allow easily typable not, and, or

parent 336f9a14
No related branches found
No related tags found
No related merge requests found
Pipeline #15824 passed
ConjunctiveClause
= '{' head:DisunctiveClause tail:( '∧' _ DisunctiveClause)* '}' {
= '{' head:DisunctiveClause tail:( [∧&] _ DisunctiveClause)* '}' {
return [head, ...tail.map(e => e[2])];
}
DisunctiveClause
= '{' head:VariableOccurence tail:( '∨' _ VariableOccurence)* '}' {
= '{' head:VariableOccurence tail:( [∨|] _ VariableOccurence)* '}' {
return [head, ...tail.map(e => e[2])];
}
VariableOccurence
= a:('¬')? b:[A-Z]c:[0-9] {
= a:([¬!])? b:[A-Z]c:[0-9] {
return {name:b+c, polarity: a === null};
}
......
......@@ -172,17 +172,17 @@ function peg$parse(input: string, options?: IParseOptions) {
const peg$c0 = "{";
const peg$c1 = peg$literalExpectation("{", false);
const peg$c2 = "\u2227";
const peg$c3 = peg$literalExpectation("\u2227", false);
const peg$c2 = /^[\u2227&]/;
const peg$c3 = peg$classExpectation(["\u2227", "&"], false, false);
const peg$c4 = "}";
const peg$c5 = peg$literalExpectation("}", false);
const peg$c6 = function(head: any, tail: any): any {
return [head, ...tail.map(e => e[2])];
};
const peg$c7 = "\u2228";
const peg$c8 = peg$literalExpectation("\u2228", false);
const peg$c9 = "\xAC";
const peg$c10 = peg$literalExpectation("\xAC", false);
const peg$c7 = /^[\u2228|]/;
const peg$c8 = peg$classExpectation(["\u2228", "|"], false, false);
const peg$c9 = /^[\xAC!]/;
const peg$c10 = peg$classExpectation(["\xAC", "!"], false, false);
const peg$c11 = /^[A-Z]/;
const peg$c12 = peg$classExpectation([["A", "Z"]], false, false);
const peg$c13 = /^[0-9]/;
......@@ -363,8 +363,8 @@ function peg$parse(input: string, options?: IParseOptions) {
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 8743) {
s5 = peg$c2;
if (peg$c2.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
......@@ -392,8 +392,8 @@ function peg$parse(input: string, options?: IParseOptions) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 8743) {
s5 = peg$c2;
if (peg$c2.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
......@@ -478,8 +478,8 @@ function peg$parse(input: string, options?: IParseOptions) {
if (s2 !== peg$FAILED) {
s3 = [];
s4 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 8744) {
s5 = peg$c7;
if (peg$c7.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
......@@ -507,8 +507,8 @@ function peg$parse(input: string, options?: IParseOptions) {
while (s4 !== peg$FAILED) {
s3.push(s4);
s4 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 8744) {
s5 = peg$c7;
if (peg$c7.test(input.charAt(peg$currPos))) {
s5 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s5 = peg$FAILED;
......@@ -581,8 +581,8 @@ function peg$parse(input: string, options?: IParseOptions) {
}
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 172) {
s1 = peg$c9;
if (peg$c9.test(input.charAt(peg$currPos))) {
s1 = input.charAt(peg$currPos);
peg$currPos++;
} else {
s1 = peg$FAILED;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment