From e71916a9c86731dda4ca7dd3478616a4c5823e4b Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 29 May 2012 23:02:42 +0200 Subject: [PATCH] [ng] refactor: merge lang_{yacc,lex}_finish functions They are identical after the last commit, so no need to keep them separated anymore * automake.in (yacc_lex_finish_helper, lang_yacc_finish, lang_lex_finish): Merge into .. (lang_yacc_lex_finish): ... this. Adjust calls to 'register_language' for Yacc and Lex accordingly. Signed-off-by: Stefano Lattarini --- automake.in | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/automake.in b/automake.in index 3cce00ff2..bd9c9801d 100644 --- a/automake.in +++ b/automake.in @@ -830,7 +830,7 @@ register_language ('name' => 'yacc', 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/; return ($ext,) }, 'rule_file' => 'yacc', - '_finish' => \&lang_yacc_finish, + '_finish' => \&lang_yacc_lex_finish, '_target_hook' => \&lang_yacc_target_hook, 'nodist_specific' => 1); register_language ('name' => 'yaccxx', @@ -844,7 +844,7 @@ register_language ('name' => 'yaccxx', 'extensions' => ['.y++', '.yy', '.yxx', '.ypp'], 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/; return ($ext,) }, - '_finish' => \&lang_yacc_finish, + '_finish' => \&lang_yacc_lex_finish, '_target_hook' => \&lang_yacc_target_hook, 'nodist_specific' => 1); @@ -860,7 +860,7 @@ register_language ('name' => 'lex', 'extensions' => ['.l'], 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/; return ($ext,) }, - '_finish' => \&lang_lex_finish, + '_finish' => \&lang_yacc_lex_finish, '_target_hook' => \&lang_lex_target_hook, 'nodist_specific' => 1); register_language ('name' => 'lexxx', @@ -874,7 +874,7 @@ register_language ('name' => 'lexxx', 'extensions' => ['.l++', '.ll', '.lxx', '.lpp'], 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/; return ($ext,) }, - '_finish' => \&lang_lex_finish, + '_finish' => \&lang_yacc_lex_finish, '_target_hook' => \&lang_lex_target_hook, 'nodist_specific' => 1); @@ -5511,8 +5511,7 @@ sub lang_lex_target_hook $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN; } -# This is a helper for both lex and yacc. -sub yacc_lex_finish_helper +sub lang_yacc_lex_finish { return if defined $language_scratch{'lex-yacc-done'}; $language_scratch{'lex-yacc-done'} = 1; @@ -5522,24 +5521,6 @@ sub yacc_lex_finish_helper define_variable ('YLWRAP', INTERNAL, '$(am__config_aux_dir)/ylwrap'); } -sub lang_yacc_finish -{ - return if defined $language_scratch{'yacc-done'}; - $language_scratch{'yacc-done'} = 1; - - yacc_lex_finish_helper; -} - - -sub lang_lex_finish -{ - return if defined $language_scratch{'lex-done'}; - $language_scratch{'lex-done'} = 1; - - yacc_lex_finish_helper; -} - - # Given a hash table of linker names, pick the name that has the most # precedence. This is lame, but something has to have global # knowledge in order to eliminate the conflict. Add more linkers as -- 2.47.2