dazl

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]}

Dict of {'state': [(regex, tokentype, new_state), ...], ...}

The initial state is ‘root’. new_state can be omitted to signify no state transition. If it is a string, the state is pushed on the stack and changed. If it is a tuple of strings, all states are pushed on the stack and the current state will be the topmost. It can also be combined('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.

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 None if lines should not wrap.

show_hidden_types

True to render built-in DAML types defined in DA.Internal or GHC and 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]