解析类似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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Docker&SeleniumJava:无法在Docker容器上运行的chrome浏览器中上载图像/文件   在python中运行java命令   Java垃圾收集器异常行为   java java是否根据底层操作系统执行字节码级优化?   java是否可以休眠自定义查询返回映射而不是列表?   java Spring引导RabbitMQ接收器Jackson反序列化到POJO   apache flex在ActionScript3中创建对象相等“HashMap”作为java HashMap   java如何在Eclipse集成中切换JProfiler启动器   缓存JSP页面结果的java最佳实践?   java集成jaxb绑定文件,使用CXF生成基于WSDL的客户端   java为什么在上传操作结束之前,客户端没有检测到HttpServletResponse的PrintWriter内容?   java在接口内创建类和在类内创建接口有什么用   java向文件写入错误Android Studio   java合并多个RealmList并对结果列表排序?   谷歌API视觉java。lang.NoSuchMethodError   java如何使用逗号分别存储每个值,然后将它们存储到单独的数组中?