Skip to content
EricGebhart edited this page Sep 27, 2021 · 2 revisions

The syntax.

It's just a list of things with whitespace. words, strings and numbers. #'s at the beginning of a line are comments A ' on a line by itselfs indicates that YAML follows until 2 blank lines are encountered.

functions are either in / or some namespace. All function names must be fully qualified.

If the first thing is a python function with arguments the rest of the list is the arguments. If it isn't, then it's a list of commands and each is done in turn. But each command, can be a list of things.

If you put spr in a file, each list must be separated by a blank line.
A command list can be formatted however you like, but the lines must be contiguous. A blank line results in the command being executed. Here is a sample from

Functions can also be defined as yaml, which looks like this.

def dedupwith
    "Remove duplicates from the with stack,
     keeping the first entries found from the topdown."
    '
    - with /tmp
    - as/-get ~/_with_path_
    - as/reverse ~_last_result_
    - as/dedup ~_last_result_
    # - as/rest ~_last_result_
    - as/reverse ~_last_result_
    - with ~_last_result_
    - pop-with

Here is an example of using a message box and creating a new command that does the same thing. First is using a msg box. Then defining a new command mymsg, then using the new command. This is how it started. Just a nice list of functions and strings.

Here's hello world 3 ways. Using a dialog message box.

Note the blank lines. They are not optional.

    # hello world
    ui/msg "Hello World as a string" "Some silly title"

    def mymsg "my special msg" 
        ui/msg "Hello World hardcoded in mymsg" "Another title"

    # hello world again.
    mymsg 
    
    # define msg in the current with.
    '
    msg: "Hello world as an automatic parameter"
    title: Hello World!
    
    
    # hello world again.
    ui/msg

That's it. words strings and numbers separated by spaces. Commands are separated by a blank line and can be formatted with whitespace in any way, as long as the lines are contiguous.

Yaml, if it's not the last thing in the file, will be followed by 2 blank lines.

Clone this wiki locally