[d24f17c] | 1 | /*
|
---|
| 2 | Language: Puppet
|
---|
| 3 | Author: Jose Molina Colmenero <gaudy41@gmail.com>
|
---|
| 4 | Website: https://puppet.com/docs
|
---|
| 5 | Category: config
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | function puppet(hljs) {
|
---|
| 9 | const PUPPET_KEYWORDS = {
|
---|
| 10 | keyword:
|
---|
| 11 | /* language keywords */
|
---|
| 12 | 'and case default else elsif false if in import enherits node or true undef unless main settings $string ',
|
---|
| 13 | literal:
|
---|
| 14 | /* metaparameters */
|
---|
| 15 | 'alias audit before loglevel noop require subscribe tag ' +
|
---|
| 16 | /* normal attributes */
|
---|
| 17 | 'owner ensure group mode name|0 changes context force incl lens load_path onlyif provider returns root show_diff type_check ' +
|
---|
| 18 | 'en_address ip_address realname command environment hour monute month monthday special target weekday ' +
|
---|
| 19 | 'creates cwd ogoutput refresh refreshonly tries try_sleep umask backup checksum content ctime force ignore ' +
|
---|
| 20 | 'links mtime purge recurse recurselimit replace selinux_ignore_defaults selrange selrole seltype seluser source ' +
|
---|
| 21 | 'souirce_permissions sourceselect validate_cmd validate_replacement allowdupe attribute_membership auth_membership forcelocal gid ' +
|
---|
| 22 | 'ia_load_module members system host_aliases ip allowed_trunk_vlans description device_url duplex encapsulation etherchannel ' +
|
---|
| 23 | 'native_vlan speed principals allow_root auth_class auth_type authenticate_user k_of_n mechanisms rule session_owner shared options ' +
|
---|
| 24 | 'device fstype enable hasrestart directory present absent link atboot blockdevice device dump pass remounts poller_tag use ' +
|
---|
| 25 | 'message withpath adminfile allow_virtual allowcdrom category configfiles flavor install_options instance package_settings platform ' +
|
---|
| 26 | 'responsefile status uninstall_options vendor unless_system_user unless_uid binary control flags hasstatus manifest pattern restart running ' +
|
---|
| 27 | 'start stop allowdupe auths expiry gid groups home iterations key_membership keys managehome membership password password_max_age ' +
|
---|
| 28 | 'password_min_age profile_membership profiles project purge_ssh_keys role_membership roles salt shell uid baseurl cost descr enabled ' +
|
---|
| 29 | 'enablegroups exclude failovermethod gpgcheck gpgkey http_caching include includepkgs keepalive metadata_expire metalink mirrorlist ' +
|
---|
| 30 | 'priority protect proxy proxy_password proxy_username repo_gpgcheck s3_enabled skip_if_unavailable sslcacert sslclientcert sslclientkey ' +
|
---|
| 31 | 'sslverify mounted',
|
---|
| 32 | built_in:
|
---|
| 33 | /* core facts */
|
---|
| 34 | 'architecture augeasversion blockdevices boardmanufacturer boardproductname boardserialnumber cfkey dhcp_servers ' +
|
---|
| 35 | 'domain ec2_ ec2_userdata facterversion filesystems ldom fqdn gid hardwareisa hardwaremodel hostname id|0 interfaces ' +
|
---|
| 36 | 'ipaddress ipaddress_ ipaddress6 ipaddress6_ iphostnumber is_virtual kernel kernelmajversion kernelrelease kernelversion ' +
|
---|
| 37 | 'kernelrelease kernelversion lsbdistcodename lsbdistdescription lsbdistid lsbdistrelease lsbmajdistrelease lsbminordistrelease ' +
|
---|
| 38 | 'lsbrelease macaddress macaddress_ macosx_buildversion macosx_productname macosx_productversion macosx_productverson_major ' +
|
---|
| 39 | 'macosx_productversion_minor manufacturer memoryfree memorysize netmask metmask_ network_ operatingsystem operatingsystemmajrelease ' +
|
---|
| 40 | 'operatingsystemrelease osfamily partitions path physicalprocessorcount processor processorcount productname ps puppetversion ' +
|
---|
| 41 | 'rubysitedir rubyversion selinux selinux_config_mode selinux_config_policy selinux_current_mode selinux_current_mode selinux_enforced ' +
|
---|
| 42 | 'selinux_policyversion serialnumber sp_ sshdsakey sshecdsakey sshrsakey swapencrypted swapfree swapsize timezone type uniqueid uptime ' +
|
---|
| 43 | 'uptime_days uptime_hours uptime_seconds uuid virtual vlans xendomains zfs_version zonenae zones zpool_version'
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | const COMMENT = hljs.COMMENT('#', '$');
|
---|
| 47 |
|
---|
| 48 | const IDENT_RE = '([A-Za-z_]|::)(\\w|::)*';
|
---|
| 49 |
|
---|
| 50 | const TITLE = hljs.inherit(hljs.TITLE_MODE, {
|
---|
| 51 | begin: IDENT_RE
|
---|
| 52 | });
|
---|
| 53 |
|
---|
| 54 | const VARIABLE = {
|
---|
| 55 | className: 'variable',
|
---|
| 56 | begin: '\\$' + IDENT_RE
|
---|
| 57 | };
|
---|
| 58 |
|
---|
| 59 | const STRING = {
|
---|
| 60 | className: 'string',
|
---|
| 61 | contains: [
|
---|
| 62 | hljs.BACKSLASH_ESCAPE,
|
---|
| 63 | VARIABLE
|
---|
| 64 | ],
|
---|
| 65 | variants: [
|
---|
| 66 | {
|
---|
| 67 | begin: /'/,
|
---|
| 68 | end: /'/
|
---|
| 69 | },
|
---|
| 70 | {
|
---|
| 71 | begin: /"/,
|
---|
| 72 | end: /"/
|
---|
| 73 | }
|
---|
| 74 | ]
|
---|
| 75 | };
|
---|
| 76 |
|
---|
| 77 | return {
|
---|
| 78 | name: 'Puppet',
|
---|
| 79 | aliases: [ 'pp' ],
|
---|
| 80 | contains: [
|
---|
| 81 | COMMENT,
|
---|
| 82 | VARIABLE,
|
---|
| 83 | STRING,
|
---|
| 84 | {
|
---|
| 85 | beginKeywords: 'class',
|
---|
| 86 | end: '\\{|;',
|
---|
| 87 | illegal: /=/,
|
---|
| 88 | contains: [
|
---|
| 89 | TITLE,
|
---|
| 90 | COMMENT
|
---|
| 91 | ]
|
---|
| 92 | },
|
---|
| 93 | {
|
---|
| 94 | beginKeywords: 'define',
|
---|
| 95 | end: /\{/,
|
---|
| 96 | contains: [
|
---|
| 97 | {
|
---|
| 98 | className: 'section',
|
---|
| 99 | begin: hljs.IDENT_RE,
|
---|
| 100 | endsParent: true
|
---|
| 101 | }
|
---|
| 102 | ]
|
---|
| 103 | },
|
---|
| 104 | {
|
---|
| 105 | begin: hljs.IDENT_RE + '\\s+\\{',
|
---|
| 106 | returnBegin: true,
|
---|
| 107 | end: /\S/,
|
---|
| 108 | contains: [
|
---|
| 109 | {
|
---|
| 110 | className: 'keyword',
|
---|
| 111 | begin: hljs.IDENT_RE
|
---|
| 112 | },
|
---|
| 113 | {
|
---|
| 114 | begin: /\{/,
|
---|
| 115 | end: /\}/,
|
---|
| 116 | keywords: PUPPET_KEYWORDS,
|
---|
| 117 | relevance: 0,
|
---|
| 118 | contains: [
|
---|
| 119 | STRING,
|
---|
| 120 | COMMENT,
|
---|
| 121 | {
|
---|
| 122 | begin: '[a-zA-Z_]+\\s*=>',
|
---|
| 123 | returnBegin: true,
|
---|
| 124 | end: '=>',
|
---|
| 125 | contains: [
|
---|
| 126 | {
|
---|
| 127 | className: 'attr',
|
---|
| 128 | begin: hljs.IDENT_RE
|
---|
| 129 | }
|
---|
| 130 | ]
|
---|
| 131 | },
|
---|
| 132 | {
|
---|
| 133 | className: 'number',
|
---|
| 134 | begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',
|
---|
| 135 | relevance: 0
|
---|
| 136 | },
|
---|
| 137 | VARIABLE
|
---|
| 138 | ]
|
---|
| 139 | }
|
---|
| 140 | ],
|
---|
| 141 | relevance: 0
|
---|
| 142 | }
|
---|
| 143 | ]
|
---|
| 144 | };
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | module.exports = puppet;
|
---|