diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-25 08:23:34 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-25 08:23:34 +0000 |
commit | 3b359789b92085ea0d1a2231b3d8ef279be9b63d (patch) | |
tree | 69c44cffc0299d0fcf8be71968e384a882fba757 /regex.c | |
parent | 8640bc4bc6de045cca24be5de629ce2471eb4be4 (diff) |
* class.c (rb_include_module): detect cyclic module inclusion.
* eval.c (rb_thread_schedule): should check time only if BOTH
WAIT_SELECT and WAIT_TIME.
* string.c (rb_str_split_m): no need to consider KANJI
characters, if the length of separator is 1 (byte).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r-- | regex.c | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -370,13 +370,12 @@ enum regexpcode duplicate, /* Match a duplicate of something remembered. Followed by one byte containing the index of the memory register. */ - fail, /* always fails. */ wordchar, /* Matches any word-constituent character. */ notwordchar, /* Matches any char that is not a word-constituent. */ wordbeg, /* Succeeds if at word beginning. */ wordend, /* Succeeds if at word end. */ wordbound, /* Succeeds if at a word boundary. */ - notwordbound,/* Succeeds if not at a word boundary. */ + notwordbound /* Succeeds if not at a word boundary. */ }; @@ -461,7 +460,7 @@ re_set_syntax(syntax) int n = mbclen(c) - 1; \ c &= (1<<(BYTEWIDTH-2-n)) - 1; \ while (n--) { \ - c = c << 6 | *p++ & ((1<<6)-1); \ + c = c << 6 | (*p++ & ((1<<6)-1)); \ } \ } \ else { \ @@ -502,23 +501,28 @@ print_mbc(c) { if (current_mbctype == MBCTYPE_UTF8) { if (c < 0x80) - printf("%c", c); + printf("%c", (int)c); else if (c <= 0x7ff) - printf("%c%c", utf8_firstbyte(c), c&0x3f); + printf("%c%c", (int)utf8_firstbyte(c), (int)(c & 0x3f)); else if (c <= 0xffff) - printf("%c%c%c", utf8_firstbyte(c), (c>>6)&0x3f, c&0x3f); + printf("%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 6) & 0x3f), + (int)(c & 0x3f)); else if (c <= 0x1fffff) - printf("%c%c%c%c", utf8_firstbyte(c), (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); + printf("%c%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 12) & 0x3f), + (int)((c >> 6) & 0x3f), (int)(c & 0x3f)); else if (c <= 0x3ffffff) - printf("%c%c%c%c%c", utf8_firstbyte(c), (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); + printf("%c%c%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 18) & 0x3f), + (int)((c >> 12) & 0x3f), (int)((c >> 6) & 0x3f), (int)(c & 0x3f)); else if (c <= 0x7fffffff) - printf("%c%c%c%c%c%c", utf8_firstbyte(c), (c>>24)&0x3f, (c>>18)&0x3f, (c>>12)&0x3f, (c>>6)&0x3f, c&0x3f); + printf("%c%c%c%c%c%c", (int)utf8_firstbyte(c), (int)((c >> 24) & 0x3f), + (int)((c >> 18) & 0x3f), (int)((c >> 12) & 0x3f), + (int)((c >> 6) & 0x3f), (int)(c & 0x3f)); } else if (c < 0xff) { - printf("\\%o", c); + printf("\\%o", (int)c); } else { - printf("%c%c", c>>BYTEWIDTH, c&0xff); + printf("%c%c", (int)(c >> BYTEWIDTH), (int)(c &0xff)); } } @@ -1184,7 +1188,7 @@ re_compile_pattern(pattern, size, bufp) register const char *p = pattern; const char *nextp; const char *pend = pattern + size; - register unsigned int c, c1; + register unsigned int c, c1 = 0; const char *p0; int numlen; #define ERROR_MSG_MAX_SIZE 200 @@ -1246,7 +1250,6 @@ re_compile_pattern(pattern, size, bufp) int *stackb = stacka; int *stackp = stackb; int *stacke = stackb + 40; - int *stackt; /* Counts ('s as they are encountered. Remembered for the matching ), where it becomes the register number to put in the stop_memory @@ -1483,8 +1486,8 @@ re_compile_pattern(pattern, size, bufp) case 'W': for (c = 0; c < (1 << BYTEWIDTH); c++) { if (SYNTAX(c) != Sword && - (current_mbctype && !re_mbctab[c] || - !current_mbctype && SYNTAX(c) != Sword2)) + ((current_mbctype && !re_mbctab[c]) || + (!current_mbctype && SYNTAX(c) != Sword2))) SET_LIST_BIT(c); } had_char_class = 1; |