Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWK DPLL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oh14.dev
SWK DPLL
Commits
cf01cbd3
Commit
cf01cbd3
authored
4 years ago
by
Jonas Zohren
Browse files
Options
Downloads
Patches
Plain Diff
Allow easily typable not, and, or
parent
336f9a14
No related branches found
No related tags found
No related merge requests found
Pipeline
#15824
passed
4 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/knf-parser.pegjs
+3
-3
3 additions, 3 deletions
src/knf-parser.pegjs
src/knf-parser.ts
+16
-16
16 additions, 16 deletions
src/knf-parser.ts
with
19 additions
and
19 deletions
src/knf-parser.pegjs
+
3
−
3
View file @
cf01cbd3
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};
}
...
...
This diff is collapsed.
Click to expand it.
src/knf-parser.ts
+
16
−
16
View file @
cf01cbd3
...
...
@@ -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
$
literal
Expectation
(
"
\
u2227
"
,
false
);
const
peg$c2
=
/^
[
\u
2227
&
]
/
;
const
peg$c3
=
peg
$
class
Expectation
(
[
"
\
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
$
literal
Expectation
(
"
\
u2228
"
,
false
);
const
peg$c9
=
"
\
xAC
"
;
const
peg$c10
=
peg
$
literal
Expectation
(
"
\
xAC
"
,
false
);
const
peg$c7
=
/^
[
\u
2228
|
]
/
;
const
peg$c8
=
peg
$
class
Expectation
(
[
"
\
u2228
"
,
"
|
"
],
false
,
false
);
const
peg$c9
=
/^
[
\x
AC
!
]
/
;
const
peg$c10
=
peg
$
class
Expectation
(
[
"
\
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
.
char
Code
At
(
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
.
char
Code
At
(
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
.
char
Code
At
(
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
.
char
Code
At
(
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
.
char
Code
At
(
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment