29 lines
597 B
Markdown
29 lines
597 B
Markdown
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 ('"', '"')
|
|
... desc:
|
|
...... "Error detected by the default parser where the trailing quote is missing"
|
|
... input = sheerka.last_input
|
|
|
|
|
|
Create the rule to manage the error
|
|
|
|
> when unfinished quote q as c:
|
|
... add rule r as:
|
|
...... if q is last of sheerka.input:
|
|
......... sheerka.resume(c, c.input + input)
|
|
......... remove r
|
|
|
|
def concept a is last of b as:
|
|
where b is list
|
|
as b[-1] == a
|
|
```
|
|
|