eturem 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
-
212
- Eturem.eturem_class = self
213
- end
214
- end
215
-
1
+ require "eturem/en/main"
216
2
  require "eturem"
@@ -0,0 +1,213 @@
1
+ require "eturem/base"
2
+ Dir[File.expand_path("..", __FILE__) + "/*.rb"].each do |path|
3
+ require path unless path == File.expand_path(__FILE__)
4
+ end
5
+
6
+ module Eturem
7
+ def self._extend_exception(exception)
8
+ ext = case exception
9
+ # when NoMemoryError then NoMemoryErrorExt
10
+ # when LoadError then LoadErrorExt
11
+ # when NotImplementedError then NotImplementedErrorExt
12
+ when SyntaxError then SyntaxErrorExt
13
+ # when ScriptError then ScriptErrorExt
14
+ # when SecurityError then SecurityErrorExt
15
+ # when Interrupt then InterruptExt
16
+ # when SignalException then SignalExceptionExt
17
+ # when UncaughtThrowError then UncaughtThrowErrorExt
18
+ when ArgumentError then ArgumentErrorExt
19
+ # when Encoding::CompatibilityError then Encoding_CompatibilityErrorExt
20
+ # when Encoding::ConverterNotFoundError then Encoding_ConverterNotFoundErrorExt
21
+ # when Encoding::InvalidByteSequenceError then Encoding_InvalidByteSequenceErrorExt
22
+ # when Encoding::UndefinedConversionError then Encoding_UndefinedConversionErrorExt
23
+ # when EncodingError then EncodingErrorExt
24
+ # when FiberError then FiberErrorExt
25
+ # when EOFError then EOFErrorExt
26
+ # when IOError then IOErrorExt
27
+ # when KeyError then KeyErrorExt
28
+ # when ClosedQueueError then ClosedQueueErrorExt
29
+ # when StopIteration then StopIterationExt
30
+ # when IndexError then IndexErrorExt
31
+ # when LocalJumpError then LocalJumpErrorExt
32
+ # when Math::DomainError then Math_DomainErrorExt
33
+ # when NoMethodError then NoMethodErrorExt
34
+ when NameError then NameErrorExt
35
+ # when FloatDomainError then FloatDomainErrorExt
36
+ # when RangeError then RangeErrorExt
37
+ # when RegexpError then RegexpErrorExt
38
+ # when RuntimeError then RuntimeErrorExt
39
+ # when Errno::E2BIG then Errno_E2BIGExt
40
+ # when Errno::EACCES then Errno_EACCESExt
41
+ # when Errno::EADDRINUSE then Errno_EADDRINUSEExt
42
+ # when Errno::EADDRNOTAVAIL then Errno_EADDRNOTAVAILExt
43
+ # when Errno::EADV then Errno_EADVExt
44
+ # when Errno::EAFNOSUPPORT then Errno_EAFNOSUPPORTExt
45
+ # when Errno::EAGAIN then Errno_EAGAINExt
46
+ # when Errno::EALREADY then Errno_EALREADYExt
47
+ # when Errno::EAUTH then Errno_EAUTHExt
48
+ # when Errno::EBADE then Errno_EBADEExt
49
+ # when Errno::EBADF then Errno_EBADFExt
50
+ # when Errno::EBADFD then Errno_EBADFDExt
51
+ # when Errno::EBADMSG then Errno_EBADMSGExt
52
+ # when Errno::EBADR then Errno_EBADRExt
53
+ # when Errno::EBADRPC then Errno_EBADRPCExt
54
+ # when Errno::EBADRQC then Errno_EBADRQCExt
55
+ # when Errno::EBADSLT then Errno_EBADSLTExt
56
+ # when Errno::EBFONT then Errno_EBFONTExt
57
+ # when Errno::EBUSY then Errno_EBUSYExt
58
+ # when Errno::ECANCELED then Errno_ECANCELEDExt
59
+ # when Errno::ECAPMODE then Errno_ECAPMODEExt
60
+ # when Errno::ECHILD then Errno_ECHILDExt
61
+ # when Errno::ECHRNG then Errno_ECHRNGExt
62
+ # when Errno::ECOMM then Errno_ECOMMExt
63
+ # when Errno::ECONNABORTED then Errno_ECONNABORTEDExt
64
+ # when Errno::ECONNREFUSED then Errno_ECONNREFUSEDExt
65
+ # when Errno::ECONNRESET then Errno_ECONNRESETExt
66
+ # when Errno::EDEADLK then Errno_EDEADLKExt
67
+ # when Errno::EDEADLOCK then Errno_EDEADLOCKExt
68
+ # when Errno::EDESTADDRREQ then Errno_EDESTADDRREQExt
69
+ # when Errno::EDOM then Errno_EDOMExt
70
+ # when Errno::EDOOFUS then Errno_EDOOFUSExt
71
+ # when Errno::EDOTDOT then Errno_EDOTDOTExt
72
+ # when Errno::EDQUOT then Errno_EDQUOTExt
73
+ # when Errno::EEXIST then Errno_EEXISTExt
74
+ # when Errno::EFAULT then Errno_EFAULTExt
75
+ # when Errno::EFBIG then Errno_EFBIGExt
76
+ # when Errno::EFTYPE then Errno_EFTYPEExt
77
+ # when Errno::EHOSTDOWN then Errno_EHOSTDOWNExt
78
+ # when Errno::EHOSTUNREACH then Errno_EHOSTUNREACHExt
79
+ # when Errno::EHWPOISON then Errno_EHWPOISONExt
80
+ # when Errno::EIDRM then Errno_EIDRMExt
81
+ # when Errno::EILSEQ then Errno_EILSEQExt
82
+ # when Errno::EINPROGRESS then Errno_EINPROGRESSExt
83
+ # when Errno::EINTR then Errno_EINTRExt
84
+ # when Errno::EINVAL then Errno_EINVALExt
85
+ # when Errno::EIO then Errno_EIOExt
86
+ # when Errno::EIPSEC then Errno_EIPSECExt
87
+ # when Errno::EISCONN then Errno_EISCONNExt
88
+ # when Errno::EISDIR then Errno_EISDIRExt
89
+ # when Errno::EISNAM then Errno_EISNAMExt
90
+ # when Errno::EKEYEXPIRED then Errno_EKEYEXPIREDExt
91
+ # when Errno::EKEYREJECTED then Errno_EKEYREJECTEDExt
92
+ # when Errno::EKEYREVOKED then Errno_EKEYREVOKEDExt
93
+ # when Errno::EL2HLT then Errno_EL2HLTExt
94
+ # when Errno::EL2NSYNC then Errno_EL2NSYNCExt
95
+ # when Errno::EL3HLT then Errno_EL3HLTExt
96
+ # when Errno::EL3RST then Errno_EL3RSTExt
97
+ # when Errno::ELIBACC then Errno_ELIBACCExt
98
+ # when Errno::ELIBBAD then Errno_ELIBBADExt
99
+ # when Errno::ELIBEXEC then Errno_ELIBEXECExt
100
+ # when Errno::ELIBMAX then Errno_ELIBMAXExt
101
+ # when Errno::ELIBSCN then Errno_ELIBSCNExt
102
+ # when Errno::ELNRNG then Errno_ELNRNGExt
103
+ # when Errno::ELOOP then Errno_ELOOPExt
104
+ # when Errno::EMEDIUMTYPE then Errno_EMEDIUMTYPEExt
105
+ # when Errno::EMFILE then Errno_EMFILEExt
106
+ # when Errno::EMLINK then Errno_EMLINKExt
107
+ # when Errno::EMSGSIZE then Errno_EMSGSIZEExt
108
+ # when Errno::EMULTIHOP then Errno_EMULTIHOPExt
109
+ # when Errno::ENAMETOOLONG then Errno_ENAMETOOLONGExt
110
+ # when Errno::ENAVAIL then Errno_ENAVAILExt
111
+ # when Errno::ENEEDAUTH then Errno_ENEEDAUTHExt
112
+ # when Errno::ENETDOWN then Errno_ENETDOWNExt
113
+ # when Errno::ENETRESET then Errno_ENETRESETExt
114
+ # when Errno::ENETUNREACH then Errno_ENETUNREACHExt
115
+ # when Errno::ENFILE then Errno_ENFILEExt
116
+ # when Errno::ENOANO then Errno_ENOANOExt
117
+ # when Errno::ENOATTR then Errno_ENOATTRExt
118
+ # when Errno::ENOBUFS then Errno_ENOBUFSExt
119
+ # when Errno::ENOCSI then Errno_ENOCSIExt
120
+ # when Errno::ENODATA then Errno_ENODATAExt
121
+ # when Errno::ENODEV then Errno_ENODEVExt
122
+ # when Errno::ENOENT then Errno_ENOENTExt
123
+ # when Errno::ENOEXEC then Errno_ENOEXECExt
124
+ # when Errno::ENOKEY then Errno_ENOKEYExt
125
+ # when Errno::ENOLCK then Errno_ENOLCKExt
126
+ # when Errno::ENOLINK then Errno_ENOLINKExt
127
+ # when Errno::ENOMEDIUM then Errno_ENOMEDIUMExt
128
+ # when Errno::ENOMEM then Errno_ENOMEMExt
129
+ # when Errno::ENOMSG then Errno_ENOMSGExt
130
+ # when Errno::ENONET then Errno_ENONETExt
131
+ # when Errno::ENOPKG then Errno_ENOPKGExt
132
+ # when Errno::ENOPROTOOPT then Errno_ENOPROTOOPTExt
133
+ # when Errno::ENOSPC then Errno_ENOSPCExt
134
+ # when Errno::ENOSR then Errno_ENOSRExt
135
+ # when Errno::ENOSTR then Errno_ENOSTRExt
136
+ # when Errno::ENOSYS then Errno_ENOSYSExt
137
+ # when Errno::ENOTBLK then Errno_ENOTBLKExt
138
+ # when Errno::ENOTCAPABLE then Errno_ENOTCAPABLEExt
139
+ # when Errno::ENOTCONN then Errno_ENOTCONNExt
140
+ # when Errno::ENOTDIR then Errno_ENOTDIRExt
141
+ # when Errno::ENOTEMPTY then Errno_ENOTEMPTYExt
142
+ # when Errno::ENOTNAM then Errno_ENOTNAMExt
143
+ # when Errno::ENOTRECOVERABLE then Errno_ENOTRECOVERABLEExt
144
+ # when Errno::ENOTSOCK then Errno_ENOTSOCKExt
145
+ # when Errno::ENOTSUP then Errno_ENOTSUPExt
146
+ # when Errno::ENOTTY then Errno_ENOTTYExt
147
+ # when Errno::ENOTUNIQ then Errno_ENOTUNIQExt
148
+ # when Errno::ENXIO then Errno_ENXIOExt
149
+ # when Errno::EOPNOTSUPP then Errno_EOPNOTSUPPExt
150
+ # when Errno::EOVERFLOW then Errno_EOVERFLOWExt
151
+ # when Errno::EOWNERDEAD then Errno_EOWNERDEADExt
152
+ # when Errno::EPERM then Errno_EPERMExt
153
+ # when Errno::EPFNOSUPPORT then Errno_EPFNOSUPPORTExt
154
+ # when Errno::EPIPE then Errno_EPIPEExt
155
+ # when Errno::EPROCLIM then Errno_EPROCLIMExt
156
+ # when Errno::EPROCUNAVAIL then Errno_EPROCUNAVAILExt
157
+ # when Errno::EPROGMISMATCH then Errno_EPROGMISMATCHExt
158
+ # when Errno::EPROGUNAVAIL then Errno_EPROGUNAVAILExt
159
+ # when Errno::EPROTO then Errno_EPROTOExt
160
+ # when Errno::EPROTONOSUPPORT then Errno_EPROTONOSUPPORTExt
161
+ # when Errno::EPROTOTYPE then Errno_EPROTOTYPEExt
162
+ # when Errno::ERANGE then Errno_ERANGEExt
163
+ # when Errno::EREMCHG then Errno_EREMCHGExt
164
+ # when Errno::EREMOTE then Errno_EREMOTEExt
165
+ # when Errno::EREMOTEIO then Errno_EREMOTEIOExt
166
+ # when Errno::ERESTART then Errno_ERESTARTExt
167
+ # when Errno::ERFKILL then Errno_ERFKILLExt
168
+ # when Errno::EROFS then Errno_EROFSExt
169
+ # when Errno::ERPCMISMATCH then Errno_ERPCMISMATCHExt
170
+ # when Errno::ESHUTDOWN then Errno_ESHUTDOWNExt
171
+ # when Errno::ESOCKTNOSUPPORT then Errno_ESOCKTNOSUPPORTExt
172
+ # when Errno::ESPIPE then Errno_ESPIPEExt
173
+ # when Errno::ESRCH then Errno_ESRCHExt
174
+ # when Errno::ESRMNT then Errno_ESRMNTExt
175
+ # when Errno::ESTALE then Errno_ESTALEExt
176
+ # when Errno::ESTRPIPE then Errno_ESTRPIPEExt
177
+ # when Errno::ETIME then Errno_ETIMEExt
178
+ # when Errno::ETIMEDOUT then Errno_ETIMEDOUTExt
179
+ # when Errno::ETOOMANYREFS then Errno_ETOOMANYREFSExt
180
+ # when Errno::ETXTBSY then Errno_ETXTBSYExt
181
+ # when Errno::EUCLEAN then Errno_EUCLEANExt
182
+ # when Errno::EUNATCH then Errno_EUNATCHExt
183
+ # when Errno::EUSERS then Errno_EUSERSExt
184
+ # when Errno::EWOULDBLOCK then Errno_EWOULDBLOCKExt
185
+ # when Errno::EXDEV then Errno_EXDEVExt
186
+ # when Errno::EXFULL then Errno_EXFULLExt
187
+ # when Errno::EXXX then Errno_EXXXExt
188
+ # when Errno::NOERROR then Errno_NOERRORExt
189
+ # when SystemCallError then SystemCallErrorExt
190
+ # when ThreadError then ThreadErrorExt
191
+ # when TypeError then TypeErrorExt
192
+ # when ZeroDivisionError then ZeroDivisionErrorExt
193
+ # when StandardError then StandardErrorExt
194
+ # when SystemStackError then SystemStackErrorExt
195
+ end
196
+ return ext if ext
197
+ # ext = case exception.class.to_s
198
+ # when "FrozenError" then FrozenErrorExt
199
+ # when "GemOriginalError" then GemOriginalErrorExt
200
+ # end
201
+ return ext
202
+ end
203
+
204
+ module ExceptionExt
205
+ def eturem_location_to_s(location)
206
+ super
207
+ end
208
+
209
+ def eturem_traceback(order = :bottom)
210
+ super
211
+ end
212
+ end
213
+ 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
@@ -1,331 +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 => :uncaught_throw_error_inspect,
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
- "エラー発生までの流れ:"
210
- end
211
-
212
- def location_inspect(location)
213
- %["#{location.path}" #{location.lineno}行目: '#{location.label}']
214
- end
215
-
216
- def exception_inspect
217
- return %[ファイル"#{@path}" #{@lineno}行目でエラーが発生しました。\n] + super.to_s
218
- end
219
-
220
- def no_memory_error_inspect
221
- "メモリを確保できませんでした。あまりにも大量のデータを作成していませんか?"
222
- end
223
-
224
- def load_error_inspect
225
- %[ファイル/ライブラリ "#{@exception.path}" が見つかりません。] +
226
- %[ファイル/ライブラリ名を確認してください。]
227
- end
228
-
229
- def syntax_error_inspect
230
- if @unexpected.match(/^'(.)'$/)
231
- highlight!(@script_lines[@lineno], Regexp.last_match(1), "\e[1;31m\e[4m")
232
- elsif @unexpected.match(/^(?:keyword|modifier)_/)
233
- highlight!(@script_lines[@lineno], Regexp.last_match.post_match, "\e[1;31m\e[4m")
234
- end
235
- unexpected = transform_syntax_error_keyword(@unexpected)
236
- expected = @expected.split(/\s+or\s+/).map{ |ex| transform_syntax_error_keyword(ex) }
237
- keywords = %w[if unless case while until for begin def class module do].select{ |keyword|
238
- @script.index(keyword)
239
- }.join(" / ")
240
- keywords = keywords.empty? ? "ifなど" : "「#{keywords}」"
241
-
242
- if expected.join == "end-of-input"
243
- ret = "構文エラーです。余分な#{unexpected}があります。"
244
- ret += "#{keywords}と「end」の対応関係を確認してください。" if unexpected == "end"
245
- return ret
246
- elsif unexpected == "end-of-input"
247
- ret = "(ただし、実際のエラーの原因はおそらくもっと前にあります。)\n" +
248
- "構文エラーです。#{expected.join('または')}が足りません。"
249
- ret += "#{keywords}に対応する「end」があるか確認してください。" if expected.include?("end")
250
- return ret
251
- end
252
- return "構文エラーです。#{expected.join('または')}が来るべき場所に、" +
253
- "#{unexpected}が来てしまいました。"
254
- end
255
-
256
- def transform_syntax_error_keyword(keyword)
257
- case keyword
258
- when "end-of-input", "$end"
259
- "end-of-input"
260
- when /^(?:keyword|modifier)_/
261
- Regexp.last_match.post_match
262
- when "'\\n'"
263
- "改行"
264
- else
265
- keyword
266
- end
267
- end
268
-
269
- def interrupt_inspect
270
- "プログラムが途中で強制終了されました。"
271
- end
272
-
273
- def argument_error_inspect
274
- if @given
275
- ret = "引数の数が正しくありません。「#{@method}」は本来"
276
- case @expected
277
- when "0"
278
- ret += "引数が不要です"
279
- when /^(\d+)\.\.(\d+)$/
280
- ret += "#{Regexp.last_match(1)}~#{Regexp.last_match(2)}個の引数を取ります"
281
- when /^(\d+)\+$/
282
- ret += "#{Regexp.last_match(1)}個以上の引数を取ります"
283
- end
284
- if @given == 0
285
- ret += "が、引数が1つも渡されていません。"
286
- else
287
- ret += "が、#{@given}個の引数が渡されています。"
288
- end
289
- return ret
290
- else
291
- return "「#{@method}」への引数の数が正しくありません。"
292
- end
293
- end
294
-
295
- def name_error_inspect
296
- if @exception.name.to_s.encode("UTF-8").include?(" ")
297
- load_script
298
- highlight!(@script_lines[@lineno], @exception.name.to_s, "\e[1;31m\e[4m")
299
- return "スクリプト中に全角空白が混じっています。"
300
- end
301
-
302
- ret = "#{@exception.is_a?(NoMethodError) ? "" : "変数/"}メソッド" +
303
- "「\e[1;31m\e[4m#{@exception.name}\e[0m」は存在しません。"
304
- if @did_you_mean
305
- did_you_mean = @did_you_mean.map{ |d| "\e[1;33m#{d}\e[0m" }.join(" / ")
306
- ret += "「#{did_you_mean}」の入力ミスではありませんか?"
307
- end
308
- return ret
309
- end
310
-
311
- def errno_enoent_inspect
312
- "ファイルアクセスに失敗しました。ファイルがありません。"
313
- end
314
-
315
- def type_error_inspect
316
- "「#{@method}」への引数のタイプ(型)が正しくありません。"
317
- end
318
-
319
- def zero_division_error_inspect
320
- "割る数が 0 での割り算はできません。"
321
- end
322
-
323
- def system_stack_error_inspect
324
- "システムスタックがあふれました。意図しない無限ループが生じている可能性があります。"
325
- end
326
-
327
- Eturem.eturem_class = self
328
- end
329
- end
330
-
1
+ require "eturem/ja/main"
331
2
  require "eturem"