def _parse_load(self, node): loads = [] for child in node.children: load_text = child.get_text(child.NODE_FLAT) next_loads = string_list.parse(load_text) loads.extend(next_loads) return loads
def _parse_flag(clazz, node): key = node.data.text texts = [] for child in node.children: texts.append(child.get_text(child.NODE_FLAT)) value_text = ' '.join(texts) value = string_list.parse(value_text, options = string_list.KEEP_QUOTES) return { key: value }
def parse(clazz, origin, text, node): if origin: check.check_value_origin(origin) check.check_node(node) if not text: values = string_list() else: values = string_list.parse(text, options = string_list.KEEP_QUOTES) return clazz(origin = origin, values = values)
def parse(clazz, origin, text, node): if origin: check.check_value_origin(origin) check.check_node(node) strings = string_list.parse(text, options = string_list.KEEP_QUOTES) string_values, properties_text = clazz._split_values_and_properties(strings) values = [] if False: print('VLB.parse() origin: _%s_' % (str(origin))) print('VLB.parse() text: _%s_' % (text)) print('VLB.parse() value_type: %s' % (clazz.value_type())) print('VLB.parse() strings: %s' % (strings)) print('VLB.parse() string_values: %s' % (string_values)) print('VLB.parse() properties_text: %s' % (properties_text)) print('') for string_value in string_values: value_text = string_value + ' ' + properties_text value = clazz.value_type().parse(origin, value_text, node) values.append(value) return clazz(origin = origin, values = values)
def _parse_requires(clazz, node): assert node.data.text == clazz.REQUIRES text = node.get_text(node.CHILDREN_FLAT) return string_list.parse(text).to_set()