aboutsummaryrefslogtreecommitdiff
path: root/sway/stringop.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2015-11-24 10:56:29 -0500
committerDrew DeVault <sir@cmpwn.com>2015-11-24 10:56:29 -0500
commit8ad8ceeeb92ca6609bc40974a8c528b593251566 (patch)
tree4f706f14f54c2f250c8bb2d720072b9443ea7777 /sway/stringop.c
parente7c0573a980938a5174bc647faf41f24fa523b0b (diff)
parentdb92920cf9bcdd0008ba446df4d7249e7902373a (diff)
Merge pull request #250 from sce/initial_support_for_criteria_strings
Initial support for criteria strings
Diffstat (limited to 'sway/stringop.c')
-rw-r--r--sway/stringop.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/stringop.c b/sway/stringop.c
index fe5a97ca..efa3a207 100644
--- a/sway/stringop.c
+++ b/sway/stringop.c
@@ -117,6 +117,7 @@ char **split_args(const char *start, int *argc) {
bool in_token = false;
bool in_string = false;
bool in_char = false;
+ bool in_brackets = false; // brackets are used for critera
bool escaped = false;
const char *end = start;
if (start) {
@@ -129,10 +130,14 @@ char **split_args(const char *start, int *argc) {
in_string = !in_string;
} else if (*end == '\'' && !in_string && !escaped) {
in_char = !in_char;
+ } else if (*end == '[' && !in_string && !in_char && !in_brackets && !escaped) {
+ in_brackets = true;
+ } else if (*end == ']' && !in_string && !in_char && in_brackets && !escaped) {
+ in_brackets = false;
} else if (*end == '\\') {
escaped = !escaped;
- } else if (*end == '\0' || (!in_string && !in_char && !escaped
- && strchr(whitespace, *end))) {
+ } else if (*end == '\0' || (!in_string && !in_char && !in_brackets
+ && !escaped && strchr(whitespace, *end))) {
goto add_token;
}
if (*end != '\\') {