diff options
author | Sadie Powell <sadie@witchery.services> | 2020-02-27 18:52:00 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-03-05 20:47:18 +0000 |
commit | 5c01f7c08f223ebfa671a9f36ac1fd8203880c9e (patch) | |
tree | 7ed549e919a4a4bb2bbec80e8b7535ecf77aacc2 /src/configparser.cpp | |
parent | 8d1255a82c1bdb53928a007be113caff15683d53 (diff) |
Standardise the characters allowed in config identifiers.
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r-- | src/configparser.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp index 6fdc56c32..4748fa847 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -158,12 +158,20 @@ struct Parser } } + bool wordchar(char ch) + { + return isalnum(ch) + || ch == '-' + || ch == '.' + || ch == '_'; + } + void nextword(std::string& rv) { int ch = next(); while (isspace(ch)) ch = next(); - while (isalnum(ch) || ch == '_'|| ch == '-') + while (wordchar(ch)) { rv.push_back(ch); ch = next(); @@ -205,7 +213,7 @@ struct Parser while (1) { ch = next(); - if (isalnum(ch) || (varname.empty() && ch == '#') || ch == '.') + if (wordchar(ch) || (varname.empty() && ch == '#')) varname.push_back(ch); else if (ch == ';') break; |