Improve DDB expressions support3: AST Validation

Part of structured approach for UpdateExpressions:
 1) Expression gets parsed into a tokenlist (tokenized)
 2) Tokenlist get transformed to expression tree (AST)
 3) The AST gets validated (full semantic correctness) -> this commit
 4) AST gets processed to perform the update

This commit uses the AST to perform validation.  Validation makes sure the
nodes encounterd have valid values and they will also resolve values for
references that refer to item state or values passed into the expression.
This commit is contained in:
pvbouwel 2020-04-19 16:38:29 +01:00
commit fc4d88401d
9 changed files with 1127 additions and 11 deletions

View file

@ -9,7 +9,7 @@ import six
from moto.core.responses import BaseResponse
from moto.core.utils import camelcase_to_underscores, amzn_request_id
from .exceptions import InvalidIndexNameError, InvalidUpdateExpression, ItemSizeTooLarge, MockValidationException
from .exceptions import InvalidIndexNameError, ItemSizeTooLarge, MockValidationException
from moto.dynamodb2.models import dynamodb_backends, dynamo_json_dump