diff options
author | nyamatongwe <unknown> | 2004-05-02 05:11:13 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2004-05-02 05:11:13 +0000 |
commit | e6026fcb7bbde425a7bb4ef4877ec47be0057ae7 (patch) | |
tree | 24f2d1a33b3ffc307f60b9fa42ec5b94bc557291 /src | |
parent | e54924868afc89513a42afba9e7fb35a6f3fe9e7 (diff) | |
download | scintilla-mirror-e6026fcb7bbde425a7bb4ef4877ec47be0057ae7.tar.gz |
Philippe added function for determining if a character is a digit in
bases other than decimal.
Diffstat (limited to 'src')
-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)); + } +} |