Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 2.67 KB

File metadata and controls

35 lines (26 loc) · 2.67 KB

SourceInfo

Source information collected at parse time.

Properties

Name Type Description Notes
syntax_version str The syntax version of the source, e.g. `cel1`. [optional]
location str The location name. All position information attached to an expression is relative to this location. The location could be a file, UI element, or similar. For example, `acme/app/AnvilPolicy.cel`. [optional]
line_offsets List[int] Monotonically increasing list of code point offsets where newlines `\n` appear. The line number of a given position is the index `i` where for a given `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The column may be derivd from `id_positions[id] - line_offsets[i]`. [optional]
positions Dict[str, int] A map from the parse node id (e.g. `Expr.id`) to the code point offset within the source. [optional]
macro_calls Dict[str, Expr] A map from the parse node id where a macro replacement was made to the call `Expr` that resulted in a macro expansion. For example, `has(value.field)` is a function call that is replaced by a `test_only` field selection in the AST. Likewise, the call `list.exists(e, e > 10)` translates to a comprehension expression. The key in the map corresponds to the expression id of the expanded macro, and the value is the call `Expr` that was replaced. [optional]
extensions List[Extension] A list of tags for extensions that were used while parsing or type checking the source expression. For example, optimizations that require special runtime support may be specified. These are used to check feature support between components in separate implementations. This can be used to either skip redundant work or report an error if the extension is unsupported. [optional]

Example

from permify.models.source_info import SourceInfo

# TODO update the JSON string below
json = "{}"
# create an instance of SourceInfo from a JSON string
source_info_instance = SourceInfo.from_json(json)
# print the JSON string representation of the object
print SourceInfo.to_json()

# convert the object into a dict
source_info_dict = source_info_instance.to_dict()
# create an instance of SourceInfo from a dict
source_info_form_dict = source_info.from_dict(source_info_dict)

[Back to Model list] [Back to API list] [Back to README]