Expand description
This module contains the parser for the Cedar language.
Modules§
- cst
- Concrete Syntax Tree def used as parser first pass
- cst_
to_ ast - Step two: convert CST to package AST Conversions from CST to AST
- err
- error handling utilities
- text_
to_ cst - Step one: Convert text to CST This module contains step one of the parser for the Cedar language. It converts text to a CST
- unescape
- Utility functions to unescape string literals
- util
- Utility functions Utility functions used by multiple parts of the parser.
Structs§
- Loc
- Represents a source location: index/range, and a reference to the source code which that index/range indexes into
- Node
- Metadata for our syntax trees
Functions§
- join_
with_ conjunction - Format an iterator as a natural-language string, separating items with commas and a conjunction (e.g., “and”, “or”) between the last two items.
- parse_
internal_ string - parse a string into an internal Cedar string
- parse_
policy - Main function for parsing a (static) policy.
Will return an error if provided with a template.
If
id
is Some, then the resulting policy will have thatid
. If theid
is None, the parser will use “policy0”. - parse_
policy_ or_ template - Main function for parsing a policy or template. In either case, the
returned value will be a
ast::Template
. Ifid
is Some, then the resulting template will have thatid
. If theid
is None, the parser will use “policy0”. - parse_
policy_ or_ template_ to_ est - Parse a policy or template (either one works) to its EST representation
- parse_
policy_ or_ template_ to_ est_ and_ ast - Like
parse_policy_or_template()
, but also returns the (lossless) EST – that is, the EST of the original policy/template without any of the lossy transforms involved in converting to AST. - parse_
policy_ to_ est_ and_ ast - Like
parse_policy()
, but also returns the (lossless) EST – that is, the EST of the original policy without any of the lossy transforms involved in converting to AST. - parse_
policyset - simple main function for parsing policies generates numbered ids
- parse_
policyset_ and_ also_ return_ policy_ text - Like
parse_policyset()
, but also returns the (lossless) original text of each individual policy. INVARIANT: ThePolicyId
of everyPolicy
andTemplate
returned by thepolicies()
andtemplates()
methods on the returnedPolicy
must appear as a key in the returned map. - parse_
policyset_ to_ ests_ and_ pset - Like
parse_policyset()
, but also returns the (lossless) ESTs – that is, the ESTs of the original policies without any of the lossy transforms involved in converting to AST. - parse_
template - Main function for parsing a template.
Will return an error if provided with a static policy.
If
id
is Some, then the resulting policy will have thatid
. If theid
is None, the parser will use “policy0”.