From b8cc390e7ed724a9ad605453227d1e4686f3a11b Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 6 May 2011 22:00:54 +0200 Subject: Fixes several problems in filter syntax. - Fixes several conflicts in the grammar. - Fixes a bug in (a..b, c) pair patterns. - Makes pair patterns orthogonal. - Allows term expressions in pair patterns without additional ( ). - Allows several comma separated values in switch cases. --- filter/test.conf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'filter/test.conf') diff --git a/filter/test.conf b/filter/test.conf index b4d3400..dbb3a4e 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -1,3 +1,4 @@ + /* * This is an example configuration file. * FIXME: add all examples from docs here. @@ -36,7 +37,7 @@ int i; i = arg2; case arg1 { - one: printn "jedna, "; printn "jedna"; + 11, 1, 111: printn "jedna, "; printn "jedna"; (one+onef(2)): printn "dva, "; printn "jeste jednou dva"; (2+one) .. 5: if arg2 < 3 then printn "tri az pet"; else: printn "neco jineho"; @@ -236,8 +237,13 @@ string s; ps = [(1,(one+one)), (3,4)..(4,8), (5,*), (6,3..6)]; print "Pair set: ", ps; - print "Testing pair set, true: ", pp ~ ps, " ", (3,5) ~ ps, " ", (4,1) ~ ps, " ", (5,4) ~ ps, " ", (5,65535) ~ ps, " ", (6,4) ~ ps; - print "Testing pair set, false: ", (3,3) ~ ps, " ", (4,9) ~ ps, " ", (4,65535) ~ ps, " ", (6,2) ~ ps, " ", (6,(6+one)) ~ ps, " ", ((one+6),2) ~ ps ; + print "Testing pair set, true: ", pp ~ ps, " ", (3,5) ~ ps, " ", (4,1) ~ ps, " ", (5,4) ~ ps, " ", (5,65535) ~ ps, " ", (6,4) ~ ps, " ", (3, 10000) ~ ps; + print "Testing pair set, false: ", (3,3) ~ ps, " ", (4,9) ~ ps, " ", (4,65535) ~ ps, " ", (6,2) ~ ps, " ", (6,6+one) ~ ps, " ", ((one+6),2) ~ ps, " ", (1,1) ~ ps; + + ps = [(20..150, 200..300), (50100..50200, 1000..50000), (*, 5+5)]; + print "Pair set: .. too long .."; + print "Testing pair set, true: ", (100,200) ~ ps, " ", (150,300) ~ ps, " ", (50180,1200) ~ ps, " ", (50110,49000) ~ ps, " ", (0,10) ~ ps, " ", (64000,10) ~ ps; + print "Testing pair set, false: ", (20,199) ~ ps, " ", (151,250) ~ ps, " ", (50050,2000) ~ ps, " ", (50150,50050) ~ ps, " ", (10,9) ~ ps, " ", (65535,11) ~ ps ; qq = 1.2.3.4; print "Testinq quad: 1.2.3.4 = ", qq, -- cgit v1.2.3