Skip to content

πŸ“„ Library Reference

Vincent Estes edited this page Dec 24, 2022 · 1 revision

Official Library Reference for v0.8.1-beta

Handling

Tokens

Simpl-Py uses tokens to handle commands. Tokens are stored as strings. Here are all the token types:

Token Type Description Example
Base Prefix or Base Commands print, var
Operator Command Separator _, .
Sub Suffix or Sub-commands echo, read
Slash Sub Suffix for Slash Commands last-updated
Dial Sub Call Numbers 779, 73738

Tokenizer

Simpl-Py is able to break input down into these tokens and a command type using a tokenizer. Command types are mainly used for debugging. Here are all of the command types:

Command Type Description Example
Dot Dot Operator Used to Separate print.echo, txt.read
Under Underscore Operator Used to Separate print_math, print_var
Double Dot and Underscore Operator Used not used yet
Base No Operator Used print

Handlers

In Simpl-Py, all of the base functions are separated into function groups called handlers. Here is a list of all handlers:

Handler Name Description Example
Print Handler Handles print commands print, print.upper
Mod Handler Handles module commands @
Slash Handler Handles slash commands /last-updated, /i-care
TXT Handler Handles all txt commands txt.new, txt.write-var
Var Handler Handles all variable commands var.new
Call Handler Handles dialed numbers #779, #73738
BaseFunc Located in main() credits, help

Command Process

No Process Example
1 User inputs command print.correct
2 Tokenizer converts the string to the tokens list tokens = ['print', '.', 'correct']
3 The list is passed through a handler finder function find_handler(tokens)
4 Finds the 0th element of the tokens list tokens[0] = 'print'
5 Passes tokens to handlers based on the element print_handler(tokens)
6 The handler takes the tokens list and uses elements to check if the handler contains the command -
7 If there is a match, the handler returns the output Hello world
8 If there is no match, the handler returns an error {S-016x} - Print Handler Error

Comments

In Simpl-Py comments can be made by typing any non-command/non-operator value. A comment cannot begin with an operator, base token, or symbol command. Starting in v0.8.0-beta, newlines are not passed through handlers, making for a faster newline experience.

Invalid Comments:

  • .
  • _
  • any base token
  • any symbol command (#, /, @)

Errors

Errors in Simpl-Py are still being developed. In v0.8.0-beta all errors gained great detail with optional debugging info with dev mode (see call numbers). There are currently 27 errors including the ROOT ERROR caused by unloaded imports. There are no detailed descriptions of errors in the docs, as they are no longer needed. Descriptions can be found within the errors as they happen.

  • Library Reference
  • Tutorial Home
    • Intro
    • Installation and Setup
    • Intro to Simpl-Py Processes
    • Commenting
    • Intro to Print Functions
    • Variables
    • Print Math Function
    • Base Functions
    • Slash Functions
    • Simpl-Py Handling
    • Intro to Errors
    • Advanced Print Functions
    • Intro to TXT Functions
    • Intro to Call Numbers
    • Errors with Developer Mode
    • Advanced TXT Functions
    • Advanced Call Numbers
    • Intro to Modules
    • Beta Mode
    • Custom Modules
    • Advanced Modules
    • Future and Your Help

Clone this wiki locally