moto/moto/dynamodb/parsing
2023-09-07 20:45:04 +00:00
..
__init__.py
ast_nodes.py Techdebt: MyPy DynamoDB (#5863) 2023-01-22 21:06:41 -01:00
executors.py Techdebt: MyPy: Remove unused ignores (#6542) 2023-07-20 15:46:54 +00:00
expressions.py Techdebt: MyPy DynamoDB (#5863) 2023-01-22 21:06:41 -01:00
key_condition_expression.py DynamoDB: key_condition_expression cannot contain a literal value (#6784) 2023-09-07 20:45:04 +00:00
partiql.py S3 Select: Parse null-values (#6343) 2023-05-25 16:37:45 +00:00
README.md
reserved_keywords.py Techdebt: MyPy DynamoDB (#5863) 2023-01-22 21:06:41 -01:00
reserved_keywords.txt
tokens.py DynamoDB: allow leading underscore in expression attr name (#6082) 2023-03-17 14:22:05 -01:00
validators.py DynamoDB: Ensure first argument to list_append() exists (#6011) 2023-03-04 12:25:48 -01:00

Parsing dev documentation

Parsing happens in a structured manner and happens in different phases. This document explains these phases.

1) Expression gets parsed into a tokenlist (tokenized)

A string gets parsed from left to right and gets converted into a list of tokens. The tokens are available in tokens.py.

2) Tokenlist get transformed to expression tree (AST)

This is the parsing of the token list. This parsing will result in an Abstract Syntax Tree (AST). The different node types are available in ast_nodes.py. The AST is a representation that has all the information that is in the expression but its tree form allows processing it in a structured manner.

3) The AST gets validated (full semantic correctness)

The AST is used for validation. The paths and attributes are validated to be correct. At the end of the validation all the values will be resolved.

4) Update Expression gets executed using the validated AST

Finally the AST is used to execute the update expression. There should be no reason for this step to fail since validation has completed. Due to this we have the update expressions behaving atomically (i.e. all the actions of the update expresion are performed or none of them are performed).