diff --git a/lexers/embedded/iscdhcpd.xml b/lexers/embedded/iscdhcpd.xml new file mode 100644 index 000000000..babfb55bb --- /dev/null +++ b/lexers/embedded/iscdhcpd.xml @@ -0,0 +1,112 @@ + + + ISCdhcpd + iscdhcpd + *.conf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lexers/testdata/iscdhcpd.actual b/lexers/testdata/iscdhcpd.actual new file mode 100644 index 000000000..2dfec0a29 --- /dev/null +++ b/lexers/testdata/iscdhcpd.actual @@ -0,0 +1,77 @@ +# dhcpd.conf +# +# Sample configuration file for ISC dhcpd +# +# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as +# configuration file instead of this file. +# + +# option definitions common to all supported networks... +option domain-name "example.org"; +option domain-name-servers ns1.example.org, ns2.example.org; + +default-lease-time 600; +max-lease-time 7200; + +ddns-update-style none; + +authoritative; + +log-facility local7; + +# This is a very basic subnet declaration. + +subnet 10.254.239.0 netmask 255.255.255.224 { + range 10.254.239.10 10.254.239.20; + option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; +} + +subnet 10.254.239.32 netmask 255.255.255.224 { + range dynamic-bootp 10.254.239.40 10.254.239.60; + option broadcast-address 10.254.239.31; + option routers rtr-239-32-1.example.org; +} + +# A slightly different configuration for an internal subnet. +subnet 10.5.5.0 netmask 255.255.255.224 { + range 10.5.5.26 10.5.5.30; + option domain-name-servers ns1.internal.example.org; + option domain-name "internal.example.org"; + option subnet-mask 255.255.255.224; + option routers 10.5.5.1; + option broadcast-address 10.5.5.31; + default-lease-time 600; + max-lease-time 7200; +} + +host passacaglia { + hardware ethernet 0:0:c0:5d:bd:95; + filename "vmunix.passacaglia"; + server-name "toccata.example.com"; +} + +host fantasia { + hardware ethernet 08:00:07:26:c0:a5; + fixed-address fantasia.example.com; +} + +class "foo" { + match if substring (option vendor-class-identifier, 0, 4) = "S\"UNW"; +} + +shared-network 224-29 { + subnet 10.17.224.0 netmask 255.255.255.0 { + option routers rtr-224.example.org; + } + subnet 10.0.29.0 netmask 255.255.255.0 { + option routers rtr-29.example.org; + } + pool { + allow members of "foo"; + range 10.17.224.10 10.17.224.250; + } + pool { + deny members of "foo"; + range 10.0.29.10 10.0.29.230; + } +} diff --git a/lexers/testdata/iscdhcpd.expected b/lexers/testdata/iscdhcpd.expected new file mode 100644 index 000000000..5b6492959 --- /dev/null +++ b/lexers/testdata/iscdhcpd.expected @@ -0,0 +1,345 @@ +[ + {"type":"Comment","value":"# dhcpd.conf\n#\n# Sample configuration file for ISC dhcpd\n#\n# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as\n# configuration file instead of this file.\n#\n"}, + {"type":"Text","value":"\n"}, + {"type":"Comment","value":"# option definitions common to all supported networks...\n"}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"domain-name"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"example.org\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"domain-name-servers"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"ns1.example.org"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"ns2.example.org"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n\n"}, + {"type":"NameVariable","value":"default-lease-time"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"600"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"NameVariable","value":"max-lease-time"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"7200"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n\n"}, + {"type":"NameVariable","value":"ddns-update-style"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"none"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n\n"}, + {"type":"Keyword","value":"authoritative"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n\n"}, + {"type":"NameVariable","value":"log-facility"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"local7"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n\n"}, + {"type":"Comment","value":"# This is a very basic subnet declaration.\n"}, + {"type":"Text","value":"\n"}, + {"type":"KeywordType","value":"subnet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.0"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"netmask"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"255.255.255.224"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"range"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.10"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.20"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"routers"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"rtr-239-0-1.example.org"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"rtr-239-0-2.example.org"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordType","value":"subnet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.32"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"netmask"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"255.255.255.224"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"range"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"dynamic-bootp"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.40"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.60"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"broadcast-address"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.254.239.31"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"routers"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"rtr-239-32-1.example.org"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"Comment","value":"# A slightly different configuration for an internal subnet.\n"}, + {"type":"KeywordType","value":"subnet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.5.5.0"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"netmask"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"255.255.255.224"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"range"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.5.5.26"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.5.5.30"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"domain-name-servers"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"ns1.internal.example.org"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"domain-name"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"internal.example.org\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"subnet"}, + {"type":"NameVariable","value":"-mask"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"255.255.255.224"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"routers"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.5.5.1"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"broadcast-address"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.5.5.31"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"default-lease-time"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"600"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"max-lease-time"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"7200"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordType","value":"host"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"passacaglia"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"hardware"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"ethernet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberHex","value":"0:0:c0:5d:bd:95"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"filename"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"vmunix.passacaglia\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"server-name"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"toccata.example.com\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordType","value":"host"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"fantasia"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"hardware"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"ethernet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberHex","value":"08:00:07:26:c0:a5"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"fixed-address"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"fantasia.example.com"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"KeywordType","value":"class"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"foo\""}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"match"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"if"}, + {"type":"Text","value":" "}, + {"type":"NameFunction","value":"substring"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"("}, + {"type":"NameVariable","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"vendor-class-identifier"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"0"}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"4"}, + {"type":"Punctuation","value":")"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"="}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"S"}, + {"type":"LiteralStringEscape","value":"\\\""}, + {"type":"LiteralString","value":"UNW\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n\n"}, + {"type":"NameVariable","value":"shared-network"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"224-29"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordType","value":"subnet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.17.224.0"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"netmask"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"255.255.255.0"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"routers"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"rtr-224.example.org"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordType","value":"subnet"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.0.29.0"}, + {"type":"Text","value":" "}, + {"type":"KeywordType","value":"netmask"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"255.255.255.0"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"Keyword","value":"option"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"routers"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"rtr-29.example.org"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordType","value":"pool"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"allow"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"members"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"of"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"foo\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"range"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.17.224.10"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.17.224.250"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordType","value":"pool"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"deny"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"members"}, + {"type":"Text","value":" "}, + {"type":"NameVariable","value":"of"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"foo\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"NameVariable","value":"range"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.0.29.10"}, + {"type":"Text","value":" "}, + {"type":"LiteralNumberFloat","value":"10.0.29.230"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n "}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"} +]