Skip to main content

simple tool to help parse text

Project description

Kola

Simple python module for KoiLang parsing.

License PyPI Python Version

Installation

From pip:

pip install KoiLang

From source code:

python setup.py build_ext --inplace
python setup.py install

What is KoiLang

KoiLang is a markup language while is easy to read for people. There is an simple example.

#hello KoiLang
I am glad to meet you!

In KoiLang, file is divided into 'command' part and 'text' part. The formation of command part is like C preprocessor directive, using '#' as starting. And text is surrounding commands.

#command "This is a command"
This is a text.

Each command can have several arguments behind the command name. Valid argument type include integer, float, literal and string.

#arg_int    1 0b101 0x6CF
#arg_float  1.0 2e-2
#arg_literal __name__
#arg_string "A string"

Here "literal" is a valid python variety name containing letter, digit, underline and not starting with digit. Usual it is same as a string.

There is another kind of arguments -- keyword arguments which formation is as this:

#kwargs key(value)

And another format:
#keyargs_list key(item0, item1)

And the third:
#kwargs_dict key(x: 11, y: 45, z: 14)

All the arguments can be put together

#draw Line 2 pos0(x: 0, y: 0) pos1(x: 16, y: 16) \
    thickness(2) color(255, 255, 255)

What can Kola module do

Kola module provides a fast way to convert KoiLang command to a python function call.

Above command will convert to calling below:

draw(
    "Line", 2,
    pos0={"x": 0, "y": 0},
    pos1={"x": 16, "y": 16},
    thickness=2,
    color=[255, 255, 255]
)

Project details


Download files

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

Source Distribution

KoiLang-0.1.0a1.tar.gz (152.6 kB view details)

Uploaded Source

Built Distribution

KoiLang-0.1.0a1-cp38-cp38-win_amd64.whl (78.3 kB view details)

Uploaded CPython 3.8 Windows x86-64

File details

Details for the file KoiLang-0.1.0a1.tar.gz.

File metadata

  • Download URL: KoiLang-0.1.0a1.tar.gz
  • Upload date:
  • Size: 152.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for KoiLang-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 81bd665316978ff416662f120b4dc92a8b0c49ec084673e6e5e73f534db4e729
MD5 9f383e6ae0c172144f2ba68294f13730
BLAKE2b-256 9b3e4d9efa995db373f7582ee6060f6b8a84529c5e7db05c2646ece08fe9809b

See more details on using hashes here.

File details

Details for the file KoiLang-0.1.0a1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: KoiLang-0.1.0a1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.12

File hashes

Hashes for KoiLang-0.1.0a1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 9af8caf46c0c7369fc14ceff49d8a81c6fd7954c5f109a9eb1eec4a4547f7ebc
MD5 ba714835518642a5a5cadb6700e6afaa
BLAKE2b-256 c1ffdd96b9655621ac8cac7db7f125df3f42548d54200a5b6182f4851845baf6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page