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+|true|false)(\s*\|\s*\w+(\(\s*('.*'|\$\d+|@\d+|true|false)?(\s*,\s*('.*'|\$\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+|true|false) a. A literal string, enclosed in single quotes 'hello world' b. A reference to one of the parameters passed to the string formatter. This is a 1-indexed number preceded by a dollarsign - $1 c. A reference to the result of one of the previous clogs. This is a 1-indexed number preceded by an 'at' symbol - @1 d. A literal integer - 12 e. A literal double - -0.3 f. A literal boolean - true or false`
  2. Formatters

Clone this wiki locally