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