summaryrefslogtreecommitdiff
path: root/test/tcontext1.lm
diff options
context:
space:
mode:
Diffstat (limited to 'test/tcontext1.lm')
-rw-r--r--test/tcontext1.lm35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/tcontext1.lm b/test/tcontext1.lm
new file mode 100644
index 0000000..86db718
--- /dev/null
+++ b/test/tcontext1.lm
@@ -0,0 +1,35 @@
+##### LM #####
+
+lex
+ token tIDENTIFIER /[a-z][a-zA-Z_]*/ -ni
+ ignore /[ \t\n]+/
+ ignore comment /'#' [^\n]* '\n'/
+end
+
+lex
+ ignore /[\t ]+/
+ ignore /'#' [^\n]*/
+ literal `;
+ token NL /'\n'/
+end
+
+# Required whitespace, but newline is not allowed.
+token ws_no_nl
+ /[ \t]+ [^ \t\n]/
+ {
+ input.push( make_token( typeid<ws_no_nl> input.pull(match_length-1) ) )
+ }
+
+def method_call
+ [tIDENTIFIER ws_no_nl tIDENTIFIER `; NL]
+
+parse R: method_call[stdin]
+
+print_xml( R )
+print( '\n' )
+
+##### IN #####
+a bc;
+##### EXP #####
+<method_call><tIDENTIFIER>a</tIDENTIFIER><ws_no_nl> </ws_no_nl><tIDENTIFIER>bc</tIDENTIFIER><_literal_000b>;</_literal_000b><NL>
+</NL></method_call>