Permalink
Browse files

Show po-file name when fuzzy msgid is found.

  • Loading branch information...
mutoh committed Nov 14, 2009
1 parent 6a069c5 commit e12c7fdf18488791e68a7966eed7818633d7d3c8
Showing with 131 additions and 124 deletions.
  1. +129 −123 lib/gettext/tools/poparser.rb
  2. +2 −1 src/poparser.ry
@@ -4,23 +4,20 @@
Copyright (C) 2003-2009 Masao Mutoh <mutomasa at gmail.com>
You may redistribute it and/or modify it under the same
- license terms as Ruby or LGPL.
+ license terms as Ruby.
=end
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by racc 1.4.5
-# from racc grammer file "src/poparser.ry".
+# This file is automatically generated by Racc 1.4.6
+# from Racc grammer file "".
#
-require 'racc/parser'
-
-
+require 'racc/parser.rb'
module GetText
-
class PoParser < Racc::Parser
-module_eval <<'..end src/poparser.ry modeval..ida5d3d657e2', 'src/poparser.ry', 108
+module_eval(<<'...end poparser.ry/module_eval...', 'poparser.ry', 108)
include GetText
GetText.bindtextdomain("rgettext")
@@ -117,6 +114,7 @@ def parse_file(po_file, data, ignore_fuzzy = true)
encoding = detect_file_encoding(po_file)
args << "r:#{encoding}"
end
+ @po_file = po_file
parse(File.open(*args) {|io| io.read }, data, ignore_fuzzy)
end
@@ -129,31 +127,8 @@ def detect_file_encoding(po_file)
Encoding.default_external
end
private :detect_file_encoding
-..end src/poparser.ry modeval..ida5d3d657e2
-
-##### racc 1.4.5 generates ###
-
-racc_reduce_table = [
- 0, 0, :racc_error,
- 0, 10, :_reduce_none,
- 2, 10, :_reduce_none,
- 2, 10, :_reduce_none,
- 2, 10, :_reduce_none,
- 2, 12, :_reduce_5,
- 1, 13, :_reduce_none,
- 1, 13, :_reduce_none,
- 4, 15, :_reduce_8,
- 5, 16, :_reduce_9,
- 2, 17, :_reduce_10,
- 1, 17, :_reduce_none,
- 3, 18, :_reduce_12,
- 1, 11, :_reduce_13,
- 2, 14, :_reduce_14,
- 1, 14, :_reduce_15 ]
-
-racc_reduce_n = 16
-
-racc_shift_n = 26
+...end poparser.ry/module_eval...
+##### State transition tables begin ###
racc_action_table = [
3, 13, 5, 7, 9, 15, 16, 17, 20, 17,
@@ -187,89 +162,112 @@ def detect_file_encoding(po_file)
racc_goto_default = [
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil ]
-racc_token_table = {
- false => 0,
- Object.new => 1,
- :COMMENT => 2,
- :MSGID => 3,
- :MSGCTXT => 4,
- :MSGID_PLURAL => 5,
- :MSGSTR => 6,
- :STRING => 7,
- :PLURAL_NUM => 8 }
+racc_reduce_table = [
+ 0, 0, :racc_error,
+ 0, 10, :_reduce_none,
+ 2, 10, :_reduce_none,
+ 2, 10, :_reduce_none,
+ 2, 10, :_reduce_none,
+ 2, 12, :_reduce_5,
+ 1, 13, :_reduce_none,
+ 1, 13, :_reduce_none,
+ 4, 15, :_reduce_8,
+ 5, 16, :_reduce_9,
+ 2, 17, :_reduce_10,
+ 1, 17, :_reduce_none,
+ 3, 18, :_reduce_12,
+ 1, 11, :_reduce_13,
+ 2, 14, :_reduce_14,
+ 1, 14, :_reduce_15 ]
-racc_use_result_var = true
+racc_reduce_n = 16
+
+racc_shift_n = 26
+
+racc_token_table = {
+ false => 0,
+ :error => 1,
+ :COMMENT => 2,
+ :MSGID => 3,
+ :MSGCTXT => 4,
+ :MSGID_PLURAL => 5,
+ :MSGSTR => 6,
+ :STRING => 7,
+ :PLURAL_NUM => 8 }
racc_nt_base = 9
+racc_use_result_var = true
+
Racc_arg = [
- racc_action_table,
- racc_action_check,
- racc_action_default,
- racc_action_pointer,
- racc_goto_table,
- racc_goto_check,
- racc_goto_default,
- racc_goto_pointer,
- racc_nt_base,
- racc_reduce_table,
- racc_token_table,
- racc_shift_n,
- racc_reduce_n,
- racc_use_result_var ]
+ racc_action_table,
+ racc_action_check,
+ racc_action_default,
+ racc_action_pointer,
+ racc_goto_table,
+ racc_goto_check,
+ racc_goto_default,
+ racc_goto_pointer,
+ racc_nt_base,
+ racc_reduce_table,
+ racc_token_table,
+ racc_shift_n,
+ racc_reduce_n,
+ racc_use_result_var ]
Racc_token_to_s_table = [
-'$end',
-'error',
-'COMMENT',
-'MSGID',
-'MSGCTXT',
-'MSGID_PLURAL',
-'MSGSTR',
-'STRING',
-'PLURAL_NUM',
-'$start',
-'msgfmt',
-'comment',
-'msgctxt',
-'message',
-'string_list',
-'single_message',
-'plural_message',
-'msgstr_plural',
-'msgstr_plural_line']
+ "$end",
+ "error",
+ "COMMENT",
+ "MSGID",
+ "MSGCTXT",
+ "MSGID_PLURAL",
+ "MSGSTR",
+ "STRING",
+ "PLURAL_NUM",
+ "$start",
+ "msgfmt",
+ "comment",
+ "msgctxt",
+ "message",
+ "string_list",
+ "single_message",
+ "plural_message",
+ "msgstr_plural",
+ "msgstr_plural_line" ]
Racc_debug_parser = true
-##### racc system variables end #####
+##### State transition tables end #####
- # reduce 0 omitted
+# reduce 0 omitted
- # reduce 1 omitted
+# reduce 1 omitted
- # reduce 2 omitted
+# reduce 2 omitted
- # reduce 3 omitted
+# reduce 3 omitted
- # reduce 4 omitted
+# reduce 4 omitted
-module_eval <<'.,.,', 'src/poparser.ry', 25
- def _reduce_5( val, _values, result )
- @msgctxt = unescape(val[1]) + "\004"
- result
+module_eval(<<'.,.,', 'poparser.ry', 23)
+ def _reduce_5(val, _values, result)
+ @msgctxt = unescape(val[1]) + "\004"
+
+ result
end
.,.,
- # reduce 6 omitted
+# reduce 6 omitted
- # reduce 7 omitted
+# reduce 7 omitted
-module_eval <<'.,.,', 'src/poparser.ry', 48
- def _reduce_8( val, _values, result )
- if @fuzzy and $ignore_fuzzy
+module_eval(<<'.,.,', 'poparser.ry', 35)
+ def _reduce_8(val, _values, result)
+ if @fuzzy and $ignore_fuzzy
if val[1] != ""
$stderr.print _("Warning: fuzzy message was ignored.\n")
- $stderr.print " msgid '#{val[1]}'\n"
+ $stderr.print " #{@po_file}: msgid '#{val[1]}'\n"
else
on_message('', unescape(val[3]))
end
@@ -278,13 +276,14 @@ def _reduce_8( val, _values, result )
on_message(@msgctxt + unescape(val[1]), unescape(val[3]))
end
result = ""
- result
+
+ result
end
.,.,
-module_eval <<'.,.,', 'src/poparser.ry', 65
- def _reduce_9( val, _values, result )
- if @fuzzy and $ignore_fuzzy
+module_eval(<<'.,.,', 'poparser.ry', 52)
+ def _reduce_9(val, _values, result)
+ if @fuzzy and $ignore_fuzzy
if val[1] != ""
$stderr.print _("Warning: fuzzy message was ignored.\n")
$stderr.print "msgid = '#{val[1]}\n"
@@ -296,55 +295,62 @@ def _reduce_9( val, _values, result )
on_message(@msgctxt + unescape(val[1]) + "\000" + unescape(val[3]), unescape(val[4]))
end
result = ""
- result
+
+ result
end
.,.,
-module_eval <<'.,.,', 'src/poparser.ry', 76
- def _reduce_10( val, _values, result )
- if val[0].size > 0
+module_eval(<<'.,.,', 'poparser.ry', 70)
+ def _reduce_10(val, _values, result)
+ if val[0].size > 0
result = val[0] + "\000" + val[1]
else
result = ""
end
- result
+
+ result
end
.,.,
- # reduce 11 omitted
+# reduce 11 omitted
-module_eval <<'.,.,', 'src/poparser.ry', 84
- def _reduce_12( val, _values, result )
- result = val[2]
- result
+module_eval(<<'.,.,', 'poparser.ry', 82)
+ def _reduce_12(val, _values, result)
+ result = val[2]
+
+ result
end
.,.,
-module_eval <<'.,.,', 'src/poparser.ry', 91
- def _reduce_13( val, _values, result )
- on_comment(val[0])
- result
+module_eval(<<'.,.,', 'poparser.ry', 89)
+ def _reduce_13(val, _values, result)
+ on_comment(val[0])
+
+ result
end
.,.,
-module_eval <<'.,.,', 'src/poparser.ry', 99
- def _reduce_14( val, _values, result )
- result = val.delete_if{|item| item == ""}.join
- result
+module_eval(<<'.,.,', 'poparser.ry', 97)
+ def _reduce_14(val, _values, result)
+ result = val.delete_if{|item| item == ""}.join
+
+ result
end
.,.,
-module_eval <<'.,.,', 'src/poparser.ry', 103
- def _reduce_15( val, _values, result )
- result = val[0]
- result
+module_eval(<<'.,.,', 'poparser.ry', 101)
+ def _reduce_15(val, _values, result)
+ result = val[0]
+
+ result
end
.,.,
- def _reduce_none( val, _values, result )
- result
- end
+def _reduce_none(val, _values, result)
+ val[0]
+end
end # class PoParser
+ end # module GetText
+
-end # module GetText
View
@@ -36,7 +36,7 @@ class GetText::PoParser
if @fuzzy and $ignore_fuzzy
if val[1] != ""
$stderr.print _("Warning: fuzzy message was ignored.\n")
- $stderr.print " msgid '#{val[1]}'\n"
+ $stderr.print " #{@po_file}: msgid '#{val[1]}'\n"
else
on_message('', unescape(val[3]))
end
@@ -201,6 +201,7 @@ end
encoding = detect_file_encoding(po_file)
args << "r:#{encoding}"
end
+ @po_file = po_file
parse(File.open(*args) {|io| io.read }, data, ignore_fuzzy)
end

0 comments on commit e12c7fd

Please sign in to comment.