解析类似Python的语言
PLLParser的Python项目详细描述
PLL处理器
解析类似Python的语言
此软件包包括以下模块:
在特雷诺德.py在
概要
node = TreeNode('menubar')
# --- A node can be used like a dictionary
# It will, by default, have a key 'label' set
# to the string provided
print(node['label'])
# menubar
node['mykey'] = 'myvalue'
print(f"node has {len(node)} keys")
# node has 2 keys
firstChild = TreeNode('firstchild')
node.appendChildNode(firstChild)
secondChild = TreeNode('secondchild')
node.appendChildNode(secondChild)
thirdChild = TreeNode('thirdchild')
node.appendChildNode(secondChild)
print(f"node has {node.numChildren()} children")
# node has 3 children
print(f"node has {node.numSiblings()} siblings")
print(f"firstChild has {firstChild.numSiblings()} siblings")
# node has 0 siblings
# firstChild has 2 siblings
在复烤机.py在
概要
^{pr2}$在PLLParser.py在
概要
s = '''
* menubar
file
new
open
edit
undo
* layout
row
EditField
SelectField
'''
(tree, hSubTrees) = parsePLL(s)
assert len(hSubTrees) == 2
在parserUtils.py在
概要
See the file
单元测试
All unit tests appear at the end of the source file itself
They can be run using pytest
- 项目
标签: