Skip to main content

blockly > utils > parsing

utils.parsing namespace

Functions

Function

Description

checkMessageReferences(message)

Validates that any %{MSG_KEY} references in the message refer to keys of the Msg string table.

parseBlockColour(colour)

Parse a block colour from a number or string, as provided in a block definition.

replaceMessageReferences(message)

Replaces string table references in a message, if the message is a string. For example, "%{bky_my_msg}" and "%{BKY_MY_MSG}" will both be replaced with the value in Msg['MY_MSG'].

tokenizeInterpolation(message)

Parse a string with any number of interpolation tokens (%1, %2, ...). It will also replace string table references (e.g., %{bky_my_msg} and %{BKY_MY_MSG} will both be replaced with the value in Msg['MY_MSG']). Percentage sign characters '%' may be self-escaped (e.g., '%%'). Newline characters will also be output as string tokens containing a single newline character.