DSMSourceField

class dsviper.DSMSourceField

Bases: object

A struct field and its source spans (name, type, whole declaration, doc).

Note: Not directly instantiable.

declaration_span() → DSMSourceSpan | None

Return the DSMSourceSpan of the whole field declaration, or None.

It starts at the docstring when there is one and stops before the ‘;’.

default_span() → DSMSourceSpan | None

Return the DSMSourceSpan of the field’s default clause - the ‘=’ through the literal - or None when the field declares no default.

documentation_span() → DSMSourceSpan | None

Return the DSMSourceSpan of the field docstring, or None.

name() → str

Return the field name.

name_span() → DSMSourceSpan | None

Return the DSMSourceSpan of the field name, or None.

structure() → TypeName

Return the TypeName of the enclosing structure.

type_span() → DSMSourceSpan | None

Return the DSMSourceSpan of the field type expression, or None.

It runs from the first character of the type to the field name, the blanks between them included.