From cb322af633c68f437730d3c09919ee6797360b9f Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Wed, 13 Jul 2011 02:31:57 +0000 Subject: Type typeid type arg now wrapped in <>. In line with map, list, etc. --- colm/lmparse.kl | 4 ++-- test/commitbt.lm | 2 +- test/context2.lm | 6 +++--- test/cxx/cxx.lm | 18 +++++++++--------- test/dns.lm | 18 +++++++++--------- test/heredoc.lm | 4 ++-- test/html/html.lm | 4 ++-- test/python/python.lm | 12 ++++++------ test/ruby/ruby.lm | 2 +- test/rubyhere.lm | 6 +++--- test/superid.lm | 4 ++-- test/translate1.lm | 2 +- test/translate2.lm | 6 +++--- 13 files changed, 44 insertions(+), 44 deletions(-) diff --git a/colm/lmparse.kl b/colm/lmparse.kl index 5ebbdbbc..65d3d5d2 100644 --- a/colm/lmparse.kl +++ b/colm/lmparse.kl @@ -1735,10 +1735,10 @@ code_factor: KW_ParseStop opt_capture type_ref '(' opt_code_expr_list ')' } }; -code_factor: KW_TypeId type_ref +code_factor: KW_TypeId '<' type_ref '>' final { $$->expr = new LangExpr( new LangTerm( $1->loc, - LangTerm::TypeIdType, $2->typeRef ) ); + LangTerm::TypeIdType, $3->typeRef ) ); }; code_factor: type_ref KW_In var_ref final { diff --git a/test/commitbt.lm b/test/commitbt.lm index 9131ebf4..28503d7f 100644 --- a/test/commitbt.lm +++ b/test/commitbt.lm @@ -100,7 +100,7 @@ token item { M: str = input.pull(match_length) S: sub = parse_stop sub(input) - input.push( make_token( typeid item M S ) ) + input.push( make_token( typeid M S ) ) } token EOL /'\n'/ diff --git a/test/context2.lm b/test/context2.lm index 9f985341..bb2872cd 100644 --- a/test/context2.lm +++ b/test/context2.lm @@ -35,7 +35,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 HereId HereData ) ) } } @@ -46,11 +46,11 @@ context ruby_here { if match_text == HereId + '\n' { input.push( make_token( - typeid here_close_id + typeid input.pull( match_length ) ) ) } else - input.push( make_token( typeid here_line input.pull(match_length) ) ) + input.push( make_token( typeid input.pull(match_length) ) ) } token here_line diff --git a/test/cxx/cxx.lm b/test/cxx/cxx.lm index 811bd7af..e3f4aef9 100644 --- a/test/cxx/cxx.lm +++ b/test/cxx/cxx.lm @@ -34,13 +34,13 @@ def declarator_data [] # Constants for language object types. -global NamespaceType: int = typeid namespace_id -global ClassType: int = typeid class_id -global TemplateClassType: int = typeid templ_class_id -global EnumType: int = typeid enum_id -global IdType: int = typeid identifier -global TypedefType: int = typeid typedef_id -global TemplateIdType: int = typeid template_id +global NamespaceType: int = typeid +global ClassType: int = typeid +global TemplateClassType: int = typeid +global EnumType: int = typeid +global IdType: int = typeid +global TypedefType: int = typeid +global TemplateIdType: int = typeid # # Global data declarations @@ -217,11 +217,11 @@ lex start } # If no match, return an Unknown ID - id: int = typeid unknown_id + id: int = typeid if found id = found->typeId - LookupId: any = make_token( typeid lookup_id + LookupId: any = make_token( typeid input.pull(match_length) found qualObj ) input.push( make_tree( id LookupId ) ) diff --git a/test/dns.lm b/test/dns.lm index 1ca701f1..87cfaab1 100644 --- a/test/dns.lm +++ b/test/dns.lm @@ -29,19 +29,19 @@ token RR_TXT // # 16 text strings token RR_UNKNOWN /''/ { - id: int = typeid RR_UNKNOWN + id: int = typeid if rr_type_value == 1 - id = typeid RR_A + id = typeid elsif rr_type_value == 2 - id = typeid RR_NS + id = typeid elsif rr_type_value == 5 - id = typeid RR_CNAME + id = typeid elsif rr_type_value == 12 - id = typeid RR_PTR + id = typeid elsif rr_type_value == 15 - id = typeid RR_MX + id = typeid elsif rr_type_value == 16 - id = typeid RR_TXT + id = typeid input.push( make_token( id '' ) ) } @@ -198,7 +198,7 @@ token nb_empty /''/ token nbytes_data /''/ { - input.push( make_token( typeid nbytes_data input.pull(nbytes) ) ) + input.push( make_token( typeid input.pull(nbytes) ) ) } def nbytes @@ -269,7 +269,7 @@ def ttl token rdata_bytes /''/ { - input.push( make_token( typeid rdata_bytes input.pull(rdata_length) ) ) + input.push( make_token( typeid input.pull(rdata_length) ) ) } def rdlength diff --git a/test/heredoc.lm b/test/heredoc.lm index 59ae2bd8..9551e0e0 100644 --- a/test/heredoc.lm +++ b/test/heredoc.lm @@ -11,11 +11,11 @@ lex start { if HereId && HereId == match_text { input.push( make_token( - typeid here_close + typeid input.pull(match_length - 1) ) ) } else { - input.push( make_token( typeid id input.pull(match_length) ) ) + input.push( make_token( typeid input.pull(match_length) ) ) } } diff --git a/test/html/html.lm b/test/html/html.lm index e680c439..09660c8a 100644 --- a/test/html/html.lm +++ b/test/html/html.lm @@ -62,13 +62,13 @@ lex close_id { # If it is in the tag stack then it is a close_id. If not then it's a # stray_close_id. - send_id: int = typeid stray_close_id + send_id: int = typeid LocalTagStack: tag_stack = TagStack for Tag: tag_id in LocalTagStack { T: tag_id = Tag if match_text == T.data { - send_id = typeid close_id + send_id = typeid break } } diff --git a/test/python/python.lm b/test/python/python.lm index b7230b34..4cc02f47 100644 --- a/test/python/python.lm +++ b/test/python/python.lm @@ -77,7 +77,7 @@ lex start { # 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 input.pull(match_length - 1) ) ) } # Find and ignore comments. @@ -85,7 +85,7 @@ lex start / '#' [^\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 input.pull(match_length - 1) ) ) } # These tokens are generated @@ -98,7 +98,7 @@ lex start /'\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 input.pull(match_length) ) ) # We have already sent the newline, compute the indentation level. data_length: int = match_length - 1 @@ -106,7 +106,7 @@ lex start if data_length > IndentStack.top { # 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 '' ) ) # Push to the stack as per python manual. IndentStack.push( data_length ) @@ -119,7 +119,7 @@ lex start IndentStack.pop() # Send as a DEDENT - input.push( make_token( typeid DEDENT '' ) ) + input.push( make_token( typeid '' ) ) } } @@ -127,7 +127,7 @@ lex start # means the outdent does not match anything. # First the newline. - input.push( make_token( typeid NEWLINE '' ) ) + input.push( make_token( typeid '' ) ) } } diff --git a/test/ruby/ruby.lm b/test/ruby/ruby.lm index e2518177..ef31d900 100644 --- a/test/ruby/ruby.lm +++ b/test/ruby/ruby.lm @@ -565,7 +565,7 @@ def variable 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 input.pull(match_length-1) ) ) } def method_call diff --git a/test/rubyhere.lm b/test/rubyhere.lm index e91fb916..c3a5054a 100644 --- a/test/rubyhere.lm +++ b/test/rubyhere.lm @@ -33,7 +33,7 @@ lex here_start 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 HereId HereData ) ) } } @@ -44,11 +44,11 @@ lex here_data { if match_text == HereId + '\n' { input.push( make_token( - typeid here_close_id + typeid input.pull( match_length ) ) ) } else - input.push( make_token( typeid here_line input.pull(match_length) ) ) + input.push( make_token( typeid input.pull(match_length) ) ) } token here_line diff --git a/test/superid.lm b/test/superid.lm index 9ceecb53..a74bb6db 100644 --- a/test/superid.lm +++ b/test/superid.lm @@ -20,7 +20,7 @@ def e1 [] { print( 'old_id = ' trans_id_to '\n' ) - trans_id_to = typeid foo + trans_id_to = typeid print( 'new_id = ' trans_id_to '\n' ) } @@ -36,7 +36,7 @@ def e2 [] { print( 'old_id = ' trans_id_to '\n' ) - trans_id_to = typeid super_id + trans_id_to = typeid print( 'new_id = ' trans_id_to '\n' ) } diff --git a/test/translate1.lm b/test/translate1.lm index f7c5dc9b..c2b63331 100644 --- a/test/translate1.lm +++ b/test/translate1.lm @@ -5,7 +5,7 @@ lex start token id /[a-zA-Z_]+/ { t: str = input.pull( match_length ) - input.push( make_token( typeid id t ) ) + input.push( make_token( typeid t ) ) } } diff --git a/test/translate2.lm b/test/translate2.lm index 6c6947e1..c5baa396 100644 --- a/test/translate2.lm +++ b/test/translate2.lm @@ -24,9 +24,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 "dot" ) ) + input.push( make_token( typeid "dot" ) ) + input.push( make_token( typeid "dot" ) ) } } -- cgit v1.2.1