packages feed

swarm-0.4: editors/vscode/syntaxes/swarm.tmLanguage.json

{
	"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
	"name": "swarm",
	"patterns": [
		{"include": "#keywords"},
		{"include": "#comments"},
		{"include": "#strings"},
		{"include": "#variables"},
		{"include": "#constants"}
	],
	"repository": {
		"keywords": {
			"patterns": [
				{
				"name": "keyword.control.dictionary.def",
				"begin": "def\\s+(\\w+)\\s*(:((\\s*(cmd|dir|string|int|\\(|\\)|\\{|\\}|(\\*|\\+|->)|[a-z]\\w*|forall ([a-z]\\w*\\s*)+.)\\s*)+))?=",
				"end": "end",
				"beginCaptures": {
					"1": {"name": "entity.name.function"},
					"3": {"name": "entity.name.type"}
				},
				"patterns": [
					{"include": "#keywords"},
					{"include": "#comments"},
					{"include": "#strings"},
					{"include": "#variables"},
					{"include": "#constants"}
				]
				},
				{
				"name": "keyword.control.dictionary.let",
				"begin": "\\s*let\\s+(\\w+)\\s*(:((\\s*(cmd|dir|text|int|void|unit|actor|\\(|\\)|\\{|\\}|(\\*|\\+|->)|[a-z]\\w*|forall ([a-z]\\w*\\s*)+.)\\s*)+))?=",
				"end": "\\s*in\\b",
				"beginCaptures": {
					"1": {"name": "entity.name.function"},
					"3": {"name": "entity.name.type"}
				},
				"patterns": [
					{"include": "#keywords"},
					{"include": "#comments"},
					{"include": "#strings"},
					{"include": "#variables"},
					{"include": "#constants"}
				]
				},
				{
				"name": "keyword.control.require",
				"match": "require"
				},
				{
				"name": "keyword.operator",
				"match": "-|==|!=|<|>|<=|>=|\\|\\||&&|\\+|-|\\*|/(?![/|*])|\\^|\\+\\+|\\$"
				},
				{
				"name": "keyword.operator.lambda",
				"match": "\\\\(\\w+)\\.",
				"captures": { "1": {"name": "variable.other"} }
				},
				{
				"name": "keyword.other",
				"match": "\\b(?i)(self|parent|base|if|inl|inr|case|fst|snd|force|undefined|fail|not|format|chars|split|charat|tochar|key|noop|wait|selfdestruct|move|backup|push|stride|turn|grab|harvest|place|give|equip|unequip|make|has|equipped|count|drill|use|build|salvage|reprogram|say|listen|log|view|appear|create|halt|time|scout|whereami|waypoint|detect|resonate|density|sniff|chirp|watch|surveil|heading|blocked|scan|upload|ishere|isempty|meet|meetall|whoami|setname|random|run|return|try|swap|atomic|instant|installkeyhandler|teleport|as|robotnamed|robotnumbered|knows)\\b"
				}
			]
			},
		"comments": {
			"patterns": [
				{
				"name": "comment.line.double-slash",
				"begin": "//",
				"end": "\n"
				},
				{
				"name":"comment.block",
				"begin": "\/[*]",
				"end": "[*](\/)"
				}
			]
		},
		"strings":{
			"patterns": [
				{
				"name":"string.quoted.double",
				"begin": "\"",
				"end": "\""
				}
			]
		},
		"variables":{
			"patterns": [
				{
				"name": "variable.language.dir",
				"match": "\\b(?i)(east|north|west|south|down|forward|left|back|right|)\\b"
				},
				{
				"name": "variable.parameter",
				"match": "\\b(?i)([a-z]\\w*)\\b"
				}
			]
		},
		"constants": {
			"patterns": [
				{
				"name": "constant.numeric",
				"match": "([0-9]+|0b[01]+|0o[0-8]+|0x\\x+)"
				}
			]
		}

	},
	"scopeName": "source.swarm"
}