File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,13 @@ def __init__(self) -> None:
4444 # children (i.e. inline or img)
4545 self .children : List ["SyntaxTreeNode" ] = []
4646
47- @staticmethod
48- def from_tokens (tokens : Sequence [Token ]) -> "SyntaxTreeNode" :
47+ @classmethod
48+ def from_tokens (cls , tokens : Sequence [Token ]) -> "SyntaxTreeNode" :
4949 """Instantiate a `SyntaxTreeNode` from a token stream.
5050
5151 This is the standard method for instantiating `SyntaxTreeNode`.
5252 """
53- root = SyntaxTreeNode ()
53+ root = cls ()
5454 root ._set_children_from_tokens (tokens )
5555 return root
5656
@@ -143,7 +143,7 @@ def _make_child(
143143 """Make and return a child node for `self`."""
144144 if token and nester_tokens or not token and not nester_tokens :
145145 raise ValueError ("must specify either `token` or `nester_tokens`" )
146- child = SyntaxTreeNode ()
146+ child = type ( self ) ()
147147 if token :
148148 child .token = token
149149 else :
You can’t perform that action at this time.
0 commit comments