Added DefaultParser
This commit is contained in:
+1
-1
@@ -84,7 +84,7 @@ concept is_the_opposite:
|
||||
a, b
|
||||
|
||||
test:
|
||||
a.pre == not b.pre && a.post == b.post
|
||||
a.pre == not b.pre && a.post == not b.post
|
||||
|
||||
|
||||
print all concepts
|
||||
|
||||
@@ -17,4 +17,23 @@ def concept a is a number as :
|
||||
|
||||
--> adds concept a is a number
|
||||
--> add the pre condition to the concept a plus b
|
||||
```
|
||||
|
||||
# Define a new concept in one line
|
||||
```
|
||||
def concept words
|
||||
def concept words [where whereclause] [as expression] [pre precond] [post postcond]
|
||||
```
|
||||
|
||||
# Define a complicated concept
|
||||
```
|
||||
def concept
|
||||
as:
|
||||
...
|
||||
where:
|
||||
...
|
||||
pre:
|
||||
...
|
||||
post:
|
||||
...
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
```
|
||||
> "hello
|
||||
-> unfinished quote "
|
||||
> 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
|
||||
|
||||
|
||||
> when unfinished quote q as c:
|
||||
... add rule as:
|
||||
...... if q in sheerka.input:
|
||||
......... sheerka.resume(c, c.input + input)
|
||||
......... remove rule
|
||||
```
|
||||
Reference in New Issue
Block a user