Skip to content

Commit 2f13a16

Browse files
committed
Bug fix, switched factory and symbol_table arguments in sub-parser functions.
1 parent 63f79ca commit 2f13a16

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
2013-10-28 Take Vos <[email protected]>
3+
4+
* Bug fix, switched arguments on sub-parser methods.
5+
26
2013-10-26 Take Vos <[email protected]>
37

48
* You can now pass a symbol table to the parser, so that your AST object can save

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
AC_PREREQ(2.61)
3-
AC_INIT(yyast, 1.2.0, [email protected])
3+
AC_INIT(yyast, 1.2.1, [email protected])
44
AC_CONFIG_MACRO_DIR([m4])
55
AC_CONFIG_AUX_DIR([buildutils])
66
AM_INIT_AUTOMAKE()

pyext/parser.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -62,41 +62,41 @@ def register_factory(self, node_name, factory):
6262
"""
6363
self.factories[node_name] = factory
6464

65-
def parse_null_node(self, symbol_table, factory, node_info, internal_data):
65+
def parse_null_node(self, factory, symbol_table, node_info, internal_data):
6666
if len(internal_data) > 0:
6767
raise YYASTParserException("Null node should not have data.")
6868

6969
node = factory(symbol_table, node_info)
7070
node.parsing_done()
7171
return node
7272

73-
def parse_leaf_node(self, symbol_table, factory, node_info, internal_data):
73+
def parse_leaf_node(self, factory, symbol_table, node_info, internal_data):
7474
if len(internal_data) > 0:
7575
raise YYASTParserException("Leaf node should not have data.")
7676

7777
node = factory(symbol_table, node_info)
7878
node.parsing_done()
7979
return node
8080

81-
def parse_branch_node(self, symbol_table, factory, node_info, internal_data):
81+
def parse_branch_node(self, factory, symbol_table, node_info, internal_data):
8282
node = factory(symbol_table, node_info)
8383

8484
# Parse the child nodes and add it to the node.
8585
while internal_data:
86-
child_node, internal_data = self.parse_node(internal_data)
86+
child_node, internal_data = self.parse_node(symbol_table, internal_data)
8787
node.add_child(child_node)
8888

8989
node.parsing_done()
9090
return node
9191

92-
def parse_text_node(self, symbol_table, factory, node_info, internal_data):
92+
def parse_text_node(self, factory, symbol_table, node_info, internal_data):
9393
internal_data = strip_null(internal_data)
9494
value = internal_data.decode("UTF-8")
9595
node = factory(symbol_table, node_info, value)
9696
node.parsing_done()
9797
return node
9898

99-
def parse_positive_integer_node(self, symbol_table, factory, node_info, internal_data):
99+
def parse_positive_integer_node(self, factory, symbol_table, node_info, internal_data):
100100
if len(internal_data) != 8:
101101
raise YYASTParserException("Positive integer node should be exactly 64 bit.")
102102

@@ -105,7 +105,7 @@ def parse_positive_integer_node(self, symbol_table, factory, node_info, internal
105105
node.parsing_done()
106106
return node
107107

108-
def parse_negative_integer_node(self, symbol_table, factory, node_info, internal_data):
108+
def parse_negative_integer_node(self, factory, symbol_table, node_info, internal_data):
109109
if len(internal_data) != 8:
110110
raise YYASTParserException("Negative integer node should be exactly 64 bit.")
111111

@@ -114,7 +114,7 @@ def parse_negative_integer_node(self, symbol_table, factory, node_info, internal
114114
node.parsing_done()
115115
return node
116116

117-
def parse_binary_float_node(self, symbol_table, factory, node_info, internal_data):
117+
def parse_binary_float_node(self, factory, symbol_table, node_info, internal_data):
118118
if len(internal_data) != 8:
119119
raise YYASTParserException("Binary float node should be exactly 64 bit.")
120120

@@ -123,16 +123,16 @@ def parse_binary_float_node(self, symbol_table, factory, node_info, internal_dat
123123
node.parsing_done()
124124
return node
125125

126-
def parse_decimal_float_node(self, symbol_table, factory, node_info, internal_data):
126+
def parse_decimal_float_node(self, factory, symbol_table, node_info, internal_data):
127127
if len(internal_data) != 8:
128128
raise YYASTParserException("Decimal float node should not have data.")
129129

130130
raise NotImplementedError("Decimal float is not implemented in the parser.")
131131

132-
def parse_list_node(self, symbol_table, factory, node_info, internal_data):
132+
def parse_list_node(self, factory, symbol_table, node_info, internal_data):
133133
raise NotImplementedError("List node should not exist in the file.")
134134

135-
def parse_count_node(self, symbol_table, factory, node_info, internal_data):
135+
def parse_count_node(self, factory, symbol_table, node_info, internal_data):
136136
raise NotImplementedError("Count node should not exist in the file.")
137137

138138
def parse_node(self, symbol_table, data):

0 commit comments

Comments
 (0)