Skip to main content

Macro parser

Project description

PyPI Version License Python Version

Macro-parser is a Python package that provides a macro parser.

Basic Usage


Install with pip:

pip install macro-parser

Get Started

If you save the following text as test.txt:

# This is comment
# There are `new_macro` and `renew_macro`
# Its syntax is like Python:
# \new_macro(
# 	\func_name(func_args){
# 		func_body
# 	}
# )
		for arg in args:
			print('hello', arg)
		for arg in args:
			print('bye', arg)

# Verbatim environment

# Use the personal defined macros
\hello('world', 'iydon', 'vian')
\bye('world', 'iydon', 'vian')

# See what the built-in macors are
Built-in macros: \builtins().

Then you can parse the macros by:

from macro_parser import parse_macro_in

file = 'test.txt'

Finally, the result is:


hello world
hello iydon
hello vian

bye world
bye iydon
bye vian

Built-in macros: ('builtins', 'input', 'new_macro', 'parse', 'renew_macro', 'verb', 'verb_').

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for macro-parser, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size macro_parser-0.3.1-py3-none-any.whl (5.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size macro-parser-0.3.1.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page