summaryrefslogtreecommitdiffstats
path: root/tests/008
diff options
context:
space:
mode:
Diffstat (limited to 'tests/008')
-rw-r--r--tests/008/configfile28
-rw-r--r--tests/008/configfile.expected4
-rw-r--r--tests/008/configfile.txr24
3 files changed, 56 insertions, 0 deletions
diff --git a/tests/008/configfile b/tests/008/configfile
new file mode 100644
index 00000000..d7400606
--- /dev/null
+++ b/tests/008/configfile
@@ -0,0 +1,28 @@
+# This is a configuration file in standard configuration file format
+#
+# Lines begininning with a hash or a semicolon are ignored by the application
+# program. Blank lines are also ignored by the application program.
+
+# This is the fullname parameter
+FULLNAME Foo Barber
+
+# This is a favourite fruit
+FAVOURITEFRUIT banana
+
+# This is a boolean that should be set
+NEEDSPEELING
+
+# This boolean is commented out
+; SEEDSREMOVED
+
+# Configuration option names are not case sensitive, but configuration parameter
+# data is case sensitive and may be preserved by the application program.
+
+# An optional equals sign can be used to separate configuration parameter data
+# from the option name. This is dropped by the parser.
+
+# A configuration option may take multiple parameters separated by commas.
+# Leading and trailing whitespace around parameter names and parameter data fields
+# are ignored by the application program.
+
+OTHERFAMILY Rhu Barber, Harry Barber
diff --git a/tests/008/configfile.expected b/tests/008/configfile.expected
new file mode 100644
index 00000000..10dca68a
--- /dev/null
+++ b/tests/008/configfile.expected
@@ -0,0 +1,4 @@
+FULLNAME = Foo Barber;
+FAVOURITEFRUIT = banana;
+NEEDSPEELING = true;
+OTHERFAMILY = { Rhu Barber, Harry Barber };
diff --git a/tests/008/configfile.txr b/tests/008/configfile.txr
new file mode 100644
index 00000000..257fdc07
--- /dev/null
+++ b/tests/008/configfile.txr
@@ -0,0 +1,24 @@
+@(collect)
+@ (cases)
+#@/.*/
+@ (or)
+;@/.*/
+@ (or)
+@{IDENT /[A-Z_][A-Z_0-9]+/}@/ */
+@(bind VAL ("true"))
+@ (or)
+@{IDENT /[A-Z_][A-Z_0-9]+/}@(coll)@/ */@{VAL /[^,]+/}@/ */@(end)
+@ (or)
+@{IDENT /[A-Z_][A-Z_0-9]+/}@(coll)@/ */@{VAL /[^, ]+/}@/,? */@(end)
+@(flatten VAL)
+@ (or)
+@/ */
+@ (or)
+@ (throw error "bad configuration syntax")
+@ (end)
+@(end)
+@(output)
+@ (repeat)
+@IDENT = @(rep)@VAL, @(first){ @VAL, @(last)@VAL };@(single)@VAL;@(end)
+@ (end)
+@(end)