From 9b6006286b0de94880d44d708acb3394df28ad42 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Fri, 20 May 2011 21:19:56 +0000 Subject: Can now capture (declare) variables in construct and parse statements. Name: goes right after the keyword in the expression. refs #290. --- test/backtrack1.lm | 2 +- test/backtrack2.lm | 2 +- test/context2.lm | 4 ++-- test/dns.lm | 6 +++--- test/rubyhere.lm | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/backtrack1.lm b/test/backtrack1.lm index 2485544e..2ad62ad8 100644 --- a/test/backtrack1.lm +++ b/test/backtrack1.lm @@ -19,6 +19,6 @@ def E def start [E] -S: start = parse start( stdin ) +parse S: start( stdin ) R: start = match S ~ 9 + 9 print_xml( R ) diff --git a/test/backtrack2.lm b/test/backtrack2.lm index fd06ad77..9b166fbe 100644 --- a/test/backtrack2.lm +++ b/test/backtrack2.lm @@ -20,5 +20,5 @@ def prods def start [prods] -S: start = parse start( stdin ) +parse S: start( stdin ) print_xml( match S "!aa bb cc dd" ) diff --git a/test/context2.lm b/test/context2.lm index 4f6ba2be..9f985341 100644 --- a/test/context2.lm +++ b/test/context2.lm @@ -26,10 +26,10 @@ context ruby_here HereId = input.pull( match_length ) # Get the data up to the rest of the line. - ROL: rest_of_line = parse_stop rest_of_line( ctx input ) + parse_stop ROL: rest_of_line( ctx input ) # Parse the heredoc data. - HereData: here_data = parse_stop here_data( ctx input ) + parse_stop HereData: here_data( ctx input ) # Push the rest-of-line data back to the input stream. input.push( $ROL ) diff --git a/test/dns.lm b/test/dns.lm index f0fa305f..0528242e 100644 --- a/test/dns.lm +++ b/test/dns.lm @@ -459,7 +459,7 @@ int print_name( n: name m: name_map ) int print_all_names( s: start ) { for M: message in s { - m: name_map = construct name_map [] + construct m: name_map [] O: octet = octet in M @@ -467,9 +467,9 @@ int print_all_names( s: start ) match N [name_part* E:name_end] for NP: name_part* in N { - if match NP [L:octet nbytes name_part*] { + if match NP [L: octet nbytes name_part*] { messageOffset: int = L.pos - O.pos - n: name = construct name [NP E] + construct n: name [NP E] m.insert( messageOffset n ) } } diff --git a/test/rubyhere.lm b/test/rubyhere.lm index 2587ecd9..e91fb916 100644 --- a/test/rubyhere.lm +++ b/test/rubyhere.lm @@ -24,10 +24,10 @@ lex here_start HereId = input.pull( match_length ) # Get the data up to the rest of the line. - ROL: rest_of_line = parse_stop rest_of_line( stdin ) + parse_stop ROL: rest_of_line( stdin ) # Parse the heredoc data. - HereData: here_data HereData = parse_stop here_data( stdin ) + parse_stop HereData: here_data( stdin ) # Push the rest-of-line data back to the input stream. input.push( $ROL ) -- cgit v1.2.1