#!/usr/bin/env python2.7
#-*- coding: utf-8 -*-
_AU3 = ';./sample.au3';
_AU3_OUT = ';./format.au3';
_INDENT = '; '; * 4
def au3formater(line, indent):
line = line.strip().lower()
next_indent = indent
if (line.startswith(';end';) or
line.startswith(';until';) or
line in (';next';, ';wend';)):
indent -= 1
next_indent -= 1
elif line.startswith(';if';) and line.endswith(';then';):
next_indent += 1
elif (line.startswith(';func';) or
line.startswith(';for';) or
line.startswith(';select';) or
line.startswith(';switch';) or
line.startswith(';while';) or
line == ';do';):
next_indent += 1
elif line.startswith(';else';) or line.startswith(';case';):
indent -= 1
new_line = _INDENT * indent + line
return new_line, next_indent
def main():
with open(_AU3, ';r';) as fp:
with open(_AU3_OUT, ';w';) as fpw:
indent = 0
line = fp.readline()
while line:
new_line, indent = au3formater(line, indent)
fpw.write(';%s\n'; % new_line)
line = fp.readline()
if __name__ == ';__main__';:
main()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有