Skip to main content

Moeglichkeit eine kleine API mit Lexer zu erstellen

Project description

YAPI-heureka-code

Tokens angeben

Beispiel MuNa

group = YAPIGroup(
    keywords=[
        Token("SET"),
        Token("TO"),
        Token("COUNTER"),
        Token("ITERATOR")
    ],
    operators=[
        Token("SLASH", "/"),
        Token("PIPE", "|"),
        Token("DOPPELPUNKT", ":"),
        Token("KLEINER", "<"),
        Token("GROESSER", ">")
    ],
    other=[
        TokenGroup("CharsetDefinition", [
            Token("DIGITS"),
            Token("LETTERS"),
            Token("UPPER"),
            Token("LOWER")
        ])
    ]
)

Hierdurch werden die Keywords, die Operatoren und andere Tokens der Sprache festgelegt. Hier muss dann allerdings auf Groß- und Kleinschreibung geachtet werden. Hier wird alles großgeschrieben.

YAPI definieren

yapi = YAPI(group)
print(yapi.execute("SET <?DIGITS|2|gross?> TO <?gross?>"))

Über das Instanziieren der Klasse YAPI können Statements ausgeführt werden.

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

YAPI-heureka-code-1.1.2.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

YAPI_heureka_code-1.1.2-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

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