summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-05-15 22:05:07 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-05-15 22:05:07 +0200
commit13cc62c244a35fefe3c6995ad16a09275b984f8d (patch)
tree0d4d82b2fd2224586420231582eb6271155c7ec3
parent53f1b9251440b263d1605b86090e71cf09f6aad1 (diff)
Support a | b notation for DCGs
-rw-r--r--prolog/parser.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/prolog/parser.py b/prolog/parser.py
index 8fe96da..1b0459b 100644
--- a/prolog/parser.py
+++ b/prolog/parser.py
@@ -22,6 +22,7 @@ from .util import Token
# PARSER
precedence = (
('nonassoc', 'FROM', 'FROMDCG'),
+ ('right', 'PIPE'),
('right', 'IMPLIES'),
('right', 'NOT'),
('nonassoc', 'EQU', 'NEQU', 'EQ', 'NEQ', 'UNIV', 'IS', 'EQA', 'NEQA', 'LT', 'LE', 'GT', 'GE', 'LTL', 'LEL', 'GTL', 'GEL', 'IN', 'INS', 'THROUGH', 'EQFD', 'NEQFD', 'LTFD', 'LEFD', 'GTFD', 'GEFD'),
@@ -32,7 +33,7 @@ precedence = (
('nonassoc', 'UINTEGER', 'UREAL'),
('nonassoc', 'NAME', 'VARIABLE', 'STRING'),
('nonassoc', 'PERIOD'),
- ('nonassoc', 'LBRACKET', 'RBRACKET', 'LPAREN', 'RPAREN', 'COMMA', 'SEMI', 'PIPE', 'LBRACE', 'RBRACE')
+ ('nonassoc', 'LBRACKET', 'RBRACKET', 'LPAREN', 'RPAREN', 'COMMA', 'SEMI', 'LBRACE', 'RBRACE')
)
def make_token(p, n):
@@ -137,6 +138,7 @@ def p_term_binary(p):
| term GTL term
| term GEL term
+ | term PIPE term
| term THROUGH term
| term IN term
| term INS term