Fixed parsing error with policies
diff --git a/demo.py b/demo.py
index 9addd7e..8670650 100644
--- a/demo.py
+++ b/demo.py
@@ -53,8 +53,6 @@
tests = globals()
for t in tests:
- import pdb
- pdb.set_trace()
if t.startswith('test'):
print 'parsin %s'%t
parser.parse_string(globals()[t])
diff --git a/foldemo.py b/foldemo.py
index e924e54..40b238d 100644
--- a/foldemo.py
+++ b/foldemo.py
@@ -1,16 +1,17 @@
from plyxproto.logicparser import *
import ply.lex as lex
import ply.yacc as yacc
+import pdb
-test_1 = "true"
-test_2 = "a | b"
-test_3 = "exists a: x=y"
-test_4 = "forall a: exists b: x.b=y.b"
-test_5 = "forall a: {{ a.endswith('good') }} "
+test_1 = "<true>"
+test_2 = "<a | b>"
+test_3 = "<exists a: x=y>"
+test_4 = "<forall a: exists b: x.b=y.b>"
+test_5 = "<forall a: {{ a.endswith('good') }}>"
DEBUG = 0
-lexer = lex.lex(module=FOLLexer(), debug=DEBUG)#, optimize=1)
+lexer = lex.lex(module=FOLLexer(), debug=DEBUG)
parser = yacc.yacc(module=FOLParser(), start='goal', debug=DEBUG)
for x,v in globals().items():
diff --git a/plyxproto/parser.py b/plyxproto/parser.py
index bb92c8a..08f2f91 100755
--- a/plyxproto/parser.py
+++ b/plyxproto/parser.py
@@ -268,10 +268,10 @@
# TODO: Add directives to link definition
def p_link_definition(self, p):
- '''link_definition : field_modifier link_type field_name ARROW dotname slash_name colon_fieldname EQ field_id field_directives SEMI'''
+ '''link_definition : field_modifier link_type field_name policy_opt ARROW dotname slash_name colon_fieldname EQ field_id field_directives SEMI'''
p[0] = LinkSpec(
- FieldDefinition(LU.i(p,1), Name('int32'), LU.i(p, 3), LU.i(p, 9), [FieldDirective(Name('type'), Name('link')), FieldDirective(Name('model'),LU.i(p, 5))] + srcPort(LU.i(p,7)) + LU.i(p,10)),
- LinkDefinition(LU.i(p,2), LU.i(p,3), LU.i(p,5), LU.i(p,6), LU.i(p,7)))
+ FieldDefinition(LU.i(p,1), Name('int32'), LU.i(p, 3), LU.i(p,4), LU.i(p, 10), [FieldDirective(Name('type'), Name('link')), FieldDirective(Name('model'),LU.i(p, 6))] + srcPort(LU.i(p,8)) + LU.i(p,11)),
+ LinkDefinition(LU.i(p,2), LU.i(p,3), LU.i(p,6), LU.i(p,7), LU.i(p,8)))
self.lh.set_parse_object(p[0], p)