summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Makefile.am9
-rw-r--r--test/TESTS1
-rw-r--r--test/ignore3.exp9
-rw-r--r--test/ignore3.in2
-rw-r--r--test/ignore3.lm29
-rw-r--r--test/order2.lm7
-rwxr-xr-xtest/runtests.mk14
7 files changed, 64 insertions, 7 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 33923305..c983fc9a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -78,7 +78,8 @@ TEST_CASES = \
concat1.lm \
concat2.lm \
ignore1.lm \
- ignore2.lm
+ ignore2.lm \
+ ignore3.lm
INPUT = \
ambig1.in \
@@ -145,7 +146,8 @@ INPUT = \
concat1.in \
concat2.in \
ignore1.in \
- ignore2.in
+ ignore2.in \
+ ignore3.in
EXPECTED_OUTPUT = \
ambig1.exp \
@@ -225,6 +227,7 @@ EXPECTED_OUTPUT = \
concat1.exp \
concat2.exp \
ignore1.exp \
- ignore2.exp
+ ignore2.exp \
+ ignore3.exp
EXTRA_DIST = genmf TESTS runtests.mk $(TEST_CASES) $(INPUT) $(EXPECTED_OUTPUT)
diff --git a/test/TESTS b/test/TESTS
index c97c41c3..bdb2fe75 100644
--- a/test/TESTS
+++ b/test/TESTS
@@ -81,4 +81,5 @@ TESTS="
concat2.lm
ignore1.lm
ignore2.lm
+ ignore3.lm
"
diff --git a/test/ignore3.exp b/test/ignore3.exp
new file mode 100644
index 00000000..4ffc4944
--- /dev/null
+++ b/test/ignore3.exp
@@ -0,0 +1,9 @@
+item: .a .
+item: .b .
+item: .c .
+item: .( d ) .
+innr: .( .d .) .
+item: .e .
+item: .f .
+item: .g.
+
diff --git a/test/ignore3.in b/test/ignore3.in
new file mode 100644
index 00000000..803aad41
--- /dev/null
+++ b/test/ignore3.in
@@ -0,0 +1,2 @@
+a b c ( d ) e f g;
+
diff --git a/test/ignore3.lm b/test/ignore3.lm
new file mode 100644
index 00000000..9e072eb7
--- /dev/null
+++ b/test/ignore3.lm
@@ -0,0 +1,29 @@
+lex start
+{
+ ignore /space+/
+ literal '*', '(', ')', '!', ';'
+ token id /[a-zA-Z_0-9]+/
+}
+
+lex inner
+{
+ ignore /space+/
+ token inner /[a-zA-Z_0-9]+/
+}
+
+def item
+ [id]
+| ['(' inner* ')']
+
+def start
+ [item* ';']
+
+parse Start: start( stdin )
+
+for I: item in Start {
+ print( 'item: .' %I '.\n' )
+ if match I [ O: '(' Inner: inner* C: ')' ]
+ print( 'innr: .' %O '.' %Inner '.' %C '.\n' )
+}
+print( '\n' )
+
diff --git a/test/order2.lm b/test/order2.lm
index 8f45a17f..917524e9 100644
--- a/test/order2.lm
+++ b/test/order2.lm
@@ -6,7 +6,7 @@ lex c_token_list
token sym / ';' | ',' | '=' | '(' | ')' | ':' | '&' | '*' |
'[' | ']' | '~' | '+' | '-' | '/' | '<' | '>' | '|' |
- '^' | '%' | '!' | '?' | '.' | '#'/
+ '^' | '!' | '?' | '.' | '#'/
# Identifiers
token c_id /( [a-zA-Z_] [a-zA-Z0-9_]* )/
@@ -31,8 +31,11 @@ def c_token_list
| [c_token]
# Can parse this, use ful for single constructs.
+#def c
+# [c_token*]
+
def c
- [c_token*]
+ [c_token_list]
lex start
{
diff --git a/test/runtests.mk b/test/runtests.mk
index ee051811..3d5a788b 100755
--- a/test/runtests.mk
+++ b/test/runtests.mk
@@ -79,7 +79,8 @@ TESTS = \
concat1.lm \
concat2.lm \
ignore1.lm \
- ignore2.lm
+ ignore2.lm \
+ ignore3.lm
DIFFS = \
ambig1.diff \
@@ -158,7 +159,8 @@ DIFFS = \
concat1.diff \
concat2.diff \
ignore1.diff \
- ignore2.diff
+ ignore2.diff \
+ ignore3.diff
all: runtests.mk $(DIFFS) $(SUBDIRS)
@@ -791,3 +793,11 @@ ignore2.out: ignore2.bin
ignore2.bin: ignore2.lm ./../colm/colm
./../colm/colm ignore2.lm
+ignore3.diff: ignore3.out ignore3.exp
+ @diff -u ignore3.exp ignore3.out > ignore3.diff || ( cat ignore3.diff; rm ignore3.diff )
+
+ignore3.out: ignore3.bin
+ ./ignore3.bin < ignore3.in > ignore3.out
+
+ignore3.bin: ignore3.lm ./../colm/colm
+ ./../colm/colm ignore3.lm