mirror of
https://github.com/davidhalter/parso.git
synced 2025-12-06 12:54:29 +08:00
Merge pull request #199 from sobolevn/patch-1
Fixes `__slots__` definition in `NodeOrLeaf`
This commit is contained in:
@@ -26,7 +26,7 @@ class NodeOrLeaf:
|
|||||||
"""
|
"""
|
||||||
The base class for nodes and leaves.
|
The base class for nodes and leaves.
|
||||||
"""
|
"""
|
||||||
__slots__ = ()
|
__slots__ = ('parent',)
|
||||||
type: str
|
type: str
|
||||||
'''
|
'''
|
||||||
The type is a string that typically matches the types of the grammar file.
|
The type is a string that typically matches the types of the grammar file.
|
||||||
@@ -290,7 +290,7 @@ class Leaf(NodeOrLeaf):
|
|||||||
Leafs are basically tokens with a better API. Leafs exactly know where they
|
Leafs are basically tokens with a better API. Leafs exactly know where they
|
||||||
were defined and what text preceeds them.
|
were defined and what text preceeds them.
|
||||||
'''
|
'''
|
||||||
__slots__ = ('value', 'parent', 'line', 'column', 'prefix')
|
__slots__ = ('value', 'line', 'column', 'prefix')
|
||||||
prefix: str
|
prefix: str
|
||||||
|
|
||||||
def __init__(self, value: str, start_pos: Tuple[int, int], prefix: str = '') -> None:
|
def __init__(self, value: str, start_pos: Tuple[int, int], prefix: str = '') -> None:
|
||||||
@@ -369,7 +369,7 @@ class BaseNode(NodeOrLeaf):
|
|||||||
The super class for all nodes.
|
The super class for all nodes.
|
||||||
A node has children, a type and possibly a parent node.
|
A node has children, a type and possibly a parent node.
|
||||||
"""
|
"""
|
||||||
__slots__ = ('children', 'parent')
|
__slots__ = ('children',)
|
||||||
|
|
||||||
def __init__(self, children: List[NodeOrLeaf]) -> None:
|
def __init__(self, children: List[NodeOrLeaf]) -> None:
|
||||||
self.children = children
|
self.children = children
|
||||||
|
|||||||
Reference in New Issue
Block a user