Refactored to allow ConceptEvaluator
This commit is contained in:
+15
-4
@@ -1,6 +1,10 @@
|
||||
In this example, I try to think of how I can deal with errors
|
||||
```
|
||||
> "hello
|
||||
-> unfinished quote "
|
||||
|
||||
create a concept to recognize the error
|
||||
|
||||
> def concept unfinished quote q
|
||||
... where:
|
||||
...... q in ('"', '"')
|
||||
@@ -9,9 +13,16 @@
|
||||
... input = sheerka.last_input
|
||||
|
||||
|
||||
Create the rule to manage the error
|
||||
|
||||
> when unfinished quote q as c:
|
||||
... add rule as:
|
||||
...... if q in sheerka.input:
|
||||
... add rule r as:
|
||||
...... if q is last of sheerka.input:
|
||||
......... sheerka.resume(c, c.input + input)
|
||||
......... remove rule
|
||||
```
|
||||
......... remove r
|
||||
|
||||
def concept a is last of b as:
|
||||
where b is list
|
||||
as b[-1] == a
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user