eturem 0.4.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/eturem/en.rb CHANGED
@@ -1,216 +1,2 @@
1
- require "eturem/base"
2
-
3
- module Eturem
4
- class En < Base
5
- @inspect_methods = {
6
- #NoMemoryError => :no_memory_error_inspect,
7
- #ScriptError => :script_error_inspect,
8
- #LoadError => :load_error_inspect,
9
- #NotImplementedError => :not_implemented_error_inspect,
10
- #SyntaxError => :syntax_error_inspect,
11
- #SecurityError => :security_error_inspect,
12
- #SignalException => :signal_exception_inspect,
13
- #Interrupt => :interrupt_inspect,
14
- #StandardError => :standard_error_inspect,
15
- #ArgumentError => :argument_error_inspect,
16
- #UncaughtThrowError => :uncaught_throw_error_inspect,
17
- #EncodingError => :encoding_error_inspect,
18
- #Encoding::CompatibilityError => :encoding_compatibility_error_inspect,
19
- #Encoding::ConverterNotFoundError => :encoding_converter_not_found_error_inspect,
20
- #Encoding::InvalidByteSequenceError => :encoding_invalid_byte_sequence_error_inspect,
21
- #Encoding::UndefinedConversionError => :encoding_undefined_conversion_error_inspect,
22
- #FiberError => :fiber_error_inspect,
23
- #IOError => :io_error_inspect,
24
- #EOFError => :eof_error_inspect,
25
- #IndexError => :index_error_inspect,
26
- #KeyError => :key_error_inspect,
27
- #StopIteration => :stop_iteration_inspect,
28
- #ClosedQueueError => :closed_queue_error_inspect,
29
- #LocalJumpError => :local_jump_error_inspect,
30
- #Math::DomainError => :math_domain_error_inspect,
31
- #NameError => :name_error_inspect,
32
- #NoMethodError => :no_method_error_inspect,
33
- #RangeError => :range_error_inspect,
34
- #FloatDomainError => :float_domain_error_inspect,
35
- #RegexpError => :regexp_error_inspect,
36
- #RuntimeError => :runtime_error_inspect,
37
- #FrozenError => :frozen_error_inspect,
38
- #SystemCallError => :system_call_error_inspect,
39
- #Errno::E2BIG => :errno_e2big_inspect,
40
- #Errno::EACCES => :errno_eacces_inspect,
41
- #Errno::EADDRINUSE => :errno_eaddrinuse_inspect,
42
- #Errno::EADDRNOTAVAIL => :errno_eaddrnotavail_inspect,
43
- #Errno::EADV => :errno_eadv_inspect,
44
- #Errno::EAFNOSUPPORT => :errno_eafnosupport_inspect,
45
- #Errno::EAGAIN => :errno_eagain_inspect,
46
- #Errno::EALREADY => :errno_ealready_inspect,
47
- #Errno::EAUTH => :errno_eauth_inspect,
48
- #Errno::EBADE => :errno_ebade_inspect,
49
- #Errno::EBADF => :errno_ebadf_inspect,
50
- #Errno::EBADFD => :errno_ebadfd_inspect,
51
- #Errno::EBADMSG => :errno_ebadmsg_inspect,
52
- #Errno::EBADR => :errno_ebadr_inspect,
53
- #Errno::EBADRPC => :errno_ebadrpc_inspect,
54
- #Errno::EBADRQC => :errno_ebadrqc_inspect,
55
- #Errno::EBADSLT => :errno_ebadslt_inspect,
56
- #Errno::EBFONT => :errno_ebfont_inspect,
57
- #Errno::EBUSY => :errno_ebusy_inspect,
58
- #Errno::ECANCELED => :errno_ecanceled_inspect,
59
- #Errno::ECAPMODE => :errno_ecapmode_inspect,
60
- #Errno::ECHILD => :errno_echild_inspect,
61
- #Errno::ECHRNG => :errno_echrng_inspect,
62
- #Errno::ECOMM => :errno_ecomm_inspect,
63
- #Errno::ECONNABORTED => :errno_econnaborted_inspect,
64
- #Errno::ECONNREFUSED => :errno_econnrefused_inspect,
65
- #Errno::ECONNRESET => :errno_econnreset_inspect,
66
- #Errno::EDEADLK => :errno_edeadlk_inspect,
67
- #Errno::EDEADLOCK => :errno_edeadlock_inspect,
68
- #Errno::EDESTADDRREQ => :errno_edestaddrreq_inspect,
69
- #Errno::EDOM => :errno_edom_inspect,
70
- #Errno::EDOOFUS => :errno_edoofus_inspect,
71
- #Errno::EDOTDOT => :errno_edotdot_inspect,
72
- #Errno::EDQUOT => :errno_edquot_inspect,
73
- #Errno::EEXIST => :errno_eexist_inspect,
74
- #Errno::EFAULT => :errno_efault_inspect,
75
- #Errno::EFBIG => :errno_efbig_inspect,
76
- #Errno::EFTYPE => :errno_eftype_inspect,
77
- #Errno::EHOSTDOWN => :errno_ehostdown_inspect,
78
- #Errno::EHOSTUNREACH => :errno_ehostunreach_inspect,
79
- #Errno::EHWPOISON => :errno_ehwpoison_inspect,
80
- #Errno::EIDRM => :errno_eidrm_inspect,
81
- #Errno::EILSEQ => :errno_eilseq_inspect,
82
- #Errno::EINPROGRESS => :errno_einprogress_inspect,
83
- #Errno::EINTR => :errno_eintr_inspect,
84
- #Errno::EINVAL => :errno_einval_inspect,
85
- #Errno::EIO => :errno_Eio_inspect,
86
- #Errno::EIPSEC => :errno_eipsec_inspect,
87
- #Errno::EISCONN => :errno_eisconn_inspect,
88
- #Errno::EISDIR => :errno_eisdir_inspect,
89
- #Errno::EISNAM => :errno_eisnam_inspect,
90
- #Errno::EKEYEXPIRED => :errno_ekeyexpired_inspect,
91
- #Errno::EKEYREJECTED => :errno_ekeyrejected_inspect,
92
- #Errno::EKEYREVOKED => :errno_ekeyrevoked_inspect,
93
- #Errno::EL2HLT => :errno_el2hlt_inspect,
94
- #Errno::EL2NSYNC => :errno_el2nsync_inspect,
95
- #Errno::EL3HLT => :errno_el3hlt_inspect,
96
- #Errno::EL3RST => :errno_el3rst_inspect,
97
- #Errno::ELIBACC => :errno_elibacc_inspect,
98
- #Errno::ELIBBAD => :errno_elibbad_inspect,
99
- #Errno::ELIBEXEC => :errno_elibexec_inspect,
100
- #Errno::ELIBMAX => :errno_elibmax_inspect,
101
- #Errno::ELIBSCN => :errno_elibscn_inspect,
102
- #Errno::ELNRNG => :errno_elnrng_inspect,
103
- #Errno::ELOOP => :errno_eloop_inspect,
104
- #Errno::EMEDIUMTYPE => :errno_emediumtype_inspect,
105
- #Errno::EMFILE => :errno_emfile_inspect,
106
- #Errno::EMLINK => :errno_emlink_inspect,
107
- #Errno::EMSGSIZE => :errno_emsgsize_inspect,
108
- #Errno::EMULTIHOP => :errno_emultihop_inspect,
109
- #Errno::ENAMETOOLONG => :errno_enametoolong_inspect,
110
- #Errno::ENAVAIL => :errno_enavail_inspect,
111
- #Errno::ENEEDAUTH => :errno_eneedauth_inspect,
112
- #Errno::ENETDOWN => :errno_enetdown_inspect,
113
- #Errno::ENETRESET => :errno_enetreset_inspect,
114
- #Errno::ENETUNREACH => :errno_enetunreach_inspect,
115
- #Errno::ENFILE => :errno_enfile_inspect,
116
- #Errno::ENOANO => :errno_enoano_inspect,
117
- #Errno::ENOATTR => :errno_enoattr_inspect,
118
- #Errno::ENOBUFS => :errno_enobufs_inspect,
119
- #Errno::ENOCSI => :errno_enocsi_inspect,
120
- #Errno::ENODATA => :errno_enodata_inspect,
121
- #Errno::ENODEV => :errno_enodev_inspect,
122
- #Errno::ENOENT => :errno_enoent_inspect,
123
- #Errno::ENOEXEC => :errno_enoexec_inspect,
124
- #Errno::ENOKEY => :errno_enokey_inspect,
125
- #Errno::ENOLCK => :errno_enolck_inspect,
126
- #Errno::ENOLINK => :errno_enolink_inspect,
127
- #Errno::ENOMEDIUM => :errno_enomedium_inspect,
128
- #Errno::ENOMEM => :errno_enomem_inspect,
129
- #Errno::ENOMSG => :errno_enomsg_inspect,
130
- #Errno::ENONET => :errno_enonet_inspect,
131
- #Errno::ENOPKG => :errno_enopkg_inspect,
132
- #Errno::ENOPROTOOPT => :errno_enoprotoopt_inspect,
133
- #Errno::ENOSPC => :errno_enospc_inspect,
134
- #Errno::ENOSR => :errno_enosr_inspect,
135
- #Errno::ENOSTR => :errno_enostr_inspect,
136
- #Errno::ENOSYS => :errno_enosys_inspect,
137
- #Errno::ENOTBLK => :errno_enotblk_inspect,
138
- #Errno::ENOTCAPABLE => :errno_enotcapable_inspect,
139
- #Errno::ENOTCONN => :errno_enotconn_inspect,
140
- #Errno::ENOTDIR => :errno_enotdir_inspect,
141
- #Errno::ENOTEMPTY => :errno_enotempty_inspect,
142
- #Errno::ENOTNAM => :errno_enotnam_inspect,
143
- #Errno::ENOTRECOVERABLE => :errno_enotrecoverable_inspect,
144
- #Errno::ENOTSOCK => :errno_enotsock_inspect,
145
- #Errno::ENOTSUP => :errno_enotsup_inspect,
146
- #Errno::ENOTTY => :errno_enotty_inspect,
147
- #Errno::ENOTUNIQ => :errno_enotuniq_inspect,
148
- #Errno::ENXIO => :errno_enxio_inspect,
149
- #Errno::EOPNOTSUPP => :errno_eopnotsupp_inspect,
150
- #Errno::EOVERFLOW => :errno_eoverflow_inspect,
151
- #Errno::EOWNERDEAD => :errno_eownerdead_inspect,
152
- #Errno::EPERM => :errno_eperm_inspect,
153
- #Errno::EPFNOSUPPORT => :errno_epfnosupport_inspect,
154
- #Errno::EPIPE => :errno_epipe_inspect,
155
- #Errno::EPROCLIM => :errno_eproclim_inspect,
156
- #Errno::EPROCUNAVAIL => :errno_eprocunavail_inspect,
157
- #Errno::EPROGMISMATCH => :errno_eprogmismatch_inspect,
158
- #Errno::EPROGUNAVAIL => :errno_eprogunavail_inspect,
159
- #Errno::EPROTO => :errno_eproto_inspect,
160
- #Errno::EPROTONOSUPPORT => :errno_eprotonosupport_inspect,
161
- #Errno::EPROTOTYPE => :errno_eprototype_inspect,
162
- #Errno::ERANGE => :errno_erange_inspect,
163
- #Errno::EREMCHG => :errno_eremchg_inspect,
164
- #Errno::EREMOTE => :errno_eremote_inspect,
165
- #Errno::EREMOTEIO => :errno_eremoteio_inspect,
166
- #Errno::ERESTART => :errno_erestart_inspect,
167
- #Errno::ERFKILL => :errno_erfkill_inspect,
168
- #Errno::EROFS => :errno_erofs_inspect,
169
- #Errno::ERPCMISMATCH => :errno_erpcmismatch_inspect,
170
- #Errno::ESHUTDOWN => :errno_eshutdown_inspect,
171
- #Errno::ESOCKTNOSUPPORT => :errno_esocktnosupport_inspect,
172
- #Errno::ESPIPE => :errno_espipe_inspect,
173
- #Errno::ESRCH => :errno_esrch_inspect,
174
- #Errno::ESRMNT => :errno_esrmnt_inspect,
175
- #Errno::ESTALE => :errno_estale_inspect,
176
- #Errno::ESTRPIPE => :errno_estrpipe_inspect,
177
- #Errno::ETIME => :errno_etime_inspect,
178
- #Errno::ETIMEDOUT => :errno_etimedout_inspect,
179
- #Errno::ETOOMANYREFS => :errno_etoomanyrefs_inspect,
180
- #Errno::ETXTBSY => :errno_etxtbsy_inspect,
181
- #Errno::EUCLEAN => :errno_euclean_inspect,
182
- #Errno::EUNATCH => :errno_eunatch_inspect,
183
- #Errno::EUSERS => :errno_eusers_inspect,
184
- #Errno::EWOULDBLOCK => :errno_ewouldblock_inspect,
185
- #Errno::EXDEV => :errno_exdev_inspect,
186
- #Errno::EXFULL => :errno_exfull_inspect,
187
- #Errno::EXXX => :errno_exxx_inspect,
188
- #Errno::NOERROR => :errno_noerror_inspect,
189
- #ThreadError => :thread_error_inspect,
190
- #TypeError => :type_error_inspect,
191
- #ZeroDivisionError => :zero_division_error_inspect,
192
- #SystemStackError => :system_stack_error_inspect,
193
- "sentinel" => nil
194
- }
195
-
196
- def prepare
197
- super
198
- end
199
-
200
- def traceback_most_recent_call_last
201
- super
202
- end
203
-
204
- def location_inspect(location)
205
- super
206
- end
207
-
208
- def exception_inspect
209
- super
210
- end
211
- end
212
-
213
- @eturem_class = En
214
- end
215
-
1
+ require "eturem/en/main"
216
2
  require "eturem"
@@ -0,0 +1,215 @@
1
+ # coding: utf-8
2
+
3
+ require "eturem/base"
4
+ Dir[File.expand_path("..", __FILE__) + "/*.rb"].each do |path|
5
+ require path unless path == File.expand_path(__FILE__)
6
+ end
7
+
8
+ module Eturem
9
+ def self._extend_exception(exception)
10
+ ext = case exception
11
+ # when NoMemoryError then NoMemoryErrorExt
12
+ # when LoadError then LoadErrorExt
13
+ # when NotImplementedError then NotImplementedErrorExt
14
+ when SyntaxError then SyntaxErrorExt
15
+ # when ScriptError then ScriptErrorExt
16
+ # when SecurityError then SecurityErrorExt
17
+ # when Interrupt then InterruptExt
18
+ # when SignalException then SignalExceptionExt
19
+ # when UncaughtThrowError then UncaughtThrowErrorExt
20
+ when ArgumentError then ArgumentErrorExt
21
+ # when Encoding::CompatibilityError then Encoding_CompatibilityErrorExt
22
+ # when Encoding::ConverterNotFoundError then Encoding_ConverterNotFoundErrorExt
23
+ # when Encoding::InvalidByteSequenceError then Encoding_InvalidByteSequenceErrorExt
24
+ # when Encoding::UndefinedConversionError then Encoding_UndefinedConversionErrorExt
25
+ # when EncodingError then EncodingErrorExt
26
+ # when FiberError then FiberErrorExt
27
+ # when EOFError then EOFErrorExt
28
+ # when IOError then IOErrorExt
29
+ # when KeyError then KeyErrorExt
30
+ # when ClosedQueueError then ClosedQueueErrorExt
31
+ # when StopIteration then StopIterationExt
32
+ # when IndexError then IndexErrorExt
33
+ # when LocalJumpError then LocalJumpErrorExt
34
+ # when Math::DomainError then Math_DomainErrorExt
35
+ # when NoMethodError then NoMethodErrorExt
36
+ when NameError then NameErrorExt
37
+ # when FloatDomainError then FloatDomainErrorExt
38
+ # when RangeError then RangeErrorExt
39
+ # when RegexpError then RegexpErrorExt
40
+ # when RuntimeError then RuntimeErrorExt
41
+ # when Errno::E2BIG then Errno_E2BIGExt
42
+ # when Errno::EACCES then Errno_EACCESExt
43
+ # when Errno::EADDRINUSE then Errno_EADDRINUSEExt
44
+ # when Errno::EADDRNOTAVAIL then Errno_EADDRNOTAVAILExt
45
+ # when Errno::EADV then Errno_EADVExt
46
+ # when Errno::EAFNOSUPPORT then Errno_EAFNOSUPPORTExt
47
+ # when Errno::EAGAIN then Errno_EAGAINExt
48
+ # when Errno::EALREADY then Errno_EALREADYExt
49
+ # when Errno::EAUTH then Errno_EAUTHExt
50
+ # when Errno::EBADE then Errno_EBADEExt
51
+ # when Errno::EBADF then Errno_EBADFExt
52
+ # when Errno::EBADFD then Errno_EBADFDExt
53
+ # when Errno::EBADMSG then Errno_EBADMSGExt
54
+ # when Errno::EBADR then Errno_EBADRExt
55
+ # when Errno::EBADRPC then Errno_EBADRPCExt
56
+ # when Errno::EBADRQC then Errno_EBADRQCExt
57
+ # when Errno::EBADSLT then Errno_EBADSLTExt
58
+ # when Errno::EBFONT then Errno_EBFONTExt
59
+ # when Errno::EBUSY then Errno_EBUSYExt
60
+ # when Errno::ECANCELED then Errno_ECANCELEDExt
61
+ # when Errno::ECAPMODE then Errno_ECAPMODEExt
62
+ # when Errno::ECHILD then Errno_ECHILDExt
63
+ # when Errno::ECHRNG then Errno_ECHRNGExt
64
+ # when Errno::ECOMM then Errno_ECOMMExt
65
+ # when Errno::ECONNABORTED then Errno_ECONNABORTEDExt
66
+ # when Errno::ECONNREFUSED then Errno_ECONNREFUSEDExt
67
+ # when Errno::ECONNRESET then Errno_ECONNRESETExt
68
+ # when Errno::EDEADLK then Errno_EDEADLKExt
69
+ # when Errno::EDEADLOCK then Errno_EDEADLOCKExt
70
+ # when Errno::EDESTADDRREQ then Errno_EDESTADDRREQExt
71
+ # when Errno::EDOM then Errno_EDOMExt
72
+ # when Errno::EDOOFUS then Errno_EDOOFUSExt
73
+ # when Errno::EDOTDOT then Errno_EDOTDOTExt
74
+ # when Errno::EDQUOT then Errno_EDQUOTExt
75
+ # when Errno::EEXIST then Errno_EEXISTExt
76
+ # when Errno::EFAULT then Errno_EFAULTExt
77
+ # when Errno::EFBIG then Errno_EFBIGExt
78
+ # when Errno::EFTYPE then Errno_EFTYPEExt
79
+ # when Errno::EHOSTDOWN then Errno_EHOSTDOWNExt
80
+ # when Errno::EHOSTUNREACH then Errno_EHOSTUNREACHExt
81
+ # when Errno::EHWPOISON then Errno_EHWPOISONExt
82
+ # when Errno::EIDRM then Errno_EIDRMExt
83
+ # when Errno::EILSEQ then Errno_EILSEQExt
84
+ # when Errno::EINPROGRESS then Errno_EINPROGRESSExt
85
+ # when Errno::EINTR then Errno_EINTRExt
86
+ # when Errno::EINVAL then Errno_EINVALExt
87
+ # when Errno::EIO then Errno_EIOExt
88
+ # when Errno::EIPSEC then Errno_EIPSECExt
89
+ # when Errno::EISCONN then Errno_EISCONNExt
90
+ # when Errno::EISDIR then Errno_EISDIRExt
91
+ # when Errno::EISNAM then Errno_EISNAMExt
92
+ # when Errno::EKEYEXPIRED then Errno_EKEYEXPIREDExt
93
+ # when Errno::EKEYREJECTED then Errno_EKEYREJECTEDExt
94
+ # when Errno::EKEYREVOKED then Errno_EKEYREVOKEDExt
95
+ # when Errno::EL2HLT then Errno_EL2HLTExt
96
+ # when Errno::EL2NSYNC then Errno_EL2NSYNCExt
97
+ # when Errno::EL3HLT then Errno_EL3HLTExt
98
+ # when Errno::EL3RST then Errno_EL3RSTExt
99
+ # when Errno::ELIBACC then Errno_ELIBACCExt
100
+ # when Errno::ELIBBAD then Errno_ELIBBADExt
101
+ # when Errno::ELIBEXEC then Errno_ELIBEXECExt
102
+ # when Errno::ELIBMAX then Errno_ELIBMAXExt
103
+ # when Errno::ELIBSCN then Errno_ELIBSCNExt
104
+ # when Errno::ELNRNG then Errno_ELNRNGExt
105
+ # when Errno::ELOOP then Errno_ELOOPExt
106
+ # when Errno::EMEDIUMTYPE then Errno_EMEDIUMTYPEExt
107
+ # when Errno::EMFILE then Errno_EMFILEExt
108
+ # when Errno::EMLINK then Errno_EMLINKExt
109
+ # when Errno::EMSGSIZE then Errno_EMSGSIZEExt
110
+ # when Errno::EMULTIHOP then Errno_EMULTIHOPExt
111
+ # when Errno::ENAMETOOLONG then Errno_ENAMETOOLONGExt
112
+ # when Errno::ENAVAIL then Errno_ENAVAILExt
113
+ # when Errno::ENEEDAUTH then Errno_ENEEDAUTHExt
114
+ # when Errno::ENETDOWN then Errno_ENETDOWNExt
115
+ # when Errno::ENETRESET then Errno_ENETRESETExt
116
+ # when Errno::ENETUNREACH then Errno_ENETUNREACHExt
117
+ # when Errno::ENFILE then Errno_ENFILEExt
118
+ # when Errno::ENOANO then Errno_ENOANOExt
119
+ # when Errno::ENOATTR then Errno_ENOATTRExt
120
+ # when Errno::ENOBUFS then Errno_ENOBUFSExt
121
+ # when Errno::ENOCSI then Errno_ENOCSIExt
122
+ # when Errno::ENODATA then Errno_ENODATAExt
123
+ # when Errno::ENODEV then Errno_ENODEVExt
124
+ # when Errno::ENOENT then Errno_ENOENTExt
125
+ # when Errno::ENOEXEC then Errno_ENOEXECExt
126
+ # when Errno::ENOKEY then Errno_ENOKEYExt
127
+ # when Errno::ENOLCK then Errno_ENOLCKExt
128
+ # when Errno::ENOLINK then Errno_ENOLINKExt
129
+ # when Errno::ENOMEDIUM then Errno_ENOMEDIUMExt
130
+ # when Errno::ENOMEM then Errno_ENOMEMExt
131
+ # when Errno::ENOMSG then Errno_ENOMSGExt
132
+ # when Errno::ENONET then Errno_ENONETExt
133
+ # when Errno::ENOPKG then Errno_ENOPKGExt
134
+ # when Errno::ENOPROTOOPT then Errno_ENOPROTOOPTExt
135
+ # when Errno::ENOSPC then Errno_ENOSPCExt
136
+ # when Errno::ENOSR then Errno_ENOSRExt
137
+ # when Errno::ENOSTR then Errno_ENOSTRExt
138
+ # when Errno::ENOSYS then Errno_ENOSYSExt
139
+ # when Errno::ENOTBLK then Errno_ENOTBLKExt
140
+ # when Errno::ENOTCAPABLE then Errno_ENOTCAPABLEExt
141
+ # when Errno::ENOTCONN then Errno_ENOTCONNExt
142
+ # when Errno::ENOTDIR then Errno_ENOTDIRExt
143
+ # when Errno::ENOTEMPTY then Errno_ENOTEMPTYExt
144
+ # when Errno::ENOTNAM then Errno_ENOTNAMExt
145
+ # when Errno::ENOTRECOVERABLE then Errno_ENOTRECOVERABLEExt
146
+ # when Errno::ENOTSOCK then Errno_ENOTSOCKExt
147
+ # when Errno::ENOTSUP then Errno_ENOTSUPExt
148
+ # when Errno::ENOTTY then Errno_ENOTTYExt
149
+ # when Errno::ENOTUNIQ then Errno_ENOTUNIQExt
150
+ # when Errno::ENXIO then Errno_ENXIOExt
151
+ # when Errno::EOPNOTSUPP then Errno_EOPNOTSUPPExt
152
+ # when Errno::EOVERFLOW then Errno_EOVERFLOWExt
153
+ # when Errno::EOWNERDEAD then Errno_EOWNERDEADExt
154
+ # when Errno::EPERM then Errno_EPERMExt
155
+ # when Errno::EPFNOSUPPORT then Errno_EPFNOSUPPORTExt
156
+ # when Errno::EPIPE then Errno_EPIPEExt
157
+ # when Errno::EPROCLIM then Errno_EPROCLIMExt
158
+ # when Errno::EPROCUNAVAIL then Errno_EPROCUNAVAILExt
159
+ # when Errno::EPROGMISMATCH then Errno_EPROGMISMATCHExt
160
+ # when Errno::EPROGUNAVAIL then Errno_EPROGUNAVAILExt
161
+ # when Errno::EPROTO then Errno_EPROTOExt
162
+ # when Errno::EPROTONOSUPPORT then Errno_EPROTONOSUPPORTExt
163
+ # when Errno::EPROTOTYPE then Errno_EPROTOTYPEExt
164
+ # when Errno::ERANGE then Errno_ERANGEExt
165
+ # when Errno::EREMCHG then Errno_EREMCHGExt
166
+ # when Errno::EREMOTE then Errno_EREMOTEExt
167
+ # when Errno::EREMOTEIO then Errno_EREMOTEIOExt
168
+ # when Errno::ERESTART then Errno_ERESTARTExt
169
+ # when Errno::ERFKILL then Errno_ERFKILLExt
170
+ # when Errno::EROFS then Errno_EROFSExt
171
+ # when Errno::ERPCMISMATCH then Errno_ERPCMISMATCHExt
172
+ # when Errno::ESHUTDOWN then Errno_ESHUTDOWNExt
173
+ # when Errno::ESOCKTNOSUPPORT then Errno_ESOCKTNOSUPPORTExt
174
+ # when Errno::ESPIPE then Errno_ESPIPEExt
175
+ # when Errno::ESRCH then Errno_ESRCHExt
176
+ # when Errno::ESRMNT then Errno_ESRMNTExt
177
+ # when Errno::ESTALE then Errno_ESTALEExt
178
+ # when Errno::ESTRPIPE then Errno_ESTRPIPEExt
179
+ # when Errno::ETIME then Errno_ETIMEExt
180
+ # when Errno::ETIMEDOUT then Errno_ETIMEDOUTExt
181
+ # when Errno::ETOOMANYREFS then Errno_ETOOMANYREFSExt
182
+ # when Errno::ETXTBSY then Errno_ETXTBSYExt
183
+ # when Errno::EUCLEAN then Errno_EUCLEANExt
184
+ # when Errno::EUNATCH then Errno_EUNATCHExt
185
+ # when Errno::EUSERS then Errno_EUSERSExt
186
+ # when Errno::EWOULDBLOCK then Errno_EWOULDBLOCKExt
187
+ # when Errno::EXDEV then Errno_EXDEVExt
188
+ # when Errno::EXFULL then Errno_EXFULLExt
189
+ # when Errno::EXXX then Errno_EXXXExt
190
+ # when Errno::NOERROR then Errno_NOERRORExt
191
+ # when SystemCallError then SystemCallErrorExt
192
+ # when ThreadError then ThreadErrorExt
193
+ # when TypeError then TypeErrorExt
194
+ # when ZeroDivisionError then ZeroDivisionErrorExt
195
+ # when StandardError then StandardErrorExt
196
+ # when SystemStackError then SystemStackErrorExt
197
+ end
198
+ return ext if ext
199
+ # ext = case exception.class.to_s
200
+ # when "FrozenError" then FrozenErrorExt
201
+ # when "GemOriginalError" then GemOriginalErrorExt
202
+ # end
203
+ return ext
204
+ end
205
+
206
+ module ExceptionExt
207
+ def eturem_location_to_s(location)
208
+ super
209
+ end
210
+
211
+ def eturem_traceback(order = :bottom)
212
+ super
213
+ end
214
+ end
215
+ end
@@ -0,0 +1,11 @@
1
+ # coding: utf-8
2
+
3
+ module Eturem
4
+ module Base
5
+ def self.warning_message(path, lineno, warning)
6
+ script_lines = Eturem::Base.read_script(path)
7
+ script = Eturem::Base.script(script_lines, [lineno], lineno)
8
+ "#{path}:#{lineno}: warning: #{warning}\n" + script
9
+ end
10
+ end
11
+ end
data/lib/eturem/ja.rb CHANGED
@@ -1,383 +1,2 @@
1
- # coding: utf-8
2
-
3
- require "eturem/base"
4
-
5
- module Eturem
6
- class Ja < Base
7
-
8
- @inspect_methods = {
9
- NoMemoryError => :no_memory_error_inspect,
10
- #ScriptError => :script_error_inspect,
11
- LoadError => :load_error_inspect,
12
- #NotImplementedError => :not_implemented_error_inspect,
13
- SyntaxError => :syntax_error_inspect,
14
- #SecurityError => :security_error_inspect,
15
- #SignalException => :signal_exception_inspect,
16
- #Interrupt => :interrupt_inspect,
17
- #StandardError => :standard_error_inspect,
18
- ArgumentError => :argument_error_inspect,
19
- UncaughtThrowError => nil,
20
- #EncodingError => :encoding_error_inspect,
21
- #Encoding::CompatibilityError => :encoding_compatibility_error_inspect,
22
- #Encoding::ConverterNotFoundError => :encoding_converter_not_found_error_inspect,
23
- #Encoding::InvalidByteSequenceError => :encoding_invalid_byte_sequence_error_inspect,
24
- #Encoding::UndefinedConversionError => :encoding_undefined_conversion_error_inspect,
25
- #FiberError => :fiber_error_inspect,
26
- #IOError => :io_error_inspect,
27
- #EOFError => :eof_error_inspect,
28
- #IndexError => :index_error_inspect,
29
- #KeyError => :key_error_inspect,
30
- #StopIteration => :stop_iteration_inspect,
31
- #ClosedQueueError => :closed_queue_error_inspect,
32
- #LocalJumpError => :local_jump_error_inspect,
33
- #Math::DomainError => :math_domain_error_inspect,
34
- NameError => :name_error_inspect,
35
- #NoMethodError => :no_method_error_inspect,
36
- #RangeError => :range_error_inspect,
37
- #FloatDomainError => :float_domain_error_inspect,
38
- #RegexpError => :regexp_error_inspect,
39
- #RuntimeError => :runtime_error_inspect,
40
- #FrozenError => :frozen_error_inspect,
41
- #SystemCallError => :system_call_error_inspect,
42
- #Errno::E2BIG => :errno_e2big_inspect,
43
- #Errno::EACCES => :errno_eacces_inspect,
44
- #Errno::EADDRINUSE => :errno_eaddrinuse_inspect,
45
- #Errno::EADDRNOTAVAIL => :errno_eaddrnotavail_inspect,
46
- #Errno::EADV => :errno_eadv_inspect,
47
- #Errno::EAFNOSUPPORT => :errno_eafnosupport_inspect,
48
- #Errno::EAGAIN => :errno_eagain_inspect,
49
- #Errno::EALREADY => :errno_ealready_inspect,
50
- #Errno::EAUTH => :errno_eauth_inspect,
51
- #Errno::EBADE => :errno_ebade_inspect,
52
- #Errno::EBADF => :errno_ebadf_inspect,
53
- #Errno::EBADFD => :errno_ebadfd_inspect,
54
- #Errno::EBADMSG => :errno_ebadmsg_inspect,
55
- #Errno::EBADR => :errno_ebadr_inspect,
56
- #Errno::EBADRPC => :errno_ebadrpc_inspect,
57
- #Errno::EBADRQC => :errno_ebadrqc_inspect,
58
- #Errno::EBADSLT => :errno_ebadslt_inspect,
59
- #Errno::EBFONT => :errno_ebfont_inspect,
60
- #Errno::EBUSY => :errno_ebusy_inspect,
61
- #Errno::ECANCELED => :errno_ecanceled_inspect,
62
- #Errno::ECAPMODE => :errno_ecapmode_inspect,
63
- #Errno::ECHILD => :errno_echild_inspect,
64
- #Errno::ECHRNG => :errno_echrng_inspect,
65
- #Errno::ECOMM => :errno_ecomm_inspect,
66
- #Errno::ECONNABORTED => :errno_econnaborted_inspect,
67
- #Errno::ECONNREFUSED => :errno_econnrefused_inspect,
68
- #Errno::ECONNRESET => :errno_econnreset_inspect,
69
- #Errno::EDEADLK => :errno_edeadlk_inspect,
70
- #Errno::EDEADLOCK => :errno_edeadlock_inspect,
71
- #Errno::EDESTADDRREQ => :errno_edestaddrreq_inspect,
72
- #Errno::EDOM => :errno_edom_inspect,
73
- #Errno::EDOOFUS => :errno_edoofus_inspect,
74
- #Errno::EDOTDOT => :errno_edotdot_inspect,
75
- #Errno::EDQUOT => :errno_edquot_inspect,
76
- #Errno::EEXIST => :errno_eexist_inspect,
77
- #Errno::EFAULT => :errno_efault_inspect,
78
- #Errno::EFBIG => :errno_efbig_inspect,
79
- #Errno::EFTYPE => :errno_eftype_inspect,
80
- #Errno::EHOSTDOWN => :errno_ehostdown_inspect,
81
- #Errno::EHOSTUNREACH => :errno_ehostunreach_inspect,
82
- #Errno::EHWPOISON => :errno_ehwpoison_inspect,
83
- #Errno::EIDRM => :errno_eidrm_inspect,
84
- #Errno::EILSEQ => :errno_eilseq_inspect,
85
- #Errno::EINPROGRESS => :errno_einprogress_inspect,
86
- #Errno::EINTR => :errno_eintr_inspect,
87
- #Errno::EINVAL => :errno_einval_inspect,
88
- #Errno::EIO => :errno_Eio_inspect,
89
- #Errno::EIPSEC => :errno_eipsec_inspect,
90
- #Errno::EISCONN => :errno_eisconn_inspect,
91
- #Errno::EISDIR => :errno_eisdir_inspect,
92
- #Errno::EISNAM => :errno_eisnam_inspect,
93
- #Errno::EKEYEXPIRED => :errno_ekeyexpired_inspect,
94
- #Errno::EKEYREJECTED => :errno_ekeyrejected_inspect,
95
- #Errno::EKEYREVOKED => :errno_ekeyrevoked_inspect,
96
- #Errno::EL2HLT => :errno_el2hlt_inspect,
97
- #Errno::EL2NSYNC => :errno_el2nsync_inspect,
98
- #Errno::EL3HLT => :errno_el3hlt_inspect,
99
- #Errno::EL3RST => :errno_el3rst_inspect,
100
- #Errno::ELIBACC => :errno_elibacc_inspect,
101
- #Errno::ELIBBAD => :errno_elibbad_inspect,
102
- #Errno::ELIBEXEC => :errno_elibexec_inspect,
103
- #Errno::ELIBMAX => :errno_elibmax_inspect,
104
- #Errno::ELIBSCN => :errno_elibscn_inspect,
105
- #Errno::ELNRNG => :errno_elnrng_inspect,
106
- #Errno::ELOOP => :errno_eloop_inspect,
107
- #Errno::EMEDIUMTYPE => :errno_emediumtype_inspect,
108
- #Errno::EMFILE => :errno_emfile_inspect,
109
- #Errno::EMLINK => :errno_emlink_inspect,
110
- #Errno::EMSGSIZE => :errno_emsgsize_inspect,
111
- #Errno::EMULTIHOP => :errno_emultihop_inspect,
112
- #Errno::ENAMETOOLONG => :errno_enametoolong_inspect,
113
- #Errno::ENAVAIL => :errno_enavail_inspect,
114
- #Errno::ENEEDAUTH => :errno_eneedauth_inspect,
115
- #Errno::ENETDOWN => :errno_enetdown_inspect,
116
- #Errno::ENETRESET => :errno_enetreset_inspect,
117
- #Errno::ENETUNREACH => :errno_enetunreach_inspect,
118
- #Errno::ENFILE => :errno_enfile_inspect,
119
- #Errno::ENOANO => :errno_enoano_inspect,
120
- #Errno::ENOATTR => :errno_enoattr_inspect,
121
- #Errno::ENOBUFS => :errno_enobufs_inspect,
122
- #Errno::ENOCSI => :errno_enocsi_inspect,
123
- #Errno::ENODATA => :errno_enodata_inspect,
124
- #Errno::ENODEV => :errno_enodev_inspect,
125
- Errno::ENOENT => :errno_enoent_inspect,
126
- #Errno::ENOEXEC => :errno_enoexec_inspect,
127
- #Errno::ENOKEY => :errno_enokey_inspect,
128
- #Errno::ENOLCK => :errno_enolck_inspect,
129
- #Errno::ENOLINK => :errno_enolink_inspect,
130
- #Errno::ENOMEDIUM => :errno_enomedium_inspect,
131
- #Errno::ENOMEM => :errno_enomem_inspect,
132
- #Errno::ENOMSG => :errno_enomsg_inspect,
133
- #Errno::ENONET => :errno_enonet_inspect,
134
- #Errno::ENOPKG => :errno_enopkg_inspect,
135
- #Errno::ENOPROTOOPT => :errno_enoprotoopt_inspect,
136
- #Errno::ENOSPC => :errno_enospc_inspect,
137
- #Errno::ENOSR => :errno_enosr_inspect,
138
- #Errno::ENOSTR => :errno_enostr_inspect,
139
- #Errno::ENOSYS => :errno_enosys_inspect,
140
- #Errno::ENOTBLK => :errno_enotblk_inspect,
141
- #Errno::ENOTCAPABLE => :errno_enotcapable_inspect,
142
- #Errno::ENOTCONN => :errno_enotconn_inspect,
143
- #Errno::ENOTDIR => :errno_enotdir_inspect,
144
- #Errno::ENOTEMPTY => :errno_enotempty_inspect,
145
- #Errno::ENOTNAM => :errno_enotnam_inspect,
146
- #Errno::ENOTRECOVERABLE => :errno_enotrecoverable_inspect,
147
- #Errno::ENOTSOCK => :errno_enotsock_inspect,
148
- #Errno::ENOTSUP => :errno_enotsup_inspect,
149
- #Errno::ENOTTY => :errno_enotty_inspect,
150
- #Errno::ENOTUNIQ => :errno_enotuniq_inspect,
151
- #Errno::ENXIO => :errno_enxio_inspect,
152
- #Errno::EOPNOTSUPP => :errno_eopnotsupp_inspect,
153
- #Errno::EOVERFLOW => :errno_eoverflow_inspect,
154
- #Errno::EOWNERDEAD => :errno_eownerdead_inspect,
155
- #Errno::EPERM => :errno_eperm_inspect,
156
- #Errno::EPFNOSUPPORT => :errno_epfnosupport_inspect,
157
- #Errno::EPIPE => :errno_epipe_inspect,
158
- #Errno::EPROCLIM => :errno_eproclim_inspect,
159
- #Errno::EPROCUNAVAIL => :errno_eprocunavail_inspect,
160
- #Errno::EPROGMISMATCH => :errno_eprogmismatch_inspect,
161
- #Errno::EPROGUNAVAIL => :errno_eprogunavail_inspect,
162
- #Errno::EPROTO => :errno_eproto_inspect,
163
- #Errno::EPROTONOSUPPORT => :errno_eprotonosupport_inspect,
164
- #Errno::EPROTOTYPE => :errno_eprototype_inspect,
165
- #Errno::ERANGE => :errno_erange_inspect,
166
- #Errno::EREMCHG => :errno_eremchg_inspect,
167
- #Errno::EREMOTE => :errno_eremote_inspect,
168
- #Errno::EREMOTEIO => :errno_eremoteio_inspect,
169
- #Errno::ERESTART => :errno_erestart_inspect,
170
- #Errno::ERFKILL => :errno_erfkill_inspect,
171
- #Errno::EROFS => :errno_erofs_inspect,
172
- #Errno::ERPCMISMATCH => :errno_erpcmismatch_inspect,
173
- #Errno::ESHUTDOWN => :errno_eshutdown_inspect,
174
- #Errno::ESOCKTNOSUPPORT => :errno_esocktnosupport_inspect,
175
- #Errno::ESPIPE => :errno_espipe_inspect,
176
- #Errno::ESRCH => :errno_esrch_inspect,
177
- #Errno::ESRMNT => :errno_esrmnt_inspect,
178
- #Errno::ESTALE => :errno_estale_inspect,
179
- #Errno::ESTRPIPE => :errno_estrpipe_inspect,
180
- #Errno::ETIME => :errno_etime_inspect,
181
- #Errno::ETIMEDOUT => :errno_etimedout_inspect,
182
- #Errno::ETOOMANYREFS => :errno_etoomanyrefs_inspect,
183
- #Errno::ETXTBSY => :errno_etxtbsy_inspect,
184
- #Errno::EUCLEAN => :errno_euclean_inspect,
185
- #Errno::EUNATCH => :errno_eunatch_inspect,
186
- #Errno::EUSERS => :errno_eusers_inspect,
187
- #Errno::EWOULDBLOCK => :errno_ewouldblock_inspect,
188
- #Errno::EXDEV => :errno_exdev_inspect,
189
- #Errno::EXFULL => :errno_exfull_inspect,
190
- #Errno::EXXX => :errno_exxx_inspect,
191
- #Errno::NOERROR => :errno_noerror_inspect,
192
- #ThreadError => :thread_error_inspect,
193
- TypeError => :type_error_inspect,
194
- ZeroDivisionError => :zero_division_error_inspect,
195
- SystemStackError => :system_stack_error_inspect,
196
- "sentinel" => nil
197
- }
198
-
199
- def prepare
200
- super
201
- case @exception.class.to_s
202
- when "DXRuby::DXRubyError"
203
- @exception_s.force_encoding("sjis") if @exception_s.encoding == Encoding::ASCII_8BIT
204
- @exception_s.encode!("UTF-8")
205
- end
206
- end
207
-
208
- def traceback_most_recent_call_last
209
- "Traceback(エラー発生までの流れを直前のものほど下に表示しています。):"
210
- end
211
-
212
- def location_inspect(location)
213
- %<"#{location.path}" #{location.lineno}行目: '#{location.label}'>
214
- end
215
-
216
- def exception_inspect
217
- error_message = super
218
- error_message = "#{@exception_s} (#{@exception.class})" if error_message.empty?
219
- return "\e[1;31m【エラー】\e[0m" +
220
- (@path == "(eval)" ? "eval 中の" : %<ファイル"#{@path}">) +
221
- " #{@lineno}行目:\n#{error_message}"
222
- end
223
-
224
- def no_memory_error_inspect
225
- "メモリを確保できませんでした。あまりにも大量のデータを作成していませんか?"
226
- end
227
-
228
- def load_error_inspect
229
- %<ファイル/ライブラリ "#{@exception.path}" が見つかりません。> +
230
- %<ファイル/ライブラリ名を確認してください。>
231
- end
232
-
233
- def syntax_error_inspect
234
- if @exception_s.match(/unexpected (?<unexpected>(?:','|[^,])+)/)
235
- unexpected = transform_syntax_error_keyword(Regexp.last_match(:unexpected))
236
- expecting = ["end-of-input"]
237
- if @exception_s.match(/[,\s]expecting (?<expecting>\S+)/)
238
- expecting = Regexp.last_match(:expecting).split(/\s+or\s+/).map do |exp|
239
- transform_syntax_error_keyword(exp)
240
- end
241
- end
242
- if unexpected.match(/^'(.)'$/)
243
- @decoration[@lineno] = [Regexp.last_match(1), "\e[1;31m\e[4m"]
244
- elsif
245
- @decoration[@lineno] = [unexpected, "\e[1;31m\e[4m"]
246
- end
247
-
248
- keywords = %w[if unless case while until for begin def class module do].select do |keyword|
249
- @script_lines.join.index(keyword)
250
- end
251
- keywords = "「#{keywords.join(' / ')}」"
252
- keywords = "ifなど" if keywords == "「」"
253
- if unexpected == "end-of-input"
254
- ret = "(ただし、実際のエラーの原因はおそらくもっと前にあります。)\n" +
255
- "構文エラーです。#{expecting.join('または')}が足りません。"
256
- ret += "#{keywords}に対応する「end」があるか確認してください。" if expecting.include?("end")
257
- return ret
258
- elsif expecting.join == "end-of-input"
259
- ret = "構文エラーです。余分な#{unexpected}があります。"
260
- ret += "#{keywords}と「end」の対応関係を確認してください。" if unexpected == "end"
261
- return ret
262
- elsif !expecting.empty?
263
- return "構文エラーです。#{expecting.join('または')}が来るべき場所に、" +
264
- "#{unexpected}が来てしまいました。"
265
- end
266
- return ""
267
- elsif @exception_s.match(/Invalid (?<invalid>(?:break|next|retry|redo|yield))/)
268
- invalid = Regexp.last_match(:invalid)
269
- @decoration[@lineno] = [invalid, "\e[1;31m\e[4m"]
270
- return "#{invalid} が不適切な場所にあります。"
271
- elsif @exception_s.match(/unterminated string meets end of file/)
272
- return "「\"」「'」が閉じられていません。"
273
- elsif @exception_s.match(/unterminated regexp meets end of file/)
274
- return "「/」が閉じられていません。"
275
- else
276
- return ""
277
- end
278
- end
279
-
280
- def transform_syntax_error_keyword(keyword)
281
- case keyword
282
- when "end-of-input", "$end"
283
- "end-of-input"
284
- when /^(?:keyword|modifier)_/
285
- Regexp.last_match.post_match
286
- when "'\\n'"
287
- "改行"
288
- else
289
- keyword
290
- end
291
- end
292
-
293
- def interrupt_inspect
294
- "プログラムが途中で強制終了されました。"
295
- end
296
-
297
- def argument_error_inspect
298
- if @exception_s.match(/given (?<given>\d+), expected (?<expected>[^)]+)/)
299
- given = Regexp.last_match(:given).to_i
300
- expected = Regexp.last_match(:expected)
301
- ret = "引数の数が正しくありません。「#{@method}」は本来"
302
- case expected
303
- when "0"
304
- ret << "引数が不要です"
305
- when /^(\d+)\.\.(\d+)$/
306
- ret << "#{Regexp.last_match(1)}~#{Regexp.last_match(2)}個の引数を取ります"
307
- when /^(\d+)\+$/
308
- ret << "#{Regexp.last_match(1)}個以上の引数を取ります"
309
- else
310
- ret << "#{expected}個の引数を取ります"
311
- end
312
- if given == 0
313
- ret << "が、引数が1つも渡されていません。"
314
- else
315
- ret << "が、#{given}個の引数が渡されています。"
316
- end
317
- return ret
318
- else
319
- return "「#{@method}」への引数が正しくありません。"
320
- end
321
- end
322
-
323
- def uncaught_throw_error_inspect
324
- return ""
325
- end
326
-
327
- def name_error_inspect
328
- if @exception.name.to_s.encode("UTF-8").include?(" ")
329
- @decoration[@lineno] = [/ +/, "\e[1;31m\e[4m"]
330
- return "スクリプト中に全角空白が混じっています。"
331
- end
332
-
333
- if @exception.receiver == nil
334
- ret = "nil に対して #{@exception.name} というメソッドを呼び出そうとしています。\n"
335
- ret << "変数の値/メソッドの返値が予期せず nil になっている可能性があります。"
336
- return ret
337
- end
338
-
339
- ret = "#{@exception.is_a?(NoMethodError) ? "" : "変数/"}メソッド" +
340
- "「\e[1;31m\e[4m#{@exception.name}\e[0m」は存在しません。"
341
- if @did_you_mean
342
- did_you_mean = @did_you_mean.map{ |d| "\e[1;33m#{d}\e[0m" }.join(" / ")
343
- ret << "「#{did_you_mean}」の入力ミスではありませんか?"
344
- end
345
- return ret
346
- end
347
-
348
- def errno_enoent_inspect
349
- "ファイルアクセスに失敗しました。ファイルがありません。"
350
- end
351
-
352
- def type_error_inspect
353
- "「#{@label}」への引数のタイプ(型)が正しくありません。"
354
- end
355
-
356
- def zero_division_error_inspect
357
- "割る数が 0 での割り算はできません。"
358
- end
359
-
360
- def system_stack_error_inspect
361
- "システムスタックがあふれました。意図しない無限ループが生じている可能性があります。"
362
- end
363
-
364
- def warning_message(file, line, warning)
365
- message = super
366
- case warning
367
- when "found `= literal' in conditional, should be =="
368
- original, script = message.split("\n", 2)
369
- message = @@output_original ? "#{original}\n" : ""
370
- message += "\e[1;31m【警告】\e[0m" +
371
- (file == "(eval)" ? "eval 中の" : %<ファイル"#{file}">) +
372
- " #{line}行目:\n" +
373
- "条件式部分で「 = 」が使われています。「 == 」の間違いではありませんか?\n"
374
- message += @@output_script ? script : "\n"
375
- end
376
- return message
377
- end
378
- end
379
-
380
- @eturem_class = Ja
381
- end
382
-
1
+ require "eturem/ja/main"
383
2
  require "eturem"