Login
Rules code structure
Login

Each module which contains code of the program's rules is split on several parts.

ruleConfig

ruleConfig contains configuration of the rule. Available settings are:


Constants

Each rule has available the following constants to use in its code:


checkRule

checkRule is the macro which is runs to check the Nim code. It is split on several parts. Each part must have at least discard statement. The checkRule is a recursive statement, it executes itself from the main AST node of the code to each its child. Additionally, the statement can raise only the ValueError exception, all other exceptions must be caught in the code. All the checking parts are:

checkRule has access to the following variables:

checkRule can use the following procedures and templates:


fixRule

fixRule is the macro which will be executed for fix type of the rule. It must contain at least discard statement. If it is set to discard only statement, then the command set by the configuration fixCommand setting will be executed. Otherwise, the code inside the macro will be used, unless the program's configuration option forceFixCommand is set. The macro returns true if the Nim code was modified, so the program can save the new version of the Nim code to the file, otherwise false. If fixCommand executed, the macro always returns false. Additionally, the statement can't raise any exception, all must be caught in the code.

fixRule has access to the following variables: