fix mac os x callback without parent bug

This commit is contained in:
pantor
2018-03-20 16:36:11 +01:00
parent cfa0e5cbfe
commit 73a40cf1b1
3 changed files with 7 additions and 7 deletions

View File

@@ -604,14 +604,14 @@ public:
*/
static Regex function_regex(std::string name, int number_arguments) {
std::string pattern = name;
pattern.append("\\(");
pattern.append("(?:\\(");
for (int i = 0; i < number_arguments; i++) {
if (i != 0) pattern.append(",");
pattern.append("(.*)");
}
pattern.append("\\)");
pattern.append("\\))");
if (number_arguments == 0) { // Without arguments, allow to use the callback without parenthesis
pattern = "(?:" + name + "|" + pattern + ")";
pattern.append("?");
}
return Regex{"\\s*" + pattern + "\\s*"};
}