-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
requires/types: introduce expression type (expr.py)
`expression` is a new requirement type that allows user to express a requirement in human-readable, SQL-like syntax. It has a proper grammar to allow user to write checks as easily digestable manner, which will improve the QOL for scenario writers and code reviewers. The grammar is constructed using `pyparsing` library. The current grammar supports the following constructs: - Keywords (True, False, None) - Constants (Integer, Float, String literal) - Runtime variables (Python properties) - Functions(len, not, file, systemd, read_ini, read_cert) - Arithmetic operators(sign, mul, div, add, sub, exp) - Comparison operators(<, <=, >, >=, ==, !=, in) - Logical operators(and, or, not) - Comments('#', '//', '/*...*/') Also, the following changes have been made: - Updated requirement_types.rst to document the new Expression requirement type. - Moved property resolver logic from YPropertyBase to PythonEntityResolver class. - Added `pyparsing` as a dependency. - Added unit tests for the new code. This patch rewrites some of the scenario checks in the new expression syntax to demonstrate the difference and provide examples. Signed-off-by: Mustafa Kemal Gilor <[email protected]>
- Loading branch information
Showing
26 changed files
with
2,737 additions
and
348 deletions.
There are no files selected for viewing
619 changes: 619 additions & 0 deletions
619
doc/source/contrib/language_ref/property_ref/requirement_types.rst
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.