Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Parseltongue Syntax

Casey Brooks edited this page Sep 13, 2016 · 5 revisions

The following regex matches a single clog:

(#\{\s*(\$\d+|@\d+|'.*'|\d+|-?\d+(.\d+)|true|false)(\s*\|\s*\w+(\(\s*(\$\d+|@\d+|'.*'|\d+|-?\d+(.\d+)|true|false)?(\s*,\s*(\$\d+|@\d+|'.*'|\d+|-?\d+(.\d+)|true|false)\s*)*\s*\))?)*\s*\})

It looks complicated, but it's pretty simple: A clog has two basic components wrapped inside #{ }:

  1. Parameters - One of the following (matches regex \$\d+|@\d+|'.*'|\d+|-?\d+(.\d+)|true|false)
  2. A reference to one of the parameters passed to the string formatter. This is a 1-indexed number preceded by a dollarsign - $1
  3. A reference to the result of one of the previous clogs. This is a 1-indexed number preceded by an 'at' symbol - @1
  4. A literal string, enclosed in single quotes 'hello world'
  5. A literal integer - 12
  6. A literal double - -0.3
  7. A literal boolean - true or false`
  8. Formatters

Clone this wiki locally