-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Your highlighter is a great start, but there are quite a few missing keywords.
In 3.6 we added a syntax map dump to cf-promises
--syntax-description, -s value - Output a document describing the available syntax elements of CFEngine. Possible values: 'none', 'json'. Default is 'none'.
I started playing around with parsing that. Perhaps we could use it to automatically generate a more complete syntax highlighter.
Here is my experiment so far.
#!/usr/bin/env python
import json
from pprint import pprint
seperator="|"
json_data = open('syntaxmap.json');
data = json.load(json_data)
attributes = []
for promiseType in data['promiseTypes']:
print promiseType
for attribute in data['promiseTypes'][promiseType]['attributes']:
attributes.append(attribute)
attributes=list(set(attributes))
attributes.sort()
#print data["functions"]
functions = []
for function in data['functions']:
functions.append(function)
functions.sort()
cfengine_keywords = attributes + functions
cfengine_keywords.sort()
for each in cfengine_keywords:
print each
Metadata
Metadata
Assignees
Labels
No labels