Support for invoking one policy from another
diff --git a/foldemo.py b/foldemo.py
index 40b238d..8035f85 100644
--- a/foldemo.py
+++ b/foldemo.py
@@ -8,6 +8,7 @@
test_3 = "<exists a: x=y>"
test_4 = "<forall a: exists b: x.b=y.b>"
test_5 = "<forall a: {{ a.endswith('good') }}>"
+test_6 = "< *doit(foo) >"
DEBUG = 0
diff --git a/plyxproto/logicparser.py b/plyxproto/logicparser.py
index 30b1bf6..c778448 100644
--- a/plyxproto/logicparser.py
+++ b/plyxproto/logicparser.py
@@ -11,13 +11,14 @@
class FOLLexer(object):
keywords = ('forall', 'exists', 'True', 'False', 'not', 'in')
- tokens = ['STRING_LITERAL', 'NUM', 'ESCAPE', 'COLON', 'IMPLIES', 'OR', 'AND', 'LPAREN', 'RPAREN', 'EQUALS', 'SYMBOL', 'LT', 'RT'] + [k.upper() for k in keywords]
+ tokens = ['STRING_LITERAL', 'NUM', 'ESCAPE', 'COLON', 'IMPLIES', 'OR', 'AND', 'LPAREN', 'RPAREN', 'EQUALS', 'SYMBOL', 'LT', 'RT', 'STAR'] + [k.upper() for k in keywords]
# literals = '()+-*/=?:,.^|&~!=[]{};<>@%'
t_ignore_LINE_COMMENT = '//.*'
t_COLON = '\\:'
t_IMPLIES = '\\-\\>'
t_OR = '\\|'
+ t_STAR = '\\*'
t_LT = '\\<'
t_RT = '\\>'
t_AND = '\\&'
@@ -47,7 +48,7 @@
t.lexer.lineno += t.value.count('\n')
def t_SYMBOL(self, t):
- '[A-Za-z_$][\.A-Za-z2-9_+$]*(\(\))?'
+ '[A-Za-z_$][\.A-Za-z0-9_+$]*(\(\))?'
if t.value in FOLLexer.keywords:
t.type = t.value.upper()
return t
@@ -80,6 +81,10 @@
| TRUE'''
p[0] = p[1]
+ def p_term_policy_function(self, p):
+ '''term : STAR SYMBOL LPAREN SYMBOL RPAREN'''
+ p[0] = {'policy': [p[2], p[4]]}
+
def p_fole_not(self, p):
'''fole : NOT fole'''
p[0] = {p[1]: p[2]}
diff --git a/setup.py b/setup.py
index 2a0a2fe..f600b8d 100644
--- a/setup.py
+++ b/setup.py
@@ -10,7 +10,7 @@
from setuptools import setup
setup(name='plyxproto',
- version='2.1.0',
+ version='2.2.0',
description='xproto parser and processor',
author='Dusan Klinec (original protobuf parser), Sapan Bhatia (xproto extensions)',
author_email='sapan@opennetworking.org',