We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b6d5a96 commit 712ec5dCopy full SHA for 712ec5d
1 file changed
shellwhat/parsers.py
@@ -7,7 +7,10 @@
7
8
class OshNode(AstNode):
9
def get_text(self, full_text=None):
10
- return self.text
+ if self.text:
11
+ return self.text
12
+ else:
13
+ raise RuntimeError("The parser wasn't able to match text to this node")
14
15
def get_position(self):
16
return self.position
@@ -42,8 +45,8 @@ def dump(cls, tree):
42
45
def load(cls, node):
43
46
obj = super().load(node)
44
47
if isinstance(obj, cls.AstNode):
- obj.text = node["text"]
- obj.position = node["position"]
48
+ obj.text = node.get("text")
49
+ obj.position = node.get("position")
50
return obj
51
52
0 commit comments