def handle_percent_number(s, l, t): value = t[0] strvalue = lang.to_string(value) return ("((%s) / 100 * ${parent.<property-name>})" %strvalue) if strvalue != 100 else "(${parent.<property-name>})"
def handle_percent_number(s, l, t): value = t[0] return "(this._get('parent')._get('<property-name>') * ((%s) / 100))" % lang.to_string( value)
(oneOf('+ -'), 2, opAssoc.LEFT, handle_binary_op), (oneOf('<< >>'), 2, opAssoc.LEFT, handle_binary_op), (oneOf('< <= > >= instanceof in'), 2, opAssoc.LEFT, handle_binary_op), (oneOf('== != === !=='), 2, opAssoc.LEFT, handle_binary_op), ('&', 2, opAssoc.LEFT, handle_binary_op), ('^', 2, opAssoc.LEFT, handle_binary_op), ('|', 2, opAssoc.LEFT, handle_binary_op), ('&&', 2, opAssoc.LEFT, handle_binary_op), ('||', 2, opAssoc.LEFT, handle_binary_op), (('?', ':'), 3, opAssoc.RIGHT, handle_ternary_op), ]) expression_ops.setParseAction(lambda s, l, t: "(%s)" %lang.to_string(t[0])) expression << expression_ops source = component_declaration cStyleComment.setParseAction(handle_documentation_string) source = source.ignore(cStyleComment) dblSlashComment.setParseAction(handle_documentation_string) source = source.ignore(dblSlashComment) source = source.ignore(import_statement) def parse(data): global doc_root_component doc_root_component = None tree = source.parseString(data, parseAll = True) if len(tree) > 0:
def handle_percent_number(s, l, t): value = t[0] return "(${parent.<property-name>} * ((%s) / 100))" % lang.to_string(value)