summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-02-27 18:52:00 +0000
committerSadie Powell <sadie@witchery.services>2020-03-05 20:47:18 +0000
commit5c01f7c08f223ebfa671a9f36ac1fd8203880c9e (patch)
tree7ed549e919a4a4bb2bbec80e8b7535ecf77aacc2 /src
parent8d1255a82c1bdb53928a007be113caff15683d53 (diff)
Standardise the characters allowed in config identifiers.
Diffstat (limited to 'src')
-rw-r--r--src/configparser.cpp12
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;