Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
ab1b3d63
Commit
ab1b3d63
authored
13 years ago
by
Adam Radziszewski
Browse files
Options
Downloads
Patches
Plain Diff
iter semantics: always sets iter var to nowhere if False is returned
parent
aa21c93f
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libwccl/ops/functions/bool/iteration.cpp
+1
-4
1 addition, 4 deletions
libwccl/ops/functions/bool/iteration.cpp
tests/data/crossing.ccl
+55
-0
55 additions, 0 deletions
tests/data/crossing.ccl
with
56 additions
and
4 deletions
libwccl/ops/functions/bool/iteration.cpp
+
1
−
4
View file @
ab1b3d63
...
...
@@ -25,11 +25,8 @@ std::ostream& Iteration::write_to(std::ostream& os) const
Iteration
::
BaseRetValPtr
Iteration
::
apply_internal
(
const
FunExecContext
&
context
)
const
{
// Set iteration variable to Nowhere
// Should be overridden if succeeded
const
boost
::
shared_ptr
<
Position
>&
iter_var
=
context
.
variables
()
->
get_fast
(
iter_var_acc_
);
iter_var
->
set_value
(
Position
::
Nowhere
);
const
SentenceContext
&
sc
=
context
.
sentence_context
();
// Proceed only if range extremes are not "nowhere".
const
boost
::
shared_ptr
<
const
Position
>&
range_left
=
...
...
@@ -48,7 +45,7 @@ Iteration::BaseRetValPtr Iteration::apply_internal(const FunExecContext& context
}
}
}
// Failure.
Make sure
iteration variable
points
Nowhere and return False
// Failure.
Set
iteration variable
to
Nowhere and return False
iter_var
->
set_value
(
Position
::
Nowhere
);
return
Predicate
::
False
(
context
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/data/crossing.ccl
+
55
−
0
View file @
ab1b3d63
...
...
@@ -36,3 +36,58 @@ only(1, 0, $It, False)
True
It=nowhere
---
and(setvar($It,2), rlook(0, 1, $It, True))
True
It=0
---
and(setvar($It,2), llook(1, 0, $It, True))
True
It=1
---
and(setvar($It,2), rlook(1, 0, $It, True))
False
It=nowhere
---
and(setvar($It,2), llook(0, 1, $It, True))
False
It=nowhere
---
and(setvar($It,2), only(0, 1, $It, True))
True
It=1
---
and(setvar($It,2), only(1, 0, $It, True))
True
It=2
---
and(setvar($It,2), only(1, 0, $It, False))
True
It=2
---
and(setvar($It,2), only(0, 1, $It, False))
False
It=nowhere
---
and(setvar($It,6), atleast(0, 3, $It, inside($It), 2))
True
It=1
---
and(setvar($It,6), atleast(3, 0, $It, inside($It), 2))
False
It=nowhere
---
and(setvar($It,6), atleast(0, 3, $It, inside($It), 7))
False
It=nowhere
---
This diff is collapsed.
Click to expand it.
Preview
0%
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