本文整理汇总了Python中sheet.parser.parse_node.ParseNode.construct_node方法的典型用法代码示例。如果您正苦于以下问题:Python ParseNode.construct_node方法的具体用法?Python ParseNode.construct_node怎么用?Python ParseNode.construct_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sheet.parser.parse_node.ParseNode
的用法示例。
在下文中一共展示了ParseNode.construct_node方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testRegisteredWithParse
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
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
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
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
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def ListMaker(children):
return ParseNode.construct_node(ParseNode.LIST_MAKER, children)
示例4: ListIf
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def ListIf(children):
return ParseNode.construct_node(ParseNode.LIST_IF, children)
示例5: LambDef
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def LambDef(children):
return ParseNode.construct_node(ParseNode.LAMBDEF, children)
示例6: GenIf
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def GenIf(children):
return ParseNode.construct_node(ParseNode.GEN_IF, children)
示例7: FPList
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def FPList(children):
return ParseNode.construct_node(ParseNode.FP_LIST, children)
示例8: Factor
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def Factor(children):
return ParseNode.construct_node(ParseNode.FACTOR, children)
示例9: FLDeletedReference
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def FLDeletedReference(children):
return ParseNode.construct_node(ParseNode.FL_DELETED_REFERENCE, children)
示例10: FLDDECall
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def FLDDECall(children):
return ParseNode.construct_node(ParseNode.FL_DDE_CALL, children)
示例11: Atom
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def Atom(children):
return ParseNode.construct_node(ParseNode.ATOM, children)
示例12: ArithExpr
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def ArithExpr(children):
return ParseNode.construct_node(ParseNode.ARITH_EXPR, children)
示例13: Argument
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def Argument(children):
return ParseNode.construct_node(ParseNode.ARGUMENT, children)
示例14: ArgList
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def ArgList(children):
return ParseNode.construct_node(ParseNode.ARG_LIST, children)
示例15: AndTest
# 需要导入模块: from sheet.parser.parse_node import ParseNode [as 别名]
# 或者: from sheet.parser.parse_node.ParseNode import construct_node [as 别名]
def AndTest(children):
return ParseNode.construct_node(ParseNode.AND_TEST, children)