From e6026fcb7bbde425a7bb4ef4877ec47be0057ae7 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 2 May 2004 05:11:13 +0000 Subject: Philippe added function for determining if a character is a digit in bases other than decimal. --- src/StyleContext.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/StyleContext.h b/src/StyleContext.h index f2f8305c9..aedebbc01 100644 --- a/src/StyleContext.h +++ b/src/StyleContext.h @@ -2,7 +2,7 @@ /** @file StyleContext.cxx ** Lexer infrastructure. **/ -// Copyright 1998-2002 by Neil Hodgson +// Copyright 1998-2004 by Neil Hodgson // This file is in the public domain. // All languages handled so far can treat all characters >= 0x80 as one class @@ -156,3 +156,13 @@ inline bool IsASpaceOrTab(unsigned int ch) { inline bool IsADigit(unsigned int ch) { return (ch >= '0') && (ch <= '9'); } + +inline bool IsADigit(unsigned int ch, unsigned int base) { + if (base <= 10) { + return (ch >= '0') && (ch < '0' + base); + } else { + return ((ch >= '0') && (ch <= '9')) || + ((ch >= 'A') && (ch < 'A' + base - 10)) || + ((ch >= 'a') && (ch < 'a' + base - 10)); + } +} -- cgit v1.2.3