summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-04-12 00:05:38 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-04-12 00:05:38 +0200
commit4665e5643fe69c24a3bd778a06b40b8d9d33156e (patch)
tree09f921398cde8f3548614575ba8710d7593edc3b /src
parent1a79d217af4b7403b6567c269bf115bb1fad9495 (diff)
downloadsolar-4665e5643fe69c24a3bd778a06b40b8d9d33156e.tar
solar-4665e5643fe69c24a3bd778a06b40b8d9d33156e.zip
lex: change dumb mode to a positive character set
Diffstat (limited to 'src')
-rw-r--r--src/lex.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/lex.cpp b/src/lex.cpp
index 2d56fef..3c86f25 100644
--- a/src/lex.cpp
+++ b/src/lex.cpp
@@ -279,6 +279,21 @@ int lex_t::lex(parse_token_value_t *value) {
loc.first_line = loc.last_line;
loc.first_column = loc.last_column+1;
+ if (dumb_mode) {
+ switch (current()) {
+ case 'a' ... 'z':
+ case 'A' ... 'Z':
+ case '0' ... '9':
+ case '_':
+ token = current();
+ next(true);
+ consume(false);
+ return token;
+ }
+ }
+
+ dumb_mode = false;
+
switch (current()) {
case ' ':
case '\n':
@@ -286,17 +301,9 @@ int lex_t::lex(parse_token_value_t *value) {
case '\r':
next(true);
consume(false);
- dumb_mode = false;
continue;
}
- if (dumb_mode) {
- token = current();
- next(true);
- consume(false);
- return token;
- }
-
switch (current()) {
case ';':
case ':':