summaryrefslogtreecommitdiff
path: root/test/ignore1.lm
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-05-20 16:13:59 -0400
committerAdrian Thurston <thurston@complang.org>2012-05-20 16:13:59 -0400
commitf2dd7e712221e4c5b379e748578cf9648a0cf7d6 (patch)
treed78f963c4aa0db591d6907d30dd47f7c16bc773a /test/ignore1.lm
parent600af732eb8d0e655ad2a2a450e998106ffab0c6 (diff)
downloadcolm-f2dd7e712221e4c5b379e748578cf9648a0cf7d6.tar.gz
tests useful on the no-kf-dupign branch
These tests are helpful when testing the no-kf-dupign branch.
Diffstat (limited to 'test/ignore1.lm')
-rw-r--r--test/ignore1.lm54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/ignore1.lm b/test/ignore1.lm
new file mode 100644
index 00000000..ebf7413f
--- /dev/null
+++ b/test/ignore1.lm
@@ -0,0 +1,54 @@
+
+#
+# Regular Definitions
+#
+rl rl_ws /[.+ \t\n\r\v]+/
+rl rl_id /[a-zA-Z_][a-zA-Z0-9_]*/
+
+#
+# Tokens
+#
+
+lex start
+{
+ literal '=', '<', '>', '/'
+
+ # Ignore whitespace.
+ ignore /rl_ws/
+
+ # Open and close id
+ token id /rl_id/
+}
+
+#
+# Productions
+#
+
+def attr [id '=' id]
+
+def attr_list
+ [attr_list attr]
+| []
+
+def open_tag
+ ['<' id attr_list '>']
+
+def close_tag
+ ['<' '/' id '>']
+
+def tag
+ [open_tag item_list close_tag]
+
+def item_list
+ [item_list tag]
+| []
+
+parse Attrs: attr_list( stdin )
+
+print( Attrs '\n' )
+
+## Reconstruct the left hand side with the
+construct IL: item_list
+ ["<wrapper .[Attrs]. ></wrapper>"]
+
+print( IL '\n' )