aboutsummaryrefslogtreecommitdiff
path: root/src/Conf.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-09 16:36:23 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-09 16:38:31 +0100
commite7384a7672e4449bc194ca3ec66cdd4fcc63801e (patch)
treec79bc4dfbb8b3a752ae33f26f5e1b2992a484ace /src/Conf.cpp
parent6cc190828160586abc6961354a7c05e99537d7e2 (diff)
Add support for dependencies (including version check)
This currently only works using pkg-config and it only adds linking flags. Need to check with a library that also includes other types of flags. TODO: Fallback to dependencies sub directory and github/server if package not found in pkg-config.
Diffstat (limited to 'src/Conf.cpp')
-rw-r--r--src/Conf.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Conf.cpp b/src/Conf.cpp
index 56b1e2a..6383c30 100644
--- a/src/Conf.cpp
+++ b/src/Conf.cpp
@@ -68,7 +68,7 @@ namespace sibs
char *startOfIdentifier = code.base();
++code;
c = *code;
- while(isAlpha(c) || c == '_' || isDigit(c))
+ while(isAlpha(c) || isDigit(c) || c == '_' || c == '-')
{
++code;
c = *code;
@@ -95,19 +95,21 @@ namespace sibs
}
else if(c == '"')
{
- u32 escapeCount = 0;
+ bool escapeQuote = false;
++code;
char *startOfStr = code.base();
- while(escapeCount > 0 || *code != '"')
+ while(true)
{
c = *code;
- if(c == '\0')
- return Token::END_OF_FILE;
+ if(c == '"' && !escapeQuote)
+ break;
else if(c == '\\')
- ++escapeCount;
+ escapeQuote = !escapeQuote;
+ else if(c == '\0')
+ throw UnexpectedTokenException("Reached end of file before string end");
else
- escapeCount = min(0, escapeCount - 1);
+ escapeQuote = false;
++code;
}