summaryrefslogtreecommitdiff
path: root/regex.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-23 07:30:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-23 07:30:43 +0000
commiteb9708f38671aa6446a89acc755f3341f5cb59b6 (patch)
tree1a033ace8ffbc862b97c6f4eab80e3326462f06d /regex.c
parentb6cc058c53fde7442253c44e688ff8541050572d (diff)
* array.c (Init_Array): remove Array#filter.
* object.c (rb_mod_initialize): should accept zero argument. * object.c (rb_mod_cmp): should raise ArgumentError if inheritance/inclusion relation between two classes/modules is not defined. [new] * io.c (rb_io_fsync): new method. [new] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/regex.c b/regex.c
index 99847afba3..64d32151ed 100644
--- a/regex.c
+++ b/regex.c
@@ -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
@@ -1479,8 +1482,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;