diff options
Diffstat (limited to 'test')
77 files changed, 293 insertions, 290 deletions
diff --git a/test/accumbt2.lm b/test/accumbt2.lm index 4d4761a7..66024e6d 100644 --- a/test/accumbt2.lm +++ b/test/accumbt2.lm @@ -43,7 +43,7 @@ parse Two: accum_bt::two( AccumBt )[ stdin ] send AccumBt->OneParser ['\n'] eos print( ^Two ) -print( ^( AccumBt->OneParser->tree ) '\n' ) +print( ^( AccumBt->OneParser->tree ), '\n' ) ##### IN ##### a b c d e ; ##### EXP ##### diff --git a/test/accumbt3.lm b/test/accumbt3.lm index 61d9a22c..2d666360 100644 --- a/test/accumbt3.lm +++ b/test/accumbt3.lm @@ -13,7 +13,7 @@ lex token open_paren /'('/ { parse_stop NC: nested_comment[ input ] - print( 'discarding: ' NC '\n' ) + print( 'discarding: ', NC, '\n' ) } end @@ -87,8 +87,8 @@ send AccumBt->NestedParser [] eos Nested: nested = AccumBt->NestedParser->tree print( '\n------------\n' ) -print( ^Nested '\n' ) -print( ^Two '\n' ) +print( ^Nested, '\n' ) +print( ^Two, '\n' ) ##### IN ##### hello there ( (this is a nested comment /*sdf asd_++_stuff) ) and this is not ; diff --git a/test/binary1.lm b/test/binary1.lm index c9819158..f484c136 100644 --- a/test/binary1.lm +++ b/test/binary1.lm @@ -45,11 +45,11 @@ token RR_UNKNOWN elsif rr_type_value == 16 id = typeid<RR_TXT> - input->push( make_token( id '' ) ) + input->push( make_token( id, '' ) ) } # Convert two octets in network order into an unsigned 16 bit value. -int network_uord16( o1: octet o2: octet ) +int network_uord16( o1: octet, o2: octet ) { return o1.data.uord8() * 256 + o2.data.uord8() } @@ -99,7 +99,7 @@ def count count: int [octet octet] { - lhs.count = network_uord16( r1 r2 ) + lhs.count = network_uord16( r1, r2 ) } # @@ -139,7 +139,7 @@ def count_inc } else { Int: int = pop( CL ) Int = Int - 1 - push( CL Int ) + push( CL, Int ) } } @@ -211,7 +211,7 @@ token nb_empty /''/ token nbytes_data /''/ { - input->push( make_token( typeid<nbytes_data> input->pull(nbytes) ) ) + input->push( make_token( typeid<nbytes_data>, input->pull(nbytes) ) ) } def nbytes @@ -266,14 +266,14 @@ def resource_record def rr_type [octet octet] { - rr_type_value = network_uord16( r1 r2 ) + rr_type_value = network_uord16( r1, r2 ) } def rr_class value: int [octet octet] { - rr_class_value = network_uord16( r1 r2 ) + rr_class_value = network_uord16( r1, r2 ) } def ttl @@ -282,13 +282,13 @@ def ttl token rdata_bytes /''/ { - input->push( make_token( typeid<rdata_bytes> input->pull(rdata_length) ) ) + input->push( make_token( typeid<rdata_bytes>, input->pull(rdata_length) ) ) } def rdlength [octet octet] { - rdata_length = network_uord16( r1 r2 ) + rdata_length = network_uord16( r1, r2 ) } rdata_length: int @@ -443,8 +443,8 @@ int print_RR_A( s: start ) { for I:rdata in s { if match I [RR_A o1:octet o2:octet o3:octet o4:octet] { - print( 'RR_A: ' o1.data.uord8() '.' o2.data.uord8() '.' - o3.data.uord8() '.' o4.data.uord8() '\n' ) + print[ 'RR_A: ' o1.data.uord8() '.' o2.data.uord8() '.' + o3.data.uord8() '.' o4.data.uord8() '\n' ] } } } @@ -454,19 +454,19 @@ struct name_map_el map_el<int> el end -int print_name( n: name m: map<int name_map_el> ) +int print_name( n: name, m: map<int, name_map_el> ) { for P: name_part in n { match P [part_len D:nbytes] - print( D '.' ) + print( D, '.' ) } for E:name_end in n { if match E [o1:octet o2:octet] { val: int = (o1.data.uord8() - 192) * 256 + o2.data.uord8() - print( '[' val ']' ) + print( '[', val, ']' ) nameInMap: name_map_el = m->find( val ) - print_name( nameInMap->Name m ) + print_name( nameInMap->Name, m ) } } } @@ -474,7 +474,7 @@ int print_name( n: name m: map<int name_map_el> ) int print_all_names( s: start ) { for M: message in s { - m: map<int name_map_el> = new map<int name_map_el>() + m: map<int, name_map_el> = new map<int, name_map_el>() O: octet = octet in M @@ -494,7 +494,7 @@ int print_all_names( s: start ) } for I: name in M { - print_name( I m ) + print_name( I, m ) print( '\n' ) } } @@ -517,7 +517,7 @@ int pop( L: list<binary::int_el> ) return Top->Int } -int push( L: list<binary::int_el> Int: int ) +int push( L: list<binary::int_el>, Int: int ) { Top: binary::int_el = new binary::int_el() Top->Int = Int diff --git a/test/call1.lm b/test/call1.lm index d7244809..51fa0ab5 100644 --- a/test/call1.lm +++ b/test/call1.lm @@ -1,4 +1,4 @@ -int f1( i: int j: int ) +int f1( i: int, j: int ) { return i + j } @@ -6,9 +6,9 @@ int f1( i: int j: int ) int main() { print( f1( - f1( f1( 1 1 ) f1( 1 1 ) ) - f1( f1( 1 1 ) f1( 1 1 ) ) - ) '\n' ) + f1( f1( 1, 1 ), f1( 1, 1 ) ), + f1( f1( 1, 1 ), f1( 1, 1 ) ) + ), '\n' ) } main() diff --git a/test/commitbt.lm b/test/commitbt.lm index 5182873e..16bf5aca 100644 --- a/test/commitbt.lm +++ b/test/commitbt.lm @@ -92,7 +92,7 @@ token item { M: str = input->pull(match_length) parse_stop S: sub[input] - input->push( make_token( typeid<item> M S ) ) + input->push( make_token( typeid<item>, M, S ) ) } def stuff diff --git a/test/concat1.lm b/test/concat1.lm index 87083349..b657ff50 100644 --- a/test/concat1.lm +++ b/test/concat1.lm @@ -51,7 +51,7 @@ start parseTxt( T: str ) return A->tree } -item* concatItems( IL1: item* IL2: item* ) +item* concatItems( IL1: item*, IL2: item* ) { for IL: item* in IL1 { if match IL [] { @@ -76,7 +76,7 @@ item* expandIncludes( ItemList: ref<item*> ) match S [em_item* `%% IncludedItems: item*] - IL = concatItems( IncludedItems Rest ) + IL = concatItems( IncludedItems, Rest ) } } } diff --git a/test/concat2.lm b/test/concat2.lm index e97398fd..0967a60b 100644 --- a/test/concat2.lm +++ b/test/concat2.lm @@ -51,7 +51,7 @@ start parseTxt( T: str ) return A->tree } -item* concatItems( IL1: item* IL2: item* ) +item* concatItems( IL1: item*, IL2: item* ) { for IL: item* in IL1 { if match IL [] { @@ -76,7 +76,7 @@ item* expandIncludes( ItemList: ref<item*> ) match S [em_item* `%% IncludedItems: item*] - IL = concatItems( IncludedItems Rest ) + IL = concatItems( IncludedItems, Rest ) } } } diff --git a/test/constructex.lm b/test/constructex.lm index 1ac52d83..21f7c7c1 100644 --- a/test/constructex.lm +++ b/test/constructex.lm @@ -31,8 +31,8 @@ NameTag1: tag = construct tag NameTag2: tag = construct tag "<name type=person>[^Val]</name>" -print( NameTag1 '\n' ) -print( NameTag2 '\n' ) +print( NameTag1, '\n' ) +print( NameTag2, '\n' ) ##### IN ##### <person name=adrian hometown=kingston> diff --git a/test/context1.lm b/test/context1.lm index 855a76fc..7844fd48 100644 --- a/test/context1.lm +++ b/test/context1.lm @@ -20,7 +20,7 @@ context ctx i = 0 j = i + 1 k = j + 1 - print( k '\n' ) + print( k, '\n' ) } def start diff --git a/test/context2.lm b/test/context2.lm index b933a99f..9521c194 100644 --- a/test/context2.lm +++ b/test/context2.lm @@ -33,7 +33,7 @@ context ruby_here input->push( $ROL ) # Send the here_id token. Attach the heredoc data as an attribute. - input->push( make_token( typeid<here_id> HereId HereData ) ) + input->push( make_token( typeid<here_id>, HereId, HereData ) ) } end @@ -43,11 +43,11 @@ context ruby_here { if match_text == HereId + '\n' { input->push( make_token( - typeid<here_close_id> + typeid<here_close_id>, input->pull( match_length ) ) ) } else - input->push( make_token( typeid<here_line> input->pull(match_length) ) ) + input->push( make_token( typeid<here_line>, input->pull(match_length) ) ) } token here_line diff --git a/test/context3.lm b/test/context3.lm index 031eca17..21444075 100644 --- a/test/context3.lm +++ b/test/context3.lm @@ -26,7 +26,7 @@ context ctx f() f() f() - print( i '\n' ) + print( i, '\n' ) } diff --git a/test/counting1.lm b/test/counting1.lm index b295474b..8bfac630 100644 --- a/test/counting1.lm +++ b/test/counting1.lm @@ -79,11 +79,11 @@ context counting { for List:counted_list in lhs { match List [Count:number Items:count_items] - print( 'num items: ' Count.data.atoi() '\n' ) + print( 'num items: ', Count.data.atoi(), '\n' ) i: int = 1 for Item:item in Items { - print( ' item ' i ': ' ^Item '\n' ) + print( ' item ', i, ': ', ^Item, '\n' ) i = i + 1 } } diff --git a/test/counting2.lm b/test/counting2.lm index 94ad897b..76c4fd07 100644 --- a/test/counting2.lm +++ b/test/counting2.lm @@ -70,11 +70,11 @@ def start { for List: counted_list in lhs { match List [CountItems:count_items] - print( 'num items: ' CountItems.target '\n' ) + print( 'num items: ', CountItems.target, '\n' ) i: int = 1 for Item:item in CountItems { - print( ' item ' i ': ' ^Item '\n' ) + print( ' item ', i, ': ', ^Item, '\n' ) i = i + 1 } } diff --git a/test/counting3.lm b/test/counting3.lm index c5f1e691..a45fc779 100644 --- a/test/counting3.lm +++ b/test/counting3.lm @@ -38,7 +38,7 @@ context counting { count = 0 target = r1.data.atoi() - print( 'target: ' target '\n' ) + print( 'target: ', target, '\n' ) } # Arbitrary item. @@ -66,7 +66,7 @@ context counting def counted_list [get_target count_items] { - print( 'trying: ' count ' for: ' target '\n' ) + print( 'trying: ', count, ' for: ', target, '\n' ) if count < target { reject } @@ -79,11 +79,11 @@ context counting for List: counted_list in lhs { match List [Count: number Items: count_items] - print( 'num items: ' Count.data.atoi() '\n' ) + print( 'num items: ', Count.data.atoi(), '\n' ) i: int = 1 for Item: item in Items { - print( ' item ' i ': ' ^Item '\n' ) + print( ' item ', i, ': ', ^Item, '\n' ) i = i + 1 } } diff --git a/test/counting4.lm b/test/counting4.lm index f79f8f92..5f8c8602 100644 --- a/test/counting4.lm +++ b/test/counting4.lm @@ -39,7 +39,7 @@ context counting { count = 0 target = r1.data.atoi() - print( 'target: ' target '\n' ) + print( 'target: ', target, '\n' ) } # Arbitrary item. @@ -75,11 +75,11 @@ context counting { for List: counted_list in lhs { match List [Count: number Items: count_items] - print( 'num items: ' Count.data.atoi() '\n' ) + print( 'num items: ', Count.data.atoi(), '\n' ) i: int = 1 for Item: item in Items { - print( ' item ' i ': ' ^Item '\n' ) + print( ' item ', i, ': ', ^Item, '\n' ) i = i + 1 } } diff --git a/test/decl1.lm b/test/decl1.lm index c78250bb..23d79199 100644 --- a/test/decl1.lm +++ b/test/decl1.lm @@ -1,4 +1,4 @@ Int: int = 7 -print( Int '\n' ) +print( Int, '\n' ) ##### EXP ##### 7 diff --git a/test/decl2.lm b/test/decl2.lm index 780e88cc..0bd20886 100644 --- a/test/decl2.lm +++ b/test/decl2.lm @@ -1,4 +1,4 @@ Str: str = '77' -print( Str '\n' ) +print( Str, '\n' ) ##### EXP ##### 77 diff --git a/test/div.lm b/test/div.lm index f6e3613c..4a647e13 100644 --- a/test/div.lm +++ b/test/div.lm @@ -1,7 +1,7 @@ i: int = 0 while ( i < 34 ) { - print( (i / 4) '\n' ) + print( (i / 4), '\n' ) i = i + 1 } ##### EXP ##### diff --git a/test/exit4.lm b/test/exit4.lm index 075520f5..afef2296 100644 --- a/test/exit4.lm +++ b/test/exit4.lm @@ -664,13 +664,13 @@ OutputFile: str = '/dev/stdout' InputFile: str = '/dev/stdin' Lang: str = 'c' -Input: stream = open( InputFile "r" ) -Output: stream = open( OutputFile "w" ) +Input: stream = open( InputFile, "r" ) +Output: stream = open( OutputFile, "w" ) RagelTree: start = parse start[ Input ] if ( !RagelTree ) { - print( error '\n' ) + print( error, '\n' ) exit(1) } diff --git a/test/exit5.lm b/test/exit5.lm index 5273d9e0..c6d4336d 100644 --- a/test/exit5.lm +++ b/test/exit5.lm @@ -664,13 +664,13 @@ OutputFile: str = '/dev/stdout' InputFile: str = '/dev/stdin' Lang: str = 'c' -Input: stream = open( InputFile "r" ) -Output: stream = open( OutputFile "w" ) +Input: stream = open( InputFile, "r" ) +Output: stream = open( OutputFile, "w" ) RagelTree: start = parse start[ Input ] if ( !RagelTree ) { - print( error '\n' ) + print( error, '\n' ) exit(1) } diff --git a/test/exit6.lm b/test/exit6.lm index a87f4383..5e20118a 100644 --- a/test/exit6.lm +++ b/test/exit6.lm @@ -664,13 +664,13 @@ OutputFile: str = '/dev/stdout' InputFile: str = '/dev/stdin' Lang: str = 'c' -Input: stream = open( InputFile "r" ) -Output: stream = open( OutputFile "w" ) +Input: stream = open( InputFile, "r" ) +Output: stream = open( OutputFile, "w" ) RagelTree: start = parse start[ Input ] if ( !RagelTree ) { - print( error '\n' ) + print( error, '\n' ) exit(1) } diff --git a/test/factor2.lm b/test/factor2.lm index e4bfc3f2..08c688da 100644 --- a/test/factor2.lm +++ b/test/factor2.lm @@ -1,3 +1,3 @@ -print( 77 '\n' ) +print( 77, '\n' ) ##### EXP ##### 77 diff --git a/test/factor3.lm b/test/factor3.lm index 33893f32..2ed2a6b7 100644 --- a/test/factor3.lm +++ b/test/factor3.lm @@ -1,2 +1,2 @@ -open( 'x' ('r') ) +open( 'x', 'r' ) ##### EXP ##### diff --git a/test/factor5.lm b/test/factor5.lm index d5cb26c8..87d1a9e3 100644 --- a/test/factor5.lm +++ b/test/factor5.lm @@ -1,5 +1,5 @@ A: argv_el = argv->pop() -print( A->value '\n' ) +print( A->value, '\n' ) ##### ARGS ##### a ##### EXP ##### diff --git a/test/forloop1.lm b/test/forloop1.lm index db0d9e6f..37b378e7 100644 --- a/test/forloop1.lm +++ b/test/forloop1.lm @@ -9,7 +9,7 @@ def start parse P: start[stdin] Start: start = P for Id: id in Start - print( ^Id '\n' ) + print( ^Id, '\n' ) ##### IN ##### a b c ##### EXP ##### diff --git a/test/forloop2.lm b/test/forloop2.lm index 3684138b..63120eee 100644 --- a/test/forloop2.lm +++ b/test/forloop2.lm @@ -9,7 +9,7 @@ def start parse P: start[stdin] Start: start = P for Id: id in triter(Start) - print( ^Id '\n' ) + print( ^Id, '\n' ) ##### IN ##### d e f ##### EXP ##### diff --git a/test/func2.lm b/test/func2.lm index 6063d02a..ee773e2a 100644 --- a/test/func2.lm +++ b/test/func2.lm @@ -1,8 +1,8 @@ -int f( I: int Str: str ) +int f( I: int, Str: str ) { - print( I ' ' Str '\n' ) + print( I, ' ', Str, '\n' ) } -f( 50 'hello world' ) +f( 50, 'hello world' ) ##### EXP ##### 50 hello world diff --git a/test/func4.lm b/test/func4.lm index 7411f7e3..66c96284 100644 --- a/test/func4.lm +++ b/test/func4.lm @@ -18,7 +18,7 @@ def b A: a [] -void func2( K: int L: int A: ref<a> I: int J: int ) +void func2( K: int, L: int, A: ref<a>, I: int, J: int ) { A.I = 77 #exit( 0 ) @@ -29,7 +29,7 @@ void func1() { cons B: b[] B.A = cons a[] - func2( 33 44 B.A 55 66 ) + func2( 33, 44, B.A, 55, 66 ) print "[B.A.I] } diff --git a/test/generate1.lm b/test/generate1.lm index b6a1a5b3..18042bd5 100644 --- a/test/generate1.lm +++ b/test/generate1.lm @@ -80,7 +80,7 @@ context generate { # Need to shorten to take off the newline. # Turn it into ignore. - input->push_ignore( make_token( typeid<WS> input->pull(match_length - 1) ) ) + input->push_ignore( make_token( typeid<WS>, input->pull(match_length - 1) ) ) } # Find and ignore comments. @@ -88,7 +88,7 @@ context generate / '#' [^\n]* '\n' / { # Need to shorten to take off the newline. Turn it into ignore. - input->push_ignore( make_token( typeid<WS> input->pull(match_length - 1) ) ) + input->push_ignore( make_token( typeid<WS>, input->pull(match_length - 1) ) ) } # These tokens are generated @@ -101,7 +101,7 @@ context generate /'\n' [ \t]*/ { # We have squared up INDENTs and DEDENTs. Ignore the entire match. - input->push_ignore( make_token( typeid<WS> input->pull(match_length) ) ) + input->push_ignore( make_token( typeid<WS>, input->pull(match_length) ) ) # We have already sent the newline, compute the indentation level. data_length: int = match_length - 1 @@ -110,7 +110,7 @@ context generate if data_length > Top->Int { # The indentation level is more than the level on the top # of the stack. This is an indent event. Send as an INDENT. - input->push( make_token( typeid<INDENT> '' ) ) + input->push( make_token( typeid<INDENT>, '' ) ) # Push to the stack as per python manual. IntEl: int_el = new int_el() @@ -125,7 +125,7 @@ context generate IndentStack->pop() # Send as a DEDENT - input->push( make_token( typeid<DEDENT> '' ) ) + input->push( make_token( typeid<DEDENT>, '' ) ) Top = IndentStack->top } @@ -135,7 +135,7 @@ context generate # means the outdent does not match anything. # First the newline. - input->push( make_token( typeid<NEWLINE> '' ) ) + input->push( make_token( typeid<NEWLINE>, '' ) ) } end @@ -527,22 +527,22 @@ end # generate int print_stmts( S: generate::start ) { for Stmt: generate::statement in S - print( 'STMT: ' ^Stmt '\n' ) + print[ 'STMT: ' ^Stmt '\n' ] } int print_target_subscriptions_and_slicings( Start: generate::start ) { for TI: generate::target_ext in Start { if match TI [generate::subscription] { - print( 'TARGET SUBSCRIPTION: ' ^TI '\n' ) + print[ 'TARGET SUBSCRIPTION: ' ^TI '\n' ] } if match TI [generate::simple_slicing] { - print( 'TARGET SIMPLE SLICING: ' ^TI '\n' ) + print[ 'TARGET SIMPLE SLICING: ' ^TI '\n' ] } if match TI [generate::extended_slicing] { - print( 'TARGET EXTENDED SLICING: ' ^TI '\n' ) + print[ 'TARGET EXTENDED SLICING: ' ^TI '\n' ] } } @@ -552,15 +552,15 @@ int print_primary_subscriptions_and_slicings( Start: generate::start ) { for PI: generate::primary_ext in Start { if match PI [generate::subscription] { - print( 'PRIMARY SUBSCRIPTION: ' ^PI '\n' ) + print[ 'PRIMARY SUBSCRIPTION: ' ^PI '\n' ] } if match PI [generate::simple_slicing] { - print( 'PRIMARY SIMPLE SLICING: ' ^PI '\n' ) + print[ 'PRIMARY SIMPLE SLICING: ' ^PI '\n' ] } if match PI [generate::extended_slicing] { - print( 'PRIMARY EXTENDED SLICING: ' ^PI '\n' ) + print[ 'PRIMARY EXTENDED SLICING: ' ^PI '\n' ] } } } @@ -578,9 +578,9 @@ Generate->newline_sent = 0 parse S: generate::start(Generate)[ stdin ] -print( '*** SUCCESS ***\n' ) -print( ^S '\n' ) -print( '***\n' ) +print[ '*** SUCCESS ***\n' ] +print[ ^S '\n' ] +print[ '***\n' ] print_stmts( S ) print_target_subscriptions_and_slicings( S ) print_primary_subscriptions_and_slicings( S ) diff --git a/test/generate2.lm b/test/generate2.lm index d7827a5b..d8f9d248 100644 --- a/test/generate2.lm +++ b/test/generate2.lm @@ -6,7 +6,7 @@ context generate list_el el end - open_item new_open_item( type: str num: int ) + open_item new_open_item( type: str, num: int ) { OI: open_item = new open_item() OI->type = type @@ -23,11 +23,11 @@ context generate { input->pull( match_length ) - OI: open_item = new_open_item( '{' match_length ) + OI: open_item = new_open_item( '{', match_length ) OpenStack->push( OI ) i: int = 0 while ( i < match_length ) { - input->push( make_token( typeid<ocurly> '{' ) ) + input->push( make_token( typeid<ocurly>, '{' ) ) i = i + 1 } } @@ -49,11 +49,11 @@ context generate length = Top->num if ( length == 1 ) - input->push( make_token( typeid<ccurly1> input->pull( 1 ) ) ) + input->push( make_token( typeid<ccurly1>, input->pull( 1 ) ) ) else if ( length == 2 ) - input->push( make_token( typeid<ccurly2> input->pull( 2 ) ) ) + input->push( make_token( typeid<ccurly2>, input->pull( 2 ) ) ) else if ( length == 3 ) - input->push( make_token( typeid<ccurly3> input->pull( 3 ) ) ) + input->push( make_token( typeid<ccurly3>, input->pull( 3 ) ) ) Top->num = Top->num - length @@ -61,18 +61,18 @@ context generate OpenStack->push( Top ) } else { - input->push( make_token( typeid<stray_close> input->pull( match_length ) ) ) + input->push( make_token( typeid<stray_close>, input->pull( match_length ) ) ) } } token osquare /'['+/ { input->pull( match_length ) - OI: open_item = new_open_item( '[' match_length ) + OI: open_item = new_open_item( '[', match_length ) OpenStack->push( OI ) i: int = 0 while ( i < match_length ) { - input->push( make_token( typeid<osquare> '[' ) ) + input->push( make_token( typeid<osquare>, '[' ) ) i = i + 1 } } @@ -93,9 +93,9 @@ context generate length = Top->num if ( length == 1 ) - input->push( make_token( typeid<csquare1> input->pull( 1 ) ) ) + input->push( make_token( typeid<csquare1>, input->pull( 1 ) ) ) else if ( length == 2 ) - input->push( make_token( typeid<csquare2> input->pull( 2 ) ) ) + input->push( make_token( typeid<csquare2>, input->pull( 2 ) ) ) Top->num = Top->num - length @@ -103,7 +103,7 @@ context generate OpenStack->push( Top ) } else { - input->push( make_token( typeid<stray_close> input->pull( match_length ) ) ) + input->push( make_token( typeid<stray_close>, input->pull( match_length ) ) ) } } @@ -117,14 +117,14 @@ context generate if ( Top->type == '{' ) { i = 0 while ( i < Top->num ) { - input->push( make_token( typeid<missing_curly> '}' ) ) + input->push( make_token( typeid<missing_curly>, '}' ) ) i = i + 1 } } else if ( Top->type == '[' ) { i = 0 while ( i < Top->num ) { - input->push( make_token( typeid<missing_square> ']' ) ) + input->push( make_token( typeid<missing_square>, ']' ) ) i = i + 1 } } @@ -203,17 +203,17 @@ end # generate Generate: generate = new generate() Generate->OpenStack = new list<generate::open_item>() -Sentinal: generate::open_item = new_open_item( '** SENTINAL **' 1 ) +Sentinal: generate::open_item = new_open_item( '** SENTINAL **', 1 ) Generate->OpenStack->push( Sentinal ) parse S: generate::start(Generate)[stdin] if S { for I: generate::external_link in S - print( 'EXTERNAL LINK: ' I '\n' ) + print[ 'EXTERNAL LINK: ' I '\n' ] for I: generate::internal_link in S - print( 'INTERNAL LINK: ' I '\n' ) + print[ 'INTERNAL LINK: ' I '\n' ] } ##### IN ##### [external] diff --git a/test/heredoc.lm b/test/heredoc.lm index e3463ede..4dd4d8c6 100644 --- a/test/heredoc.lm +++ b/test/heredoc.lm @@ -11,11 +11,11 @@ context heredoc { if HereId && HereId == match_text { input->push( make_token( - typeid<here_close> + typeid<here_close>, input->pull(match_length - 1) ) ) } else { - input->push( make_token( typeid<id> input->pull(match_length) ) ) + input->push( make_token( typeid<id>, input->pull(match_length) ) ) } } diff --git a/test/ignore3.lm b/test/ignore3.lm index d8ea0a79..29ebd9d4 100644 --- a/test/ignore3.lm +++ b/test/ignore3.lm @@ -32,9 +32,9 @@ if ( ! Start ) { } for I: item in Start { - print( 'item: .' I '.\n' ) + print[ 'item: .' I '.\n' ] if match I [ O: `( Inner: inner C: `) ] - print( 'innr: .' O '.' Inner '.' C '.\n' ) + print[ 'innr: .' O '.' Inner '.' C '.\n' ] } ##### IN ##### diff --git a/test/ignore4.lm b/test/ignore4.lm index ea05aba3..893d9f62 100644 --- a/test/ignore4.lm +++ b/test/ignore4.lm @@ -43,12 +43,12 @@ end # lang parse Input: lang::start[ stdin ] if ! Input - print( error '\n' ) + print[ error '\n' ] else { #print( Input.tree '\n' ) for H: lang::statement in Input { require H [ lang::`# hash::hash ] - print( '--' H '==\n' ) + print[ '--' H '==\n' ] } } ##### IN ##### diff --git a/test/ignore5.lm b/test/ignore5.lm index 217cbc8f..859a97b0 100644 --- a/test/ignore5.lm +++ b/test/ignore5.lm @@ -30,9 +30,9 @@ if ( ! Start ) { } for I: item in Start { - print( 'item: .' I '.\n' ) + print[ 'item: .' I '.\n' ] if match I [ O: `( Inner: inner C: `) ] - print( 'innr: .' O '.' Inner '.' C '.\n' ) + print[ 'innr: .' O '.' Inner '.' C '.\n' ] } ##### IN ##### diff --git a/test/inpush1.lm b/test/inpush1.lm index f2cec2ff..07d89f51 100644 --- a/test/inpush1.lm +++ b/test/inpush1.lm @@ -56,10 +56,10 @@ namespace lang if ( H ) { if ( H.Inc ) { FN: str = unquote( H.Inc ) - print( 'opening ' FN '\n' ) - IS: stream = open( FN 'r' ) + print[ 'opening ' FN '\n' ] + IS: stream = open( FN, 'r' ) if ( ! IS ) { - print( 'ERROR: failed to open ' FN '\n' ) + print[ 'ERROR: failed to open ' FN '\n' ] exit(1) } input->push_stream( IS ) @@ -68,10 +68,10 @@ namespace lang else { parse_stop L: rest_of_line[ input ] if ! L { - print( "ERROR: stuck: " error ) + print[ "ERROR: stuck: " error ] exit(1) } - print( "ERROR: failed to parse # directive: " L ) + print[ "ERROR: failed to parse # directive: " L ] } } end @@ -91,9 +91,9 @@ end # lang parse Input: lang::start[ stdin ] if ! Input - print( error '\n' ) + print[ error '\n' ] else { - print( Input ) + print[ Input ] } ##### IN ##### diff --git a/test/lhs1.lm b/test/lhs1.lm index e5230155..c6afbad7 100644 --- a/test/lhs1.lm +++ b/test/lhs1.lm @@ -31,7 +31,7 @@ def start | [B item* SEMI_NL] parse Start: start[ stdin ] -print( Start "\n" ) +print( Start, "\n" ) ##### IN ##### a b c ( d1 d2 ) e f g ; ##### EXP ##### diff --git a/test/liftattrs.lm b/test/liftattrs.lm index 08b216e1..67cba2c2 100644 --- a/test/liftattrs.lm +++ b/test/liftattrs.lm @@ -71,7 +71,7 @@ for AttrListIter:attr_list in RootItemList { IL = construct item_list ["<wrapper " ^CollectedAttrs ">" ^RootItemList "</wrapper>"] -print( ^IL '\n' ) +print( ^IL, '\n' ) ##### IN ##### <t1 a=b foo=bar1 c=d> <t2 foo=bar2 e=f></t2> diff --git a/test/list2.lm b/test/list2.lm index e603bdbb..cb45007d 100644 --- a/test/list2.lm +++ b/test/list2.lm @@ -3,7 +3,7 @@ struct el map_el<str> el end -new M: map<str el>() +new M: map<str, el>() for AE: argv_el in argv { print "[AE->value] diff --git a/test/lookup1.lm b/test/lookup1.lm index d1cb0034..9925dee3 100644 --- a/test/lookup1.lm +++ b/test/lookup1.lm @@ -28,7 +28,7 @@ context lookup end alias map_list_lang_object - map<str map_list_lang_object_el> + map<str, map_list_lang_object_el> # # Data types for global data. @@ -104,7 +104,7 @@ context lookup # # Lookup the token in the members of an object. - lang_object lookupInObject( obj: lang_object name: str ) + lang_object lookupInObject( obj: lang_object, name: str ) { # LOG print( ' looking in ', obj->name, '\n' ) @@ -119,9 +119,9 @@ context lookup # Lookup in an object and all the objects beneath it in the inheritance # tree. - lang_object lookupWithInheritance( obj: lang_object name: str ) + lang_object lookupWithInheritance( obj: lang_object, name: str ) { - found: lang_object = lookupInObject( obj name ) + found: lang_object = lookupInObject( obj, name ) if found return found @@ -137,7 +137,7 @@ context lookup } # Otherwise look inside the inherited object. - found = lookupWithInheritance( inh name ) + found = lookupWithInheritance( inh, name ) if found return found @@ -155,7 +155,7 @@ context lookup localTemplateParamNs: list_lang_object = templateParamNs TemplParaObjIter: list_lang_object_el = localTemplateParamNs->tail while ( TemplParaObjIter ) { - found = lookupWithInheritance( TemplParaObjIter->Obj name ) + found = lookupWithInheritance( TemplParaObjIter->Obj, name ) if found break TemplParaObjIter = TemplParaObjIter->prev @@ -166,7 +166,7 @@ context lookup # and going up through the lookup parents. lookupIn: lang_object = lookupNs->tail->Obj while lookupIn { - found = lookupWithInheritance( lookupIn name ) + found = lookupWithInheritance( lookupIn, name ) if found break lookupIn = lookupIn->lookupParent @@ -235,7 +235,7 @@ context lookup qualNs->tail->Obj = nil # Lookup using the qualification. - found = lookupWithInheritance( qualObj name ) + found = lookupWithInheritance( qualObj, name ) } else { # No qualification, full search. @@ -248,11 +248,12 @@ context lookup if found id = found->typeId - LookupId: lookup_id = make_token( typeid<lookup_id> input->pull(match_length) ) + LookupId: lookup_id = make_token( typeid<lookup_id>, + input->pull(match_length) ) LookupId.obj = found LookupId.qualObj = qualObj - input->push( make_tree( id LookupId ) ) + input->push( make_tree( id, LookupId ) ) } # Floats. @@ -292,7 +293,7 @@ context lookup lookupParent: lang_object specializationOf: lang_object - lang_object createLangObject( typeId: int name: str lookupParent: lang_object ) + lang_object createLangObject( typeId: int, name: str, lookupParent: lang_object ) { Obj: lang_object = new lang_object() @@ -307,7 +308,7 @@ context lookup } # Building the language object tree. - int insertObject( definedIn: lang_object name: str obj: lang_object ) + int insertObject( definedIn: lang_object, name: str, obj: lang_object ) { ol: map_list_lang_object_el = definedIn->objectMap->find( name ) if !ol { @@ -322,7 +323,7 @@ context lookup ol->List->push_tail( E ) } - lang_object findClass( inObj: lang_object lang_objectname: str ) + lang_object findClass( inObj: lang_object, lang_objectname: str ) { ol: map_list_lang_object_el = inObj->objectMap->find( name ) if ol { @@ -338,7 +339,7 @@ context lookup return nil } - lang_object findTemplateClass( inObj: lang_object name: str ) + lang_object findTemplateClass( inObj: lang_object, name: str ) { ol: map_list_lang_object_el = inObj->objectMap->find( name ) if ol { @@ -716,9 +717,9 @@ context lookup parentObj = Id.qualObj # Look for the class in the given scope. - declaredClass: lang_object = findClass( parentObj name ) + declaredClass: lang_object = findClass( parentObj, name ) if !declaredClass - declaredClass = findTemplateClass( parentObj name ) + declaredClass = findTemplateClass( parentObj, name ) if !declaredClass { # LOG print( 'creating new class: ', name, '\n' ) @@ -726,13 +727,13 @@ context lookup # Class does not exist in the parent scope, create it. nsType: int = declaredClassType() - declaredClass = createLangObject( nsType name lookupNs->tail->Obj ) + declaredClass = createLangObject( nsType, name, lookupNs->tail->Obj ) # FIXME: handle friends. Make the class visible only if we are NOT # in a friend declaration. The new class object is necessary to # properly process the body of the class. if declarationData->tail->isFriend == 0 - insertObject( parentObj name declaredClass ) + insertObject( parentObj, name, declaredClass ) } } @@ -745,8 +746,8 @@ context lookup # TODO: should look for existing enums of the same name. Id: lookup_id = lookup_id in r3 # LOG print( 'creating enumeration ' Id.data '\n' ) - enum: lang_object = createLangObject( EnumType Id.data lookupNs->tail->Obj ) - insertObject( declNs->tail->Obj Id.data enum ) + enum: lang_object = createLangObject( EnumType, Id.data, lookupNs->tail->Obj ) + insertObject( declNs->tail->Obj, Id.data, enum ) } def decl_specifier_mult_seq_opt @@ -815,8 +816,8 @@ context lookup # TODO: should look for existing enums of the same name. Id: lookup_id = lookup_id in r3 # LOG print( 'creating enumeration ' Id.data '\n' ) - enum: lang_object = createLangObject( EnumType Id.data lookupNs->tail->Obj ) - insertObject( declNs->tail->Obj Id.data enum ) + enum: lang_object = createLangObject( EnumType, Id.data, lookupNs->tail->Obj ) + insertObject( declNs->tail->Obj, Id.data, enum ) } | [`enum `{ enumerator_list_opt `}] @@ -844,15 +845,15 @@ context lookup [enumerator_id] { Id: lookup_id = lookup_id in r1 - enumId: lang_object = createLangObject( IdType Id.data lookupNs->tail->Obj ) - insertObject( declNs->tail->Obj Id.data enumId ) + enumId: lang_object = createLangObject( IdType, Id.data, lookupNs->tail->Obj ) + insertObject( declNs->tail->Obj, Id.data, enumId ) } | [enumerator_id `= constant_expression] { Id: lookup_id = lookup_id in r1 - enumId: lang_object = createLangObject( IdType Id.data lookupNs->tail->Obj ) - insertObject( declNs->tail->Obj Id.data enumId ) + enumId: lang_object = createLangObject( IdType, Id.data, lookupNs->tail->Obj ) + insertObject( declNs->tail->Obj, Id.data, enumId ) } def enumerator_id @@ -1149,7 +1150,8 @@ context lookup def compound_begin [] { - newCompound: lang_object = createLangObject( 0 '<compound_begin>' lookupNs->tail->Obj ) + newCompound: lang_object = createLangObject( 0, + '<compound_begin>', lookupNs->tail->Obj ) E1: list_lang_object_el = new list_lang_object_el() E1->Obj = newCompound lookupNs->push_tail( E1 ) @@ -1290,9 +1292,9 @@ context lookup obj: lang_object = nil if name && !isConstructor && declarationData->tail->isFriend == 0 { if declarationData->tail->isTypedef { - obj = createLangObject( TypedefType name lookupNs->tail->Obj ) + obj = createLangObject( TypedefType, name, lookupNs->tail->Obj ) obj->typedefOf = declarationData->tail->typeObj - insertObject( parentObj name obj ) + insertObject( parentObj, name, obj ) # LOG print( 'making declarator ' name ' a typedef\n' ) } @@ -1301,16 +1303,16 @@ context lookup if declarationData->tail->isTemplate { # If in a template declaration and the name is not qualified then # create the template id. - obj = createLangObject( TemplateIdType name lookupNs->tail->Obj ) + obj = createLangObject( TemplateIdType, name, lookupNs->tail->Obj ) #object->objType = declarationData.tail.type - insertObject( declNs->tail->Obj name obj ) + insertObject( declNs->tail->Obj, name, obj ) # LOG print( 'making declarator ' name ' a template id\n' ) } else { - obj = createLangObject( IdType name lookupNs->tail->Obj ) + obj = createLangObject( IdType, name, lookupNs->tail->Obj ) #object->objType = declarationData.tail().type; - insertObject( declNs->tail->Obj name obj ) + insertObject( declNs->tail->Obj, name, obj ) # LOG print( 'making declarator ' name ' an id\n' ) } @@ -1453,7 +1455,8 @@ context lookup { if !declaratorData->tail->pdcScope { # We are going to need a scope for the declarator. - pdcScope: lang_object = createLangObject( 0 '<pdc_scope>' lookupNs->tail->Obj ) + pdcScope: lang_object = createLangObject( 0, + '<pdc_scope>', lookupNs->tail->Obj ) E1: list_lang_object_el = new list_lang_object_el() E1->Obj = pdcScope @@ -1545,8 +1548,8 @@ context lookup def function_body_begin [] { - newFunctionBody: lang_object = createLangObject( 0 - '<function_body_begin>' lookupNs->tail->Obj ) + newFunctionBody: lang_object = createLangObject( 0, + '<function_body_begin>', lookupNs->tail->Obj ) E1: list_lang_object_el = new list_lang_object_el() E1->Obj = newFunctionBody @@ -1611,8 +1614,8 @@ context lookup nsType: int = declaredClassType() # LOG print( 'creating new anonymous class\n' ) - newClass: lang_object = createLangObject( nsType - '<anon_class>' lookupNs->tail->Obj ) + newClass: lang_object = createLangObject( nsType, + '<anon_class>', lookupNs->tail->Obj ) E1: list_lang_object_el = new list_lang_object_el() E1->Obj = newClass @@ -1634,9 +1637,9 @@ context lookup parentObj = Id.qualObj # Look for the class in the given scope. - declaredClass: lang_object = findClass( parentObj name ) + declaredClass: lang_object = findClass( parentObj, name ) if !declaredClass - declaredClass = findTemplateClass( parentObj name ) + declaredClass = findTemplateClass( parentObj, name ) if !declaredClass { # LOG print( 'creating new class: ' name '\n' ) @@ -1644,13 +1647,13 @@ context lookup # Class does not exist in the parent scope, create it. nsType: int = declaredClassType() - declaredClass = createLangObject( nsType name lookupNs->tail->Obj ) + declaredClass = createLangObject( nsType, name, lookupNs->tail->Obj ) # FIXME: handle friends. Make the class visible only if we are NOT # in a friend declaration. The new class object is necessary to # properly process the body of the class. if declarationData->tail->isFriend == 0 - insertObject( parentObj name declaredClass ) + insertObject( parentObj, name, declaredClass ) } # Push the found/new class. @@ -1679,10 +1682,10 @@ context lookup if !declaredClass { # LOG print( 'making new template specialization\n' ) nsType: int = declaredClassType() - declaredClass = createLangObject( nsType id lookupNs->tail->Obj ) + declaredClass = createLangObject( nsType, id, lookupNs->tail->Obj ) # LOG print( 'declaredClass: ' declaredClass '\n' ) declaredClass->specializationOf = classObj - # $$->typeListMapEl = classObj->typeListMap.insert( typeList declaredClass ); + # $$->typeListMapEl = classObj->typeListMap.insert( typeList, declaredClass ); } # Push the found/new class. @@ -1799,14 +1802,14 @@ context lookup { obj: lang_object = r2.lookupId.obj if obj - insertObject( declNs->tail->Obj obj->name obj ) + insertObject( declNs->tail->Obj, obj->name, obj ) } | [`using type_id `;] { obj: lang_object = r2.lookupId.obj if obj - insertObject( declNs->tail->Obj obj->name obj ) + insertObject( declNs->tail->Obj, obj->name, obj ) } def using_directive @@ -1842,7 +1845,7 @@ context lookup [base_specifier_list `, base_specifier] | [base_specifier] - int addBaseSpecifier( inObject: lang_object inheritedObject: lang_object ) + int addBaseSpecifier( inObject: lang_object, inheritedObject: lang_object ) { # Resolve typedefs. if inheritedObject->typeId == TypedefType @@ -1856,17 +1859,17 @@ context lookup def base_specifier [root_qual_opt nested_name_specifier_opt type_name] { - addBaseSpecifier( declNs->tail->Obj r3.lookupId.obj ) + addBaseSpecifier( declNs->tail->Obj, r3.lookupId.obj ) } | [`virtual access_specifier_opt root_qual_opt nested_name_specifier_opt type_name] { - addBaseSpecifier( declNs->tail->Obj r5.lookupId.obj ) + addBaseSpecifier( declNs->tail->Obj, r5.lookupId.obj ) } | [access_specifier virtual_opt root_qual_opt nested_name_specifier_opt type_name] { - addBaseSpecifier( declNs->tail->Obj r5.lookupId.obj ) + addBaseSpecifier( declNs->tail->Obj, r5.lookupId.obj ) } def virtual_opt @@ -1992,7 +1995,7 @@ context lookup { # Create a new scope for the template parameters. newTemplateParamScope: lang_object = - createLangObject( 0 '<tpl_start>' lookupNs->tail->Obj ) + createLangObject( 0, '<tpl_start>', lookupNs->tail->Obj ) E: list_lang_object_el = new list_lang_object_el() E->Obj = newTemplateParamScope @@ -2038,8 +2041,8 @@ context lookup if Id { # The lookup ns should be a template param scope. newClass: lang_object = - createLangObject( ClassType Id.data lookupNs->tail->Obj ) - insertObject( templateParamNs->tail->Obj Id.data newClass ) + createLangObject( ClassType, Id.data, lookupNs->tail->Obj ) + insertObject( templateParamNs->tail->Obj, Id.data, newClass ) } } @@ -2049,8 +2052,8 @@ context lookup if Id { # The lookup ns should be a template param scope. newClass: lang_object = - createLangObject( ClassType Id.data lookupNs->tail->Obj ) - insertObject( templateParamNs->tail->Obj Id.data newClass ) + createLangObject( ClassType, Id.data, lookupNs->tail->Obj ) + insertObject( templateParamNs->tail->Obj, Id.data, newClass ) } } @@ -2060,8 +2063,8 @@ context lookup Id: lookup_id = lookup_id in r7 if Id { newClass: lang_object = - createLangObject( TemplateClassType Id.data lookupNs->tail->Obj ) - insertObject( templateParamNs->tail->Obj Id.data newClass ) + createLangObject( TemplateClassType, Id.data, lookupNs->tail->Obj ) + insertObject( templateParamNs->tail->Obj, Id.data, newClass ) } } @@ -2120,10 +2123,10 @@ context lookup { match r2 [Id: lookup_id] nspace: lang_object = createLangObject( - NamespaceType Id.data lookupNs->tail->Obj ) + NamespaceType, Id.data, lookupNs->tail->Obj ) # Insert the new object into the dictionary of the parent. - insertObject( curNamespace->tail->Obj Id.data nspace ) + insertObject( curNamespace->tail->Obj, Id.data, nspace ) # Push the namespace E1: list_lang_object_el = new list_lang_object_el() @@ -2188,7 +2191,7 @@ context lookup def unnamed_namespace_def_name [`namespace] { nspace: lang_object = createLangObject( - NamespaceType '<unnamed_namespace>' + NamespaceType, '<unnamed_namespace>', lookupNs->tail->Obj ) # Push the namespace @@ -2260,9 +2263,9 @@ context lookup # Grammar done. # - int printObject( indent: str obj: lang_object ) + int printObject( indent: str, obj: lang_object ) { - print( indent obj->name ) + print( indent, obj->name ) if obj->objectMap->length > 0 print( ' {\n' ) @@ -2272,14 +2275,14 @@ context lookup while ( MapEl ) { El: list_lang_object_el = MapEl->List->head while ( El ) { - printObject( indent + ' ' El->Obj ) + printObject( indent + ' ', El->Obj ) El = El->next } MapEl = MapEl->next } if obj->objectMap->length > 0 - print( indent '}' ) + print( indent, '}' ) print( '\n' ) } @@ -2317,7 +2320,7 @@ Lookup->declaratorData = new lookup::list_declarator_data() Lookup->templDecl = new lookup::list_int() # Root namespace object -Lookup->rootNamespace = createLangObject( Lookup->NamespaceType '<root_namespace>' nil ) +Lookup->rootNamespace = createLangObject( Lookup->NamespaceType, '<root_namespace>', nil ) # Initialize the namespace and declaration stacks with the root namespace E1: lookup::list_lang_object_el = new lookup::list_lang_object_el() @@ -2354,13 +2357,13 @@ if ! S { } print( '***** NAMSPACES *****\n' ) -printObject( '' Lookup->rootNamespace ) +printObject( '', Lookup->rootNamespace ) print( '***** UNKNOWN DECLARATORS *****\n' ) for DI: lookup::declarator_id in S { if match DI [lookup::root_qual_opt lookup::nested_name_specifier_opt lookup::`~ UID: lookup::unknown_id] { - print( UID '\n' ) + print( UID, '\n' ) } } ##### IN ##### diff --git a/test/maketree1.lm b/test/maketree1.lm index 76aa1533..ccbcddd5 100644 --- a/test/maketree1.lm +++ b/test/maketree1.lm @@ -7,6 +7,6 @@ end def A [a b c] -print( make_tree( typeid<A> cons a "a" cons b "b" cons c "c" ) '\n' ) +print( make_tree( typeid<A>, cons a "a", cons b "b", cons c "c" ), '\n' ) ##### EXP ##### abc diff --git a/test/map1.lm b/test/map1.lm index a6bc1020..1fc7918d 100644 --- a/test/map1.lm +++ b/test/map1.lm @@ -3,7 +3,7 @@ struct el map_el<str> el end -new M: map<str el>() +new M: map<str, el>() AE: argv_el = argv->head while AE { diff --git a/test/map2.lm b/test/map2.lm index 1d3fc52c..a381fefe 100644 --- a/test/map2.lm +++ b/test/map2.lm @@ -1,10 +1,10 @@ -new M: vmap<str str>() +new M: vmap<str, str>() -M->insert( ( "hello" ) ( "friend" ) ) -M->insert( ( "one--" ) ( "num1" ) ) -M->insert( ( "two--" ) ( "num2" ) ) -M->insert( ( "three" ) ( "num3" ) ) -M->insert( ( "four-" ) ( "num4" ) ) +M->insert( "hello", "friend" ) +M->insert( "one--", "num1" ) +M->insert( "two--", "num2" ) +M->insert( "three", "num3" ) +M->insert( "four-", "num4" ) M->remove( "one--" ) diff --git a/test/map3.lm b/test/map3.lm index 7ce27bd1..15c2023c 100644 --- a/test/map3.lm +++ b/test/map3.lm @@ -1,11 +1,11 @@ -new M: vmap<str int>() +new M: vmap<str, int>() -M->insert( ( "one--" ) ( 1 ) ) -M->insert( ( "two--" ) ( 2 ) ) -M->insert( ( "three" ) ( 3 ) ) -M->insert( ( "four-" ) ( 4 ) ) -M->insert( ( "five-" ) ( 5 ) ) +M->insert( "one--", 1 ) +M->insert( "two--", 2 ) +M->insert( "three", 3 ) +M->insert( "four-", 4 ) +M->insert( "five-", 5 ) M->remove( "three" ) diff --git a/test/map4.lm b/test/map4.lm index f32c1bf4..d057ed6c 100644 --- a/test/map4.lm +++ b/test/map4.lm @@ -1,11 +1,11 @@ -new M: vmap<int str>() +new M: vmap<int, str>() -M->insert( 0 ( "hello" ) ) -M->insert( 1 ( "one" ) ) -M->insert( 2 ( "two" ) ) -M->insert( 3 ( "three" ) ) -M->insert( 4 ( "four" ) ) +M->insert( 0, "hello" ) +M->insert( 1, "one" ) +M->insert( 2, "two" ) +M->insert( 3, "three" ) +M->insert( 4, "four" ) M->remove( 3 ) diff --git a/test/map5.lm b/test/map5.lm index 2897c026..d3ad99b5 100644 --- a/test/map5.lm +++ b/test/map5.lm @@ -1,7 +1,7 @@ -new StrMap: vmap<str str>() -StrMap->insert( "hello " ("there") ) -StrMap->insert( "friend" ("how") ) -StrMap->insert( "are " ("you") ) +new StrMap: vmap<str, str>() +StrMap->insert( "hello ", "there" ) +StrMap->insert( "friend", "how" ) +StrMap->insert( "are ", "you" ) ##### EXP ##### diff --git a/test/matchex.lm b/test/matchex.lm index 28ddc5e8..3a76f83d 100644 --- a/test/matchex.lm +++ b/test/matchex.lm @@ -28,8 +28,8 @@ match Tag ["<person name=" Val1:id attr*">" item* "</person>"] # Style: Literal text with embedded lists of types. match Tag "<person name=[Val2:id attr*]>[item*]</person>" -print( ^Val1 '\n' ) -print( ^Val2 '\n' ) +print( ^Val1, '\n' ) +print( ^Val2, '\n' ) ##### IN ##### <person name=adrian hometown=kingston> diff --git a/test/nestedcomm.lm b/test/nestedcomm.lm index f25971fc..0e16f9cf 100644 --- a/test/nestedcomm.lm +++ b/test/nestedcomm.lm @@ -13,7 +13,7 @@ lex token open_paren /'('/ { parse_stop NC: nested_comment[ stdin ] - print( %NC '\n' ) + print( %NC, '\n' ) input->push_ignore( NC ) } end @@ -38,12 +38,12 @@ def nested [id*] parse P: nested[ stdin ] -print( ^P '\n' ) +print( ^P, '\n' ) print_xml( ^P ) print( '\n' ) print_xml_ac( ^P ) print( '\n' ) -print( ^P '\n' ) +print( ^P, '\n' ) ##### IN ##### hello there ( (this is a nested comment /*sdf;asd_++_stuff) ) and this is not ##### EXP ##### diff --git a/test/open1.lm b/test/open1.lm index f31fa36d..70d32c3a 100644 --- a/test/open1.lm +++ b/test/open1.lm @@ -1,7 +1,7 @@ int testOpen( Fn: str ) { - S: stream = open( Fn 'r' ) + S: stream = open( Fn, 'r' ) if ( S ) print( 'yes\n' ) diff --git a/test/open2.lm b/test/open2.lm index 311896b9..5230e8bc 100644 --- a/test/open2.lm +++ b/test/open2.lm @@ -4,18 +4,18 @@ end def d [t] -int testAppend( Fn: str Mode: str ) +int testAppend( Fn: str, Mode: str ) { - S: stream = open( Fn Mode ) + S: stream = open( Fn, Mode ) send S "colm networks S->close() } -testAppend( 'working/open2.w' ('w') ) -testAppend( 'working/open2.w' ('a') ) +testAppend( 'working/open2.w', 'w' ) +testAppend( 'working/open2.w', 'a' ) -S: stream = open( 'working/open2.w' ('r') ) +S: stream = open( 'working/open2.w', 'r' ) parse D: d [S] print( D ) diff --git a/test/parsetree1.lm b/test/parsetree1.lm index 059a5e6c..cf823536 100644 --- a/test/parsetree1.lm +++ b/test/parsetree1.lm @@ -21,7 +21,7 @@ parse Input1: start "a [Item2] c d print( Input1 ) parse_tree Input2: start "a [Item2] c d -print( Input2 "\n" ) +print( Input2, "\n" ) ######### EXP ######### a b c d NIL diff --git a/test/prints.lm b/test/prints.lm index fc9e7ff1..c4a38ca7 100644 --- a/test/prints.lm +++ b/test/prints.lm @@ -8,8 +8,8 @@ def start parse Start: start[stdin] -prints( stderr 'fd stderr: ' ^Start '\n' ) -prints( stdout 'fd stdout: ' ^Start '\n' ) +prints( stderr, 'fd stderr: ', ^Start, '\n' ) +prints( stdout, 'fd stdout: ', ^Start, '\n' ) ##### IN ##### a b c ##### EXP ##### diff --git a/test/pull1.lm b/test/pull1.lm index f3fa0319..e3eb274a 100644 --- a/test/pull1.lm +++ b/test/pull1.lm @@ -1,5 +1,5 @@ String: str = stdin->pull( 10 ) -print( String '\n' ) +print( String, '\n' ) ##### IN ##### this is input for a non-parse pull ##### EXP ##### diff --git a/test/pull2.lm b/test/pull2.lm index f9b66372..6f29434f 100644 --- a/test/pull2.lm +++ b/test/pull2.lm @@ -1,6 +1,6 @@ -Stream: stream = open( 'working/pull2.in' ('r') ) +Stream: stream = open( 'working/pull2.in', 'r' ) String: str = Stream->pull( 10 ) -print( String '\n' ) +print( String, '\n' ) ##### IN ##### this is input for a non-parse pull ##### EXP ##### diff --git a/test/rediv.lm b/test/rediv.lm index 9f9428af..a1651c17 100644 --- a/test/rediv.lm +++ b/test/rediv.lm @@ -84,7 +84,7 @@ parse S: start[ stdin ] for I:orlit_item in S { if match I [orlit_chr] { - print( I '\n' ) + print( I, '\n' ) } } print_xml( S ) diff --git a/test/ref2.lm b/test/ref2.lm index fb2f9887..50fdf7a3 100644 --- a/test/ref2.lm +++ b/test/ref2.lm @@ -14,7 +14,7 @@ def program int h( P: ref<program> ) { - print( (id in P) '\n' ) + print( (id in P), '\n' ) } int g( P: ref<program> ) diff --git a/test/ref3.lm b/test/ref3.lm index ee805b4a..45b2c8b1 100644 --- a/test/ref3.lm +++ b/test/ref3.lm @@ -52,7 +52,7 @@ int main( S: start ) main( S ) -int someRefs( S1: ref<start> S2: ref<start> S3: ref<start> S4: ref<start> ) +int someRefs( S1: ref<start>, S2: ref<start>, S3: ref<start>, S4: ref<start> ) { print( S1 ) print( S2 ) @@ -65,7 +65,7 @@ cons S2: start "c d cons S3: start "e f cons S4: start "g h -someRefs( (start in S1) (start in S2) (start in S3) (start in S4 ) ) +someRefs( start in S1, start in S2, start in S3, start in S4 ) #### IN #### x y diff --git a/test/repeat1.lm b/test/repeat1.lm index 69e0ef82..9c907ff6 100644 --- a/test/repeat1.lm +++ b/test/repeat1.lm @@ -16,10 +16,10 @@ parse Input: start[ stdin ] match Input [ItemList: item*] for I: item* in repeat( ItemList ) - print( ^I '\n' ) + print( ^I, '\n' ) for I: item* in rev_repeat( ItemList ) - print( ^I '\n' ) + print( ^I, '\n' ) ##### IN ##### a b ( c d ) e ( f g ) h i ##### EXP ##### diff --git a/test/repeat2.lm b/test/repeat2.lm index cd10bb7e..12809d09 100644 --- a/test/repeat2.lm +++ b/test/repeat2.lm @@ -220,7 +220,7 @@ def start parse Start: start[ stdin ] if ( ! Start ) { - print( error '\n' ) + print( error, '\n' ) exit( 1 ) } @@ -307,10 +307,10 @@ int printLines( Lines: line* ) print( '\\begin{center}\n' ) print( '\\includegraphics' ) if match Scale [lws Spd: word Spd2: word*] - print( '[scale=' Spd Spd2 ']' ) + print( '[scale=', Spd, Spd2, ']' ) else print( '[scale=0.55]' ) - print( '{' Name '}\n' ) + print( '{', Name, '}\n' ) print( '\\end{center}\n' ) print( '\\graphspace\n' ) } @@ -333,7 +333,7 @@ int printLines( Lines: line* ) printLines( CL ) print( '}\n' ) } - print( '\\label{' DirData '}\n' ) + print( '\\label{', DirData, '}\n' ) print( '\\end{figure}\n' ) } if match L [cmd_list LiList: li* end_list] { @@ -359,7 +359,7 @@ int printLines( Lines: line* ) for Row: row in repeat(Rows) { if match Row [cmd_row Lines: text* nl ] { printText( Lines ) - print( '\\\\' '\n' ) + print( '\\\\', '\n' ) print( '\\hline\n' ) } } @@ -437,11 +437,11 @@ print( ~\vspace*{3in} ) -print( '{\\huge ' TitleData '}\\\\\n' ) +print( '{\\huge ', TitleData, '}\\\\\n' ) print( '\\vspace*{12pt}\n' ) -print( '{\\Large ' SubTitleData '}\\\\\n' ) +print( '{\\Large ', SubTitleData, '}\\\\\n' ) print( ~\vspace{1in} @@ -449,7 +449,7 @@ print( ~\vspace{12pt} ) -print( '{\\large ' AuthorData '}\\\\\n' ) +print( '{\\large ', AuthorData, '}\\\\\n' ) print( ~\end{center} @@ -496,28 +496,28 @@ for Chapter: chapter in repeat(Chapters) { match Chapter [cmd_chapter DirData: text* nl Lines: line* SectionList: section*] - print( '\\chapter{' DirData '}\n' ) + print( '\\chapter{', DirData, '}\n' ) printLines( Lines ) for Section: section in repeat(SectionList) { match Section [cmd_section DirData: text* nl Lines: line* SubSectionList: sub_section*] - print( '\\section{' DirData '}\n' ) + print( '\\section{', DirData, '}\n' ) printLines( Lines ) for SubSection: sub_section in repeat(SubSectionList) { match SubSection [cmd_sub_section DirData: text* nl Lines: line* SubSubSectionList: sub_sub_section*] - print( '\\subsection{' DirData '}\n' ) + print( '\\subsection{', DirData, '}\n' ) printLines( Lines ) for SubSubSection: sub_sub_section in repeat(SubSubSectionList) { match SubSubSection [cmd_sub_sub_section DirData: text* nl Lines: line*] - print( '\\subsubsection{' DirData '}\n' ) + print( '\\subsubsection{', DirData, '}\n' ) printLines( Lines ) } } diff --git a/test/rhsref1.lm b/test/rhsref1.lm index 912a9600..13a2fdab 100644 --- a/test/rhsref1.lm +++ b/test/rhsref1.lm @@ -89,7 +89,7 @@ def goto_statement parse P: program[stdin] for E: expression in P { - print( ^(E.Term.Factor.Primary) '\n' ) + print( ^(E.Term.Factor.Primary), '\n' ) } ##### IN ##### diff --git a/test/rhsref2.lm b/test/rhsref2.lm index cf5b3238..621aea6b 100644 --- a/test/rhsref2.lm +++ b/test/rhsref2.lm @@ -37,7 +37,7 @@ I = 1 for AO: arg_option in P { if AO.Short - print( ^AO.Short ' ' ^AO.Func '\n' ) + print( ^AO.Short, ' ', ^AO.Func, '\n' ) I = I + 1 } diff --git a/test/rubyhere.lm b/test/rubyhere.lm index 7f29da78..09703eb8 100644 --- a/test/rubyhere.lm +++ b/test/rubyhere.lm @@ -32,7 +32,7 @@ context rubyhere input->push( $ROL ) # Send the here_id token. Attach the heredoc data as an attribute. - input->push( make_token( typeid<here_id> HereId HereData ) ) + input->push( make_token( typeid<here_id>, HereId, HereData ) ) } end @@ -42,11 +42,11 @@ context rubyhere { if match_text == HereId + '\n' { input->push( make_token( - typeid<here_close_id> + typeid<here_close_id>, input->pull( match_length ) ) ) } else - input->push( make_token( typeid<here_line> input->pull(match_length) ) ) + input->push( make_token( typeid<here_line>, input->pull(match_length) ) ) } token here_line diff --git a/test/send1.lm b/test/send1.lm index a3293142..800df9f2 100644 --- a/test/send1.lm +++ b/test/send1.lm @@ -29,7 +29,7 @@ send_tree StartParser2 "a [Item2] c d\n" eos print( StartParser1->tree ) -print( StartParser2->tree "\n" ) +print( StartParser2->tree, "\n" ) ######### EXP ######### a b c d NIL diff --git a/test/sprintf.lm b/test/sprintf.lm index a78c0d3a..41eefbb9 100644 --- a/test/sprintf.lm +++ b/test/sprintf.lm @@ -1,3 +1,3 @@ -print( sprintf( "%08x\n" (256 + 11 * 16) ) ) +print( sprintf( "%08x\n", 256 + 11 * 16 ) ) ##### EXP ##### 000001b0 diff --git a/test/superid.lm b/test/superid.lm index 6b9f2443..6b1d6f8e 100644 --- a/test/superid.lm +++ b/test/superid.lm @@ -6,7 +6,7 @@ context si token id /'a'|'b'/ { - input->push( make_token( trans_id_to input->pull(match_length) ) ) + input->push( make_token( trans_id_to, input->pull(match_length) ) ) } token super_id // @@ -20,9 +20,9 @@ context si def e1 [] { - print( 'old_id = ' trans_id_to '\n' ) + print[ 'old_id = ' trans_id_to '\n' ] trans_id_to = typeid<foo> - print( 'new_id = ' trans_id_to '\n' ) + print[ 'new_id = ' trans_id_to '\n' ] } def item1 @@ -36,9 +36,9 @@ context si def e2 [] { - print( 'old_id = ' trans_id_to '\n' ) + print[ 'old_id = ' trans_id_to '\n' ] trans_id_to = typeid<super_id> - print( 'new_id = ' trans_id_to '\n' ) + print[ 'new_id = ' trans_id_to '\n' ] } def item2 @@ -55,7 +55,7 @@ context si | [item2 SEMI_NL] { match lhs [Item2:item2 ';\n'] - print( Item2.msg ) + print[ Item2.msg ] } end # si diff --git a/test/tags2.lm b/test/tags2.lm index f93cbd45..448aafe0 100644 --- a/test/tags2.lm +++ b/test/tags2.lm @@ -159,7 +159,7 @@ for Switch:tag in S { if match Text ["<text>" TextContent:content "</text>"] { - print( ' ' TextContent '\n' ) + print( ' ', TextContent, '\n' ) } } } diff --git a/test/tags3.lm b/test/tags3.lm index 2a6a2aee..de83ea58 100644 --- a/test/tags3.lm +++ b/test/tags3.lm @@ -71,7 +71,7 @@ context tags } } - input->push( make_token( send_id input->pull(match_length) ) ) + input->push( make_token( send_id, input->pull(match_length) ) ) } end @@ -223,7 +223,7 @@ context tags for Attr: attr in AttrList { if match Attr ["href = " AttrVal: attr_val] - print( 'link: ' I '\ntarget: ' AttrVal '\n\n' ) + print( 'link: ', I, '\ntarget: ', AttrVal, '\n\n' ) } } } diff --git a/test/tags4.lm b/test/tags4.lm index b1d6b8e9..dad9bcea 100644 --- a/test/tags4.lm +++ b/test/tags4.lm @@ -85,26 +85,26 @@ context tags send_id: int = typeid<stray_close_id> if ( inTagStack( match_text ) ) { - print( 'CLOSE \'' match_text '\' IN TAG STACK\n' ) + print[ 'CLOSE \'' match_text '\' IN TAG STACK\n' ] # The tag is in the stack, send missing close tags until we get to it. match TagStack [Top:tag_id Rest:tag_stack] TagStack = Rest while ( Top.data != match_text ) { print( 'SENDING missing close\n' ) - input->push( make_token( typeid<missing_close_id> '' ) ) + input->push( make_token( typeid<missing_close_id>, '' ) ) match TagStack [Top2:tag_id Rest2:tag_stack] Top = Top2 TagStack = Rest2 } - print( 'SENDING close\n' ) - input->push( make_token( typeid<close_id> input->pull( match_length ) ) ) + print[ 'SENDING close\n' ] + input->push( make_token( typeid<close_id>, input->pull( match_length ) ) ) } else { - print( 'CLOSE \'' match_text '\' NOT IN TAG STACK\n' ) + print[ 'CLOSE \'' match_text '\' NOT IN TAG STACK\n' ] # The tag is not in the tag stack so send the id as a stray close. - input->push( make_token( typeid<stray_close> input->pull( match_length ) ) ) + input->push( make_token( typeid<stray_close>, input->pull( match_length ) ) ) } } end @@ -244,7 +244,7 @@ context tags for Attr: attr in AttrList { if match Attr ["href = " AttrVal: attr_val] - print( 'link: ' I '\ntarget: ' AttrVal '\n\n' ) + print[ 'link: ' I '\ntarget: ' AttrVal '\n\n' ] } } } diff --git a/test/tcontext1.lm b/test/tcontext1.lm index 82e39713..d1e17d2c 100644 --- a/test/tcontext1.lm +++ b/test/tcontext1.lm @@ -16,7 +16,7 @@ end token ws_no_nl /[ \t]+ [^ \t\n]/ { - input->push( make_token( typeid<ws_no_nl> input->pull(match_length-1) ) ) + input->push( make_token( typeid<ws_no_nl>, input->pull(match_length-1) ) ) } def method_call diff --git a/test/translate1.lm b/test/translate1.lm index 8a87c48b..c7c78821 100644 --- a/test/translate1.lm +++ b/test/translate1.lm @@ -4,7 +4,7 @@ lex token id /[a-zA-Z_]+/ { t: str = input->pull( match_length ) - input->push( make_token( typeid<id> t ) ) + input->push( make_token( typeid<id>, t ) ) } end diff --git a/test/translate2.lm b/test/translate2.lm index 49911e53..3833139e 100644 --- a/test/translate2.lm +++ b/test/translate2.lm @@ -22,9 +22,9 @@ context ctx token ddd /'...'/ { print('translating\n') input->pull( match_length ) - input->push( make_token( typeid<id> "dot" ) ) - input->push( make_token( typeid<id> "dot" ) ) - input->push( make_token( typeid<id> "dot" ) ) + input->push( make_token( typeid<id>, "dot" ) ) + input->push( make_token( typeid<id>, "dot" ) ) + input->push( make_token( typeid<id>, "dot" ) ) } end diff --git a/test/travs1.lm b/test/travs1.lm index 138598dd..8277e32f 100644 --- a/test/travs1.lm +++ b/test/travs1.lm @@ -140,25 +140,25 @@ iter bottomup_rightleft( T: ref<any> ) print( 'bottomup_leftright\n' ) for T1: any in bottomup_leftright( S ) { - print( ^T1 '\n' ) + print( ^T1, '\n' ) } print( 'bottomup_rightleft\n' ) for T2: any in bottomup_rightleft( S ) { - print( ^T2 '\n' ) + print( ^T2, '\n' ) } print( 'topdown_leftright\n' ) for T3: any in topdown_leftright( S ) { - print( ^T3 '\n' ) + print( ^T3, '\n' ) } print( 'topdown_rightleft\n' ) for T4: any in topdown_rightleft( S ) { - print( ^T4 '\n' ) + print( ^T4, '\n' ) } ##### IN ##### 1 | 2 3 diff --git a/test/treecmp1.lm b/test/treecmp1.lm index 23b41d51..c9666393 100644 --- a/test/treecmp1.lm +++ b/test/treecmp1.lm @@ -16,7 +16,7 @@ parse Input: four_ids[ stdin ] for Id: id in Input { if ( Id == B ) - print( B '\n' ) + print( B, '\n' ) } ##### IN ##### a b c d diff --git a/test/undofrag1.lm b/test/undofrag1.lm index 04242fb2..5fbe7df6 100644 --- a/test/undofrag1.lm +++ b/test/undofrag1.lm @@ -55,7 +55,7 @@ parse Input: ctx::start1( CTX )[stdin] send CTX->SP "{e}f g" print( Input ) -print( CTX->SP->finish() '\n' ) +print( CTX->SP->finish(), '\n' ) ##### IN ##### a b c ( d ) e f g ; diff --git a/test/undomap1.lm b/test/undomap1.lm index b4f590be..df920191 100644 --- a/test/undomap1.lm +++ b/test/undomap1.lm @@ -11,7 +11,7 @@ context undo map_el<item> el end - Map: map<item item_el> + Map: map<item, item_el> def item [id] @@ -44,7 +44,7 @@ context undo end Undo: undo = new undo() -Undo->Map = new map<undo::item undo::item_el>() +Undo->Map = new map<undo::item, undo::item_el>() parse Input: undo::start(Undo)[ stdin ] print( Input ) diff --git a/test/undomap2.lm b/test/undomap2.lm index 6c823299..8f95b3e6 100644 --- a/test/undomap2.lm +++ b/test/undomap2.lm @@ -11,7 +11,7 @@ context undo map_el<item> el end - Map: map<item item_el> + Map: map<item, item_el> def item [id] @@ -49,7 +49,7 @@ context undo end Undo: undo = new undo() -Undo->Map = new map<undo::item undo::item_el>() +Undo->Map = new map<undo::item, undo::item_el>() E: undo::item_el = new undo::item_el() E->key = cons undo::item "a" diff --git a/test/utf8.lm b/test/utf8.lm index d29d88db..3ff06ff5 100644 --- a/test/utf8.lm +++ b/test/utf8.lm @@ -19,7 +19,7 @@ def utf8_octets [utf8_char*] parse P: utf8_octets[stdin] -print(count '\n') +print(count, '\n') ##### IN ##### A≢Α. 한국어 diff --git a/test/while1.lm b/test/while1.lm index dadcfb06..c963f096 100644 --- a/test/while1.lm +++ b/test/while1.lm @@ -6,7 +6,7 @@ global I: int = 3 int f() { I = I - 1 - print( ' ' I ) + print( ' ', I ) } # simple expr and stmt @@ -19,7 +19,7 @@ I = 3 while I { I = I - 1 - print( ' ' I ) + print( ' ', I ) } print( '\n' ) @@ -40,7 +40,7 @@ I = 3 while ( I + 2 ) { I = I - 1 - print( ' ' I ) + print( ' ', I ) } print( '\n' ) ##### EXP ##### |