* parse.y, transcode_data.h, transcode.c: change "illegal" to
"invalid" in a context which doesn' t against a law. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd640aec82
commit
efd7504d44
@ -1,3 +1,8 @@
|
|||||||
|
Thu Dec 27 17:25:27 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* parse.y, transcode_data.h, transcode.c: change "illegal" to
|
||||||
|
"invalid" in a context which doesn' t against a law.
|
||||||
|
|
||||||
Thu Dec 27 16:37:06 2007 Tanaka Akira <akr@fsij.org>
|
Thu Dec 27 16:37:06 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* re.c (rb_reg_s_union): show encodings in error message.
|
* re.c (rb_reg_s_union): show encodings in error message.
|
||||||
|
2
parse.y
2
parse.y
@ -6621,7 +6621,7 @@ parser_yylex(struct parser_params *parser)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c > '7' && c <= '9') {
|
if (c > '7' && c <= '9') {
|
||||||
yyerror("Illegal octal digit");
|
yyerror("Invalid octal digit");
|
||||||
}
|
}
|
||||||
else if (c == '.' || c == 'e' || c == 'E') {
|
else if (c == '.' || c == 'e' || c == 'E') {
|
||||||
tokadd('0');
|
tokadd('0');
|
||||||
|
16
transcode.c
16
transcode.c
@ -183,14 +183,14 @@ transcode_loop(char **in_pos, char **out_pos,
|
|||||||
if (in_p >= in_stop) {
|
if (in_p >= in_stop) {
|
||||||
/* todo: deal with the case of backtracking */
|
/* todo: deal with the case of backtracking */
|
||||||
/* todo: deal with incomplete input (streaming) */
|
/* todo: deal with incomplete input (streaming) */
|
||||||
goto illegal;
|
goto invalid;
|
||||||
}
|
}
|
||||||
next_byte = (unsigned char)*in_p++;
|
next_byte = (unsigned char)*in_p++;
|
||||||
if (from_utf8) {
|
if (from_utf8) {
|
||||||
if ((next_byte&0xC0) == 0x80)
|
if ((next_byte&0xC0) == 0x80)
|
||||||
next_byte -= 0x80;
|
next_byte -= 0x80;
|
||||||
else
|
else
|
||||||
goto illegal;
|
goto invalid;
|
||||||
}
|
}
|
||||||
next_table = next_table->info[next_offset];
|
next_table = next_table->info[next_offset];
|
||||||
goto follow_byte;
|
goto follow_byte;
|
||||||
@ -211,18 +211,18 @@ transcode_loop(char **in_pos, char **out_pos,
|
|||||||
*out_p++ = getBT2(next_info);
|
*out_p++ = getBT2(next_info);
|
||||||
*out_p++ = getBT3(next_info);
|
*out_p++ = getBT3(next_info);
|
||||||
continue;
|
continue;
|
||||||
case ILLEGAL:
|
case INVALID:
|
||||||
goto illegal;
|
goto invalid;
|
||||||
case UNDEF:
|
case UNDEF:
|
||||||
/* todo: add code for alternative behaviors */
|
/* todo: add code for alternative behaviors */
|
||||||
rb_raise(rb_eRuntimeError /*@@@change exception*/, "conversion undefined for byte sequence (maybe illegal byte sequence)");
|
rb_raise(rb_eRuntimeError /*@@@change exception*/, "conversion undefined for byte sequence (maybe invalid byte sequence)");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
illegal:
|
invalid:
|
||||||
/* deal with illegal byte sequence */
|
/* deal with invalid byte sequence */
|
||||||
/* todo: add code for alternative behaviors */
|
/* todo: add code for alternative behaviors */
|
||||||
rb_raise(rb_eRuntimeError /*change exception*/, "illegal byte sequence");
|
rb_raise(rb_eRuntimeError /*change exception*/, "invalid byte sequence");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
@ -32,7 +32,7 @@ typedef struct byte_lookup {
|
|||||||
#define TWObt (0x03) /* two bytes payload */
|
#define TWObt (0x03) /* two bytes payload */
|
||||||
#define THREEbt (0x05) /* three bytes payload */
|
#define THREEbt (0x05) /* three bytes payload */
|
||||||
#define FOURbt (0x06) /* four bytes payload, UTF-8 only, macros start at getBT0 */
|
#define FOURbt (0x06) /* four bytes payload, UTF-8 only, macros start at getBT0 */
|
||||||
#define ILLEGAL (PType 0x07) /* illegal byte sequence */
|
#define INVALID (PType 0x07) /* invalid byte sequence */
|
||||||
#define UNDEF (PType 0x09) /* legal but undefined */
|
#define UNDEF (PType 0x09) /* legal but undefined */
|
||||||
#define ZERObt (PType 0x0A) /* zero bytes of payload, i.e. remove */
|
#define ZERObt (PType 0x0A) /* zero bytes of payload, i.e. remove */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user