本文整理汇总了Python中sheet.parser.parse_node.ParseNode类的典型用法代码示例。如果您正苦于以下问题:Python ParseNode类的具体用法?Python ParseNode怎么用?Python ParseNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParseNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRegisteredWithParse
def testRegisteredWithParse(self):
"test registered with ParseNode"
self.assertEquals(
type(ParseNode.construct_node(
ParseNode.FL_CELL_RANGE, ['a1', ':', 'b4'])),
FLCellRangeParseNode,
"Class is not registered with ParseNode")
示例2: testParseNodeShould
def testParseNodeShould(self):
"test ParseNode should allow registering of node classes"
class CustomParseNode(ParseNode):
def __init__(self, children):
ParseNode.__init__(self, "CUSTOM_NODE_TYPE", children)
ParseNode.register_node_type("CUSTOM_NODE_TYPE", CustomParseNode)
try:
node = ParseNode.construct_node("CUSTOM_NODE_TYPE", [])
self.assertEquals(type(node), CustomParseNode, "ParseNode.construct_node didn't dispatch to CustomParseNode")
self.assertEquals(node.type, "CUSTOM_NODE_TYPE", "Wrong type attribute")
self.assertEquals(node.children, [], "Wrong children")
node = ParseNode.construct_node("FISH BOWL", ["gox blamp"])
self.assertEquals(type(node), ParseNode, "ParseNode.construct_node didn't fall back to ParseNode")
self.assertEquals(node.type, "FISH BOWL", "Wrong type attribute")
self.assertEquals(node.children, ["gox blamp"], "Wrong children")
self.assertIsNotNone(ParseNode.classRegistry, "ParseNode didn't have a class registry")
finally:
del ParseNode.classRegistry["CUSTOM_NODE_TYPE"]
示例3: ListMaker
def ListMaker(children):
return ParseNode.construct_node(ParseNode.LIST_MAKER, children)
示例4: ListIf
def ListIf(children):
return ParseNode.construct_node(ParseNode.LIST_IF, children)
示例5: LambDef
def LambDef(children):
return ParseNode.construct_node(ParseNode.LAMBDEF, children)
示例6: GenIf
def GenIf(children):
return ParseNode.construct_node(ParseNode.GEN_IF, children)
示例7: FPList
def FPList(children):
return ParseNode.construct_node(ParseNode.FP_LIST, children)
示例8: Factor
def Factor(children):
return ParseNode.construct_node(ParseNode.FACTOR, children)
示例9: FLDeletedReference
def FLDeletedReference(children):
return ParseNode.construct_node(ParseNode.FL_DELETED_REFERENCE, children)
示例10: FLDDECall
def FLDDECall(children):
return ParseNode.construct_node(ParseNode.FL_DDE_CALL, children)
示例11: Atom
def Atom(children):
return ParseNode.construct_node(ParseNode.ATOM, children)
示例12: ArithExpr
def ArithExpr(children):
return ParseNode.construct_node(ParseNode.ARITH_EXPR, children)
示例13: Argument
def Argument(children):
return ParseNode.construct_node(ParseNode.ARGUMENT, children)
示例14: ArgList
def ArgList(children):
return ParseNode.construct_node(ParseNode.ARG_LIST, children)
示例15: AndTest
def AndTest(children):
return ParseNode.construct_node(ParseNode.AND_TEST, children)