You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2020/04/03 11:53:17 UTC
[incubator-annotator] 02/09: Half-working attempt at parsing
unencoded parentheses.
This is an automated email from the ASF dual-hosted git repository.
gerben pushed a commit to branch fragment-tests
in repository https://gitbox.apache.org/repos/asf/incubator-annotator.git
commit 6bba0e48fc0bf8c42133085f9a8580de78ebb729
Author: Gerben <ge...@treora.com>
AuthorDate: Thu Apr 2 21:34:07 2020 +0200
Half-working attempt at parsing unencoded parentheses.
---
packages/fragment-identifier/src/fragment.pegjs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/packages/fragment-identifier/src/fragment.pegjs b/packages/fragment-identifier/src/fragment.pegjs
index 5fc3d5f..8e6d22c 100644
--- a/packages/fragment-identifier/src/fragment.pegjs
+++ b/packages/fragment-identifier/src/fragment.pegjs
@@ -47,5 +47,15 @@ value
atom
= chars:validchar+ { return chars.join(""); }
+// FIXME
+// While an opening parenthesis is always valid, a closing parenthesis
+// *might* be part of the value, but could also be the delimiter that
+// closes a selector(…) or state(…). The attempt below uses a look-ahead
+// to not match ')' before a comma or before another ')', or at the end
+// of the input. However, it will fail if a last param’s value ends with
+// ')', or if a key or value contains '))'. For example:
+// selector(type=TextQuoteSelector,exact=example%20(that%20fails))
+// selector(type=TextQuoteSelector,exact=another))failure)
validchar
- = [a-zA-Z0-9\<\>\/\[\]\:%+@.\-!\$\&\;*_]
+ = [a-zA-Z0-9\<\>\/\[\]\:%+@.\-!\$\&\;*_\(]
+ / $( ")" &[^,)] )