diff --git a/lexers/embedded/cfengine3.xml b/lexers/embedded/cfengine3.xml index 537a6cd..d330549 100644 --- a/lexers/embedded/cfengine3.xml +++ b/lexers/embedded/cfengine3.xml @@ -38,6 +38,9 @@ + + + @@ -47,7 +50,7 @@ - + @@ -58,7 +61,7 @@ - + @@ -89,7 +92,15 @@ - + + + + + + + + + @@ -134,7 +145,7 @@ - + @@ -153,5 +164,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/lexers/testdata/cfengine3.actual b/lexers/testdata/cfengine3.actual new file mode 100644 index 0000000..10d4b2d --- /dev/null +++ b/lexers/testdata/cfengine3.actual @@ -0,0 +1,27 @@ +@if minimum_version(3.20) +body members foo +{ + include => { "alice", "bob" }; + exclude => { "malcom" }; +} +@endif + +@if minimum_version(3.20) +promise agent blah +{ + path => "/some/path"; +} +@endif + +bundle agent __main__ +{ + groups: + "foo" + policy => "present", +@if minimum_version(3.20) + members => foo; +@else + members => '{ "include": ["alice", "bob"], + "exclude": ["malcom"] }'; +@endif +} diff --git a/lexers/testdata/cfengine3.expected b/lexers/testdata/cfengine3.expected new file mode 100644 index 0000000..b887072 --- /dev/null +++ b/lexers/testdata/cfengine3.expected @@ -0,0 +1,99 @@ +[ + {"type":"CommentPreproc","value":"@if minimum_version(3.20)\n"}, + {"type":"Keyword","value":"body"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"members"}, + {"type":"Text","value":" "}, + {"type":"NameFunction","value":"foo"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordReserved","value":"include"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"alice\""}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"bob\""}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"};"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordReserved","value":"exclude"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"malcom\""}, + {"type":"Text","value":" "}, + {"type":"Punctuation","value":"};"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"}, + {"type":"CommentPreproc","value":"@endif\n"}, + {"type":"Text","value":"\n"}, + {"type":"CommentPreproc","value":"@if minimum_version(3.20)\n"}, + {"type":"Keyword","value":"promise"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"agent"}, + {"type":"Text","value":" "}, + {"type":"NameFunction","value":"blah"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordReserved","value":"path"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"/some/path\""}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"}, + {"type":"CommentPreproc","value":"@endif\n"}, + {"type":"Text","value":"\n"}, + {"type":"Keyword","value":"bundle"}, + {"type":"Text","value":" "}, + {"type":"Keyword","value":"agent"}, + {"type":"Text","value":" "}, + {"type":"NameFunction","value":"__main__"}, + {"type":"Text","value":"\n"}, + {"type":"Punctuation","value":"{"}, + {"type":"Text","value":"\n "}, + {"type":"KeywordDeclaration","value":"groups"}, + {"type":"Punctuation","value":":"}, + {"type":"Text","value":"\n "}, + {"type":"LiteralString","value":"\"foo\""}, + {"type":"Text","value":"\n "}, + {"type":"KeywordReserved","value":"policy"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"\"present\""}, + {"type":"Punctuation","value":","}, + {"type":"Text","value":"\n"}, + {"type":"CommentPreproc","value":"@if minimum_version(3.20)\n"}, + {"type":"Text","value":" "}, + {"type":"KeywordReserved","value":"members"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"NameFunction","value":"foo"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"CommentPreproc","value":"@else\n"}, + {"type":"Text","value":" "}, + {"type":"KeywordReserved","value":"members"}, + {"type":"Text","value":" "}, + {"type":"Operator","value":"=\u003e"}, + {"type":"Text","value":" "}, + {"type":"LiteralString","value":"'{ \"include\": [\"alice\", \"bob\"],\n \"exclude\": [\"malcom\"] }'"}, + {"type":"Punctuation","value":";"}, + {"type":"Text","value":"\n"}, + {"type":"CommentPreproc","value":"@endif\n"}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"} +]