summaryrefslogtreecommitdiff
path: root/support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt
blob: 53ac2aa8b105edbcf944a463942b959a05d758c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// SPDX-License-Identifier: BSD-3-Clause
package org.islandoftex.arara.ruleset

import kotlinx.serialization.Serializable
import org.islandoftex.arara.utils.CommonUtils

/**
 * Implements the rule model.
 *
 * @author Island of TeX
 * @version 5.0
 * @since 4.0
 */
@Serializable
class Rule {
    /**
     * The rule identifier
     */
    var identifier: String = INVALID_RULE_IDENTIFIER
        get() = CommonUtils.removeKeywordNotNull(field)

    /**
     * The rule name
     */
    var name: String = INVALID_RULE_NAME
        get() = CommonUtils.removeKeywordNotNull(field)

    /**
     * The list of authors
     */
    var authors: List<String> = listOf()
        get() = field.mapNotNull { CommonUtils.removeKeyword(it) }

    /**
     * The list of commands
     */
    var commands: List<RuleCommand> = listOf()

    /**
     * The list of arguments
     */
    var arguments: List<Argument> = listOf()

    companion object {
        const val INVALID_RULE_IDENTIFIER = "INVALID_RULE"
        const val INVALID_RULE_NAME = "INVALID_RULE"
    }
}