Class for a code generator that translates the blocks into a language.
Language name of this generator.
Maximum length for a comment before wrapping. Does not account for indenting level.
The method of indenting. Defaults to two spaces, but language generators may override this to increase indent or change to tabs.
Arbitrary code to inject into locations that risk causing infinite loops. Any instances of '%1' will be replaced by the block ID that failed. E.g. ' checkTimeout(%1);\n'
Whether the init method has been called. Generators that set this flag to false after creation and true in init will cause blockToCode to emit a warning if the generator has not been initialized. If this flag is untouched, it will have no effect.
List of outer-inner pairings that do NOT require parentheses.
Arbitrary code to inject before every statement. Any instances of '%1' will be replaced by the block ID of the statement. E.g. 'highlight(%1);\n'
Arbitrary code to inject after every statement. Any instances of '%1' will be replaced by the block ID of the statement. E.g. 'highlight(%1);\n'
Add an infinite loop trap to the contents of a loop. Add statement suffix at the start of the loop block (right after the loop statement executes), and a statement prefix to the end of the loop block (right before the loop statement executes).
Loop contents, with infinite loop trap added.
Add one or more words to the list of reserved words for this language.
Comma-separated list of words to add to the list. No spaces. Duplicates are ok.
Generate code for the specified block (and attached blocks). The generator must be initialized before calling this function.
For statement blocks, the generated code. For value blocks, an array containing the generated code and an operator order value. Returns '' if block is null.
Hook for code to run at end of code generation. Subclasses may override this, e.g. to prepend the generated code with import statements or variable definitions.
Generated code.
Completed code.
Prepend a common prefix onto each line of code. Intended for indenting code or adding comment markers.
The lines of code.
The common prefix.
The prefixed lines of code.
Naked values are top-level blocks with outputs that aren't plugged into anything. Subclasses may override this, e.g. if their language does not allow naked values.
Line of generated code.
Legal line of code.
Generate a code string representing the blocks attached to the named statement input. Indent the code. This is mainly used in generators. When trying to generate code to evaluate look at using workspaceToCode or blockToCode.
Generated code or '' if no blocks are connected.
Generate code representing the specified value input.
Generated code or '' if no blocks are connected or the specified input does not exist.
Fake class which should be extended to avoid inheriting static properties