formatter Package¶
formatter
Package¶
-
class
formatter2.
Token
(offsets, tok_type, token, begin, end, line)[source]¶ Bases:
object
-
begin
¶ The begin coordinates.
Settings this to a tuple will set the first to the row and the latter to the col.
This returns a
SmartList
with the row and the column.
-
begin_col
¶ The begin column.
-
begin_row
¶ The begin row.
-
col
¶ The column.
Setting this to a tuple will set the first to the begin and the latter to the end.
This returns a
SmartList
with the begin and end column.
-
end
¶ The end.
Settings this to a tuple will set the first to the row and the latter to the col.
This returns a
SmartList
with the row and column.
-
end_col
¶ The end column.
-
end_row
¶ The end row.
-
line
¶ The line.
Setting the line automatically updates the column as well.
Returns a
str()
object with the line.
-
row
¶ The row.
Setting this to a tuple will set the first to the begin and the latter to the end.
This returns a
SmartList
with the begin and end row.
-
type
¶
-
-
class
formatter2.
TokenOffset
(parent, type_, token, pre=0, post=0, children=None, end=None, pre_collapse=True, post_collapse=True)[source]¶ Bases:
object
-
end
¶ Set the end token in case of children.
Should either be a token or a tuple with
TokenType
and token which will be a string.
-
parent
¶ The parent.
TokenOffsets
-
surround
¶ Surround the token with this amount of space. Setting will set the pre and post when given a tuple or
int()
.
-
type
¶ The type.
TokenType
-
offsets
Module¶
-
class
formatter2.offsets.
TokenOffset
(parent, type_, token, pre=0, post=0, children=None, end=None, pre_collapse=True, post_collapse=True)[source]¶ Bases:
object
-
end
¶ Set the end token in case of children.
Should either be a token or a tuple with
TokenType
and token which will be a string.
-
parent
¶ The parent.
TokenOffsets
-
surround
¶ Surround the token with this amount of space. Setting will set the pre and post when given a tuple or
int()
.
-
type
¶ The type.
TokenType
-
tokens
Module¶
-
class
formatter2.tokens.
Token
(offsets, tok_type, token, begin, end, line)[source]¶ Bases:
object
-
begin
¶ The begin coordinates.
Settings this to a tuple will set the first to the row and the latter to the col.
This returns a
SmartList
with the row and the column.
-
begin_col
¶ The begin column.
-
begin_row
¶ The begin row.
-
col
¶ The column.
Setting this to a tuple will set the first to the begin and the latter to the end.
This returns a
SmartList
with the begin and end column.
-
end
¶ The end.
Settings this to a tuple will set the first to the row and the latter to the col.
This returns a
SmartList
with the row and column.
-
end_col
¶ The end column.
-
end_row
¶ The end row.
-
line
¶ The line.
Setting the line automatically updates the column as well.
Returns a
str()
object with the line.
-
row
¶ The row.
Setting this to a tuple will set the first to the begin and the latter to the end.
This returns a
SmartList
with the begin and end row.
-
type
¶
-
types
Module¶
-
class
formatter2.types.
CommentTokenType
(id_, name)[source]¶ Bases:
formatter2.types.TokenType
-
name
= 'COMMENT'¶
-
-
class
formatter2.types.
DefaultTokenType
[source]¶ Bases:
formatter2.types.TokenType
-
class
formatter2.types.
IndentTokenType
(id_, name)[source]¶ Bases:
formatter2.types.TokenType
-
name
= 'INDENT'¶
-
-
class
formatter2.types.
StringTokenType
(id_, name)[source]¶ Bases:
formatter2.types.TokenType
-
name
= 'STRING'¶
-