summaryrefslogtreecommitdiff
path: root/src/parse/parse.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-12-01 03:35:40 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-12-01 03:35:40 +0000
commit9e8f4efc94c896b4df2110272f42d2c93e1512d4 (patch)
tree2f8080ee8b98f8fec41afde4be4c5d4371dae042 /src/parse/parse.c
parent3a03e4be1a744d37c66ea97651ca082ee4eb39d4 (diff)
downloadlibcss-9e8f4efc94c896b4df2110272f42d2c93e1512d4.tar.gz
libcss-9e8f4efc94c896b4df2110272f42d2c93e1512d4.tar.bz2
Simplify decision as to whether to intern token data by inserting markers into the css_token_type enum.
svn path=/trunk/libcss/; revision=5860
Diffstat (limited to 'src/parse/parse.c')
-rw-r--r--src/parse/parse.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/src/parse/parse.c b/src/parse/parse.c
index ff8c813..de61b28 100644
--- a/src/parse/parse.c
+++ b/src/parse/parse.c
@@ -580,40 +580,25 @@ css_error getToken(css_parser *parser, const css_token **token)
return error;
}
- /** \todo We need only intern for the following token types:
+ /* We need only intern for the following token types:
*
* CSS_TOKEN_IDENT, CSS_TOKEN_ATKEYWORD, CSS_TOKEN_STRING,
* CSS_TOKEN_INVALID_STRING, CSS_TOKEN_HASH, CSS_TOKEN_URI,
- * CSS_TOKEN_UNICODE_RANGE?, CSS_TOKEN_FUNCTION, CSS_TOKEN_CHAR
- *
- * It would be better if we didn't intern the text for these
- * token types:
- *
+ * CSS_TOKEN_UNICODE_RANGE?, CSS_TOKEN_FUNCTION, CSS_TOKEN_CHAR,
* CSS_TOKEN_NUMBER, CSS_TOKEN_PERCENTAGE, CSS_TOKEN_DIMENSION
+ *
+ * These token types all appear before CSS_TOKEN_LAST_INTERN.
+ * All other token types appear after this magic value.
*/
- if ((t->type == CSS_TOKEN_IDENT ||
- t->type == CSS_TOKEN_ATKEYWORD ||
- t->type == CSS_TOKEN_STRING ||
- t->type == CSS_TOKEN_INVALID_STRING ||
- t->type == CSS_TOKEN_HASH ||
- t->type == CSS_TOKEN_URI ||
- t->type == CSS_TOKEN_UNICODE_RANGE ||
- t->type == CSS_TOKEN_FUNCTION ||
- t->type == CSS_TOKEN_CHAR ||
- t->type == CSS_TOKEN_NUMBER ||
- t->type == CSS_TOKEN_PERCENTAGE ||
- t->type == CSS_TOKEN_DIMENSION) &&
+ if (t->type < CSS_TOKEN_LAST_INTERN &&
t->data.data != NULL && t->data.len > 0) {
const parserutils_hash_entry *interned;
/* Invalidate lowercase data */
t->lower.data = NULL;
- if (t->type == CSS_TOKEN_IDENT ||
- t->type == CSS_TOKEN_ATKEYWORD ||
- t->type == CSS_TOKEN_HASH ||
- t->type == CSS_TOKEN_FUNCTION) {
+ if (t->type < CSS_TOKEN_LAST_INTERN_LOWER) {
uint8_t temp[t->data.len];
bool lower = false;