diff options
Diffstat (limited to 'abdl/__init__.py')
-rw-r--r-- | abdl/__init__.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/abdl/__init__.py b/abdl/__init__.py index efcd3df..7208e44 100644 --- a/abdl/__init__.py +++ b/abdl/__init__.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -"""A Boneless Datastructure Language, version 2.1. +"""A Boneless Datastructure Language, version 2.2. ABDL expressions are regex-like constructs for matching and validating object structures. They can be used with JSON and similar formats, and even @@ -76,7 +76,11 @@ Language Reference: the enclosed ABDL expression to the value (or index) being processed. A subvalue enables the ability to match multiple values on the same object, and accepts a value if and only the enclosed expression - matches the value. + matches the value. A subvalue can be made optional by the presence of + a ``?`` after the subvalue - in case of no match, it will just omit + the relevant keys in the result. Optional subvalues are unrelated to + non-validating syntax elements (see below), they just use the same + syntax. Some syntax elements can be validating or non-validating. Validating syntax elements will raise a :py:exc:`abdl.exceptions.ValidationError` @@ -100,7 +104,7 @@ Language Reference: arrow ::= '->' keymatch ::= '[' {predicate} abdlexpression ']' - subvalue ::= '(' {predicate} abdlexpression ')' + subvalue ::= '(' {predicate} abdlexpression ')' ['?'] For a description of the terminals "parameter", "literal", "regex" and "predicate", see "Syntax Elements of ABDL Expressions" above. |