diff options
author | nyamatongwe <devnull@localhost> | 2004-05-02 05:11:13 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2004-05-02 05:11:13 +0000 |
commit | 43ab66166b2c16b765fcb07ee08a05f6f9e58399 (patch) | |
tree | 24f2d1a33b3ffc307f60b9fa42ec5b94bc557291 | |
parent | 8b5ad1db2ecd9f6c8dd569d26b9375d0be3c6a6e (diff) | |
download | scintilla-mirror-43ab66166b2c16b765fcb07ee08a05f6f9e58399.tar.gz |
Philippe added function for determining if a character is a digit in
bases other than decimal.
-rw-r--r-- | src/StyleContext.h | 12 |
1 files changed, 11 insertions, 1 deletions
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 <neilh@scintilla.org> +// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> // 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)); + } +} |