python file macro processor
Project description
Mymacroprocessor
python file macro processor
Support label
if,ifdef,ifndef,elif,else,endif,defined,define,undef
test.py
#%indentunit 4
#%define #dbglog(x) print(x)
##%log:1
#%define DEBUG
#%define TEST
#dbglog("test1")
#dbglog("test2")
#dbglog("test3")
#%if defined TEST:
print("this is test code.")
#%if defined TEST1:
print("--------TEST1----------.")
#%endif
#%else:
print("--------1----------.")
print("--------2----------.")
#%endif
command
python .\Mymacroprocessor.py .\test3.py
out
##%log:1
print("test1")
print("test2")
print("test3")
print("this is test code.")
call function
testcontent1='''
#%indentunit 4
#%define dbglog(x) ##(x)
##%log:1
#%define DEBUG
#%define TEST1
dbglog("test1")
dbglog("娴嬭瘯2")
dbglog("娴嬭瘯3")
#%if defined TEST:
print("this is test code.")
#%if defined TEST1:
print("--------TEST1----------.")
#%endif
#%else:
print("--------1----------.")
print("--------2----------.")
#%endif
#%if defined DEBUG:
M1
#%endif
'''
pyp=Mymacroprocessor()
newcontents=pyp.pymprocessor(testcontent1)
print("--new code---\n"+newcontents)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Mymacroprocessor-0.0.3.tar.gz.
File metadata
- Download URL: Mymacroprocessor-0.0.3.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0f753165e698e4aab29887c0990e9bf05fc62f8e1bcd1166fba3235e999e70a
|
|
| MD5 |
4cf504740b2802ddf7a94a82240ba50e
|
|
| BLAKE2b-256 |
71c637bbca70c06ad317e05b393c3e833cd3c8f3e80ad861d77daca646a9de26
|
File details
Details for the file Mymacroprocessor-0.0.3-py3-none-any.whl.
File metadata
- Download URL: Mymacroprocessor-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
460376d2040b3686c02be903550f23682ce367f2477e2523666dddd85459ff52
|
|
| MD5 |
6a99985c7d803cbce2171efd24cfd04c
|
|
| BLAKE2b-256 |
0508616b9abdab08905c7df57378a4f68d8037662cbd8df94cb2ffa4054aeced
|