NAME

set.rules - Rules set for acheck

DESCRIPTION

Rules set files contain rules to be check by acheck.
Lines beginning with a number sign (`#') and empty lines will be
ignored. Spaces at the beginning and the end of a line will also be
ignored as well as tabulators. If you need spaces at the end or the
beginning of a value you can use apostrophes (`"'). A comment starts
with the number sign, there can be any number of spaces and/or tab
stops in front of the #. Long lines can be broken into multiple lines
ending with a backslash (`\'). Some possible examples:
# this line is ignored
field value
field value # this is a comment
field "value ending with space "
field value\
continuing on the next line
You have to escape number signs with a backslash to use it in a value
and use apostrophes if a value ends with a backslash.
Rule sets are made of lists of rules. Theses lists can be repeated a
number of times, until or while a condition happens.
A rule detects an error if the corresponding test succeeds and none of
its validation tests does. Each rule can then produce some fixes, a
warning or an error, and provide hints to help the operator to correct
the error.
Parts of the text can be set as comments and so no rule and no spell
check will be performed on them.

RULEFILESYNTAX

SYNTAXRULES

list
A list starts at a `list' statement, and stops at the first `end_list'
or at the end of the file.
Mandatory fields:
type type
until, perform the list until the current line matches `test'
while, perform the lint while the current line matches `test'
loop, perform the list `test' times
test regex / number
A regex for `until' and `while' lists. The number of times the list
must be performed for `loop', or `0' for infinite loop.
Optional fields:
name name
Use this to give the list a name.
spell yes / no
Set it to `yes' (default) or `no', if you want or don't want
spelling to be checked in the lines matching this list. This value
will be inherited by the nested lists.
Sub-rules:
list [name]
rule [name]
comment [name]
Followed by the name of the sub-rule or its definition for an
anonymous sub-rule.
rule
A rule starts at a `rule' statement, and stops at the first `end_rule'
or at the beginning of a comment or a list.
Mandatory fields:
type type
fix, rule provides fixes and hints thought a menu
autofix, rule fixes the mistake with no interaction
warning, rule issues a warning
error, rule issues an error
nop, special rule that do nothing, no other field is required
regex regex
The regex to be match to found this error. Patterns can be captures
and then used in the `fix' expression.
fix expr
Provides a correction for the rule, this field can be repeated to
provides more than one choice. Only the first one will be used for
`autofix' rules. `warning' and `error' do not provides fixes. The
captured patterns can be used here with variables `$1', `$2', and
so on.
hint text
Provides some explanations, this will be used as reviewer comments
in review mode.
Optional fields:
name name
Use this to give the rule a name.
valid [name]
Provides a validation test, it can be named or anonymous. For
anonymous validation, the test definition must follow. This field
can be repeated more than once, if any of the validation test
succeed, the rule does not apply.
valid
A validation test starts at a `valid' statement, and stops at the first
`end_valid' or at the beginning of a rule, a comment, a list or another
validation test.
Mandatory field:
pre regex
in regex>
post regex
Try the regex before, in or after the match of the regex rule. At
least one of these test must be provided. If all tests are
successful, the rule won't apply.
Optional field:
name name
Use this to give the validation test a name.
comment
A comment starts at a `comment' statement, and stops at the first
`end_comment' or at the beginning of a rule, a comment or a list.
Comments are just skipped, no other rule and no spelling are performed
on them.
Mandatory field:
skip regex
A regex matching the text of the comment. Do not use `start' and
`stop' with this.
start regex
stop regex
Regexs defining the beginning and the end of the comment, all the
text between will be considered as comment. Do not use `skip' with
this.
Optional fields:
name name
Use this to give the comment a name.
start_offsetstop_offset
Defines where the comment really starts or end. Values are `s' for
the place the match starts, `s+<n>' for n characters after the
match starts, `e' for the place the match ends, or `e-<n>' for n
characters before the match ends. Defaults are `s' for `start'
matches and `e' for `stop' matches.