summaryrefslogtreecommitdiff
path: root/MLKReadtable.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-19 19:01:31 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-19 19:01:31 +0200
commitaf5a200a68ed12efec4b29b57fa22c632aaf91fa (patch)
treebdbec22869a15b2a41371a2507a74b852ee6704e /MLKReadtable.m
parentf9f90837641694619d184cf2ab8b5c03c46b08dd (diff)
Fix number parsing.
Diffstat (limited to 'MLKReadtable.m')
-rw-r--r--MLKReadtable.m11
1 files changed, 4 insertions, 7 deletions
diff --git a/MLKReadtable.m b/MLKReadtable.m
index 8d56d72..393c4d1 100644
--- a/MLKReadtable.m
+++ b/MLKReadtable.m
@@ -132,11 +132,8 @@ DEFINE_SYNTAX_PREDICATE(isConstituentCharacter:, CONSTITUENT)
-(BOOL) character:(unichar)ch
hasTrait:(enum MLKConstituentTrait)trait
{
- NSNumber *traits = [_traits objectForKey:[NSNumber numberWithLong:ch]];
- if (!traits)
- return (trait == ALPHABETIC);
- else
- return [traits intValue] & trait;
+ int traits = [self characterConstituentTraits:ch];
+ return (traits & trait) != 0;
}
@@ -193,9 +190,9 @@ DEFINE_TRAIT_PREDICATE(isDot:, DOT)
-(BOOL) isDigit:(unichar)ch inBase:(int)base
{
if (base < 11)
- return (ch < '0' + base);
+ return ('0' <= ch && ch < '0' + base);
else
- return (ch <= '9'
+ return (('0' <= ch && ch <= '9')
|| ('A' <= ch && ch < 'A' + base - 10)
|| ('a' <= ch && ch < 'a' + base - 10));
}