Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lisa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
lisa
Commits
35d23134
Commit
35d23134
authored
2 years ago
by
Katja Goltsova
Committed by
Viktor Kunčak
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Simplify binders parsing
parent
fe46ea4a
No related branches found
Branches containing commit
No related tags found
4 merge requests
!62
Easy tactics
,
!58
Easy tactics
,
!54
Front integration
,
!53
Front integration
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lisa-utils/src/main/scala/lisa/utils/Parser.scala
+11
-11
11 additions, 11 deletions
lisa-utils/src/main/scala/lisa/utils/Parser.scala
with
11 additions
and
11 deletions
lisa-utils/src/main/scala/lisa/utils/Parser.scala
+
11
−
11
View file @
35d23134
...
@@ -222,26 +222,26 @@ object Parser {
...
@@ -222,26 +222,26 @@ object Parser {
}
}
)
)
def
getBinderFormulaConstructor
(
binders
:
Seq
[
BinderLabel
~
VariableLabel
])
:
Formula
=>
Formula
=
binders
match
{
case
Seq
()
=>
f
=>
f
case
(
binder
~
boundVar
)
+:
rest
=>
f
=>
BinderFormula
(
binder
,
boundVar
,
getBinderFormulaConstructor
(
rest
)(
f
))
}
// consume binders and return a function that constructs a BinderFormula given the inner formula
// consume binders and return a function that constructs a BinderFormula given the inner formula
val
binder
s
:
Syntax
[
Formula
=>
Formula
]
=
many
(
accept
(
BinderKind
)
{
val
binder
:
Syntax
[
(
BinderLabel
,
VariableLabel
)]
=
(
accept
(
BinderKind
)
{
case
ExistsToken
=>
Exists
case
ExistsToken
=>
Exists
case
ExistsOneToken
=>
ExistsOne
case
ExistsOneToken
=>
ExistsOne
case
ForallToken
=>
Forall
case
ForallToken
=>
Forall
}
~
accept
(
FunctionOrPredicateKind
)
{
}
~
accept
(
FunctionOrPredicateKind
)
{
case
ConstantToken
(
id
)
=>
VariableLabel
(
id
)
case
ConstantToken
(
id
)
=>
VariableLabel
(
id
)
case
SchematicToken
(
id
)
=>
VariableLabel
(
id
)
case
SchematicToken
(
id
)
=>
VariableLabel
(
id
)
}
~
elem
(
DotKind
).
unit
(
DotToken
).
skip
)
map
getBinderFormulaConstructor
}
~
elem
(
DotKind
).
unit
(
DotToken
).
skip
)
map
{
case
b
~
v
=>
(
b
,
v
)
}
lazy
val
formula
:
Syntax
[
Formula
]
=
recursive
{
lazy
val
formula
:
Syntax
[
Formula
]
=
recursive
{
(
binders
~
connectorFormula
~
opt
(
toplevelConnector
~
connectorFormula
))
map
{
case
binderFormulaConstructor
~
f
~
rest
=>
(
many
(
binder
)
~
connectorFormula
~
opt
(
toplevelConnector
~
connectorFormula
))
map
{
case
binders
~
f
~
rest
=>
rest
match
{
val
inner
=
rest
match
{
case
Some
(
conn
~
f2
)
=>
binderFormulaConstructor
(
ConnectorFormula
(
conn
,
Seq
(
f
,
f2
)))
case
Some
(
conn
~
f2
)
=>
ConnectorFormula
(
conn
,
Seq
(
f
,
f2
))
case
None
=>
binderFormulaConstructor
(
f
)
case
None
=>
f
}
binders
.
foldRight
(
inner
)
{
case
((
binder
,
v
),
f
)
=>
BinderFormula
(
binder
,
v
,
f
)
}
}
}
}
}
}
...
...
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