dazl.pretty package¶
This module contains utilities for pretty-printing various types in dazl.
- class dazl.pretty.DAMLLexer(*args, **kwds)¶
- aliases = ['daml']¶
Shortcuts for the lexer
- daml_reserved = ('template', 'with', 'controller', 'can', 'ensure', 'daml', 'observer', 'signatory', 'agreement', 'controller', 'nonconsuming', 'return', 'this')¶
- filenames = ['*.daml']¶
File name globs
- name = 'DAML'¶
Name of the lexer
- tokens = {'root': [("\\b(template|with|controller|can|ensure|daml|observer|signatory|agreement|controller|nonconsuming|return|this)(?!\\')\\b", Token.Keyword.Reserved), ('\\b(True|False)\\b', Token.Keyword.Constant), inherit]}¶
At all time there is a stack of states. Initially, the stack contains a single state ‘root’. The top of the stack is called “the current state”.
Dict of
{'state': [(regex, tokentype, new_state), ...], ...}new_statecan be omitted to signify no state transition. Ifnew_stateis a string, it is pushed on the stack. This ensure the new current state isnew_state. Ifnew_stateis a tuple of strings, all of those strings are pushed on the stack and the current state will be the last element of the list.new_statecan also becombined('state1', 'state2', ...)to signify a new, anonymous state combined from the rules of two or more existing ones. Furthermore, it can be ‘#pop’ to signify going back one step in the state stack, or ‘#push’ to push the current state on the stack again. Note that if you push while in a combined state, the combined state itself is pushed, and not only the state in which the rule is defined.The tuple can also be replaced with
include('state'), in which case the rules from the state named by the string are included in the current one.
- class dazl.pretty.PrettyOptions(column_width: Optional[int] = None, show_hidden_types: bool = False, format: str = 'daml')¶
Display options for pretty-printing DAML ASTs.
Instance attributes:
- column_width¶
The maximum number of columns to use when rendering text, or
Noneif lines should not wrap.
Trueto render built-in DAML types defined inDA.InternalorGHCand specially generated names.
- format¶
A string that identifies the target language to render.
- column_width: Optional[int] = None¶
- format: str = 'daml'¶
- show_hidden_types: bool = False¶
- dazl.pretty.get_pretty_printer(format: str, options: dazl.pretty.options.PrettyOptions, lookup: dazl.damlast.protocols.SymbolLookup) Optional[dazl.pretty._render_base.PrettyPrintBase]¶