解析类似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第三方库


热门话题
在java代码中实现两个侦听器时发生swing错误   Lambda是否完全取消了Java8中匿名内部类的使用?   swing OpenSuse 12.3+Java双显示   POM中的java错误。xml文件,即使在清理{users}/之后。m2/用于*上次更新文件的存储库   JavaEDT特定的方法和其他东西   java如何使用GridLayout设置组件大小?有更好的办法吗?   java在itext7中生成二维码时,如何调整点的大小?   java如何在多行上显示文本并右对齐?   java在WebSphereCluString环境中分离Log4j日志   JAVA从文件读取,返回BigInteger值   当使用rxjava2进行排列时,使用javamockito。重试()   在java fasterxml中创建Xml   使用64位整数进行模运算的64位整数的java快速乘法,无溢出   java静态变量保留以前发布的值   datastax enterprise SSTable loader流式处理无法提供java。木卫一。IOException:对等方重置连接   java匹配的通配符是严格的,但找不到元素“mvc:annotationdriven”的声明。标准包装。可抛出   java无法在浏览器上下载文件文档?