Skip to content
Snippets Groups Projects
Select Git revision
  • develop default
  • release protected
  • v0.x
  • v2.2.0
  • v2.1.0
5 results

classicalb.tmLanguage.json

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    classicalb.tmLanguage.json 7.58 KiB
    {
    	"name": "Classical B",
    	"scopeName": "source.classicalb",
    	"patterns": [
    	  {
    		"include": "source.classicalb.rules"
    	  },
    	  {
    		"include": "#pragma"
    	  },
    	  {
    		"include": "#comments"
    	  },
    	  {
    		"include": "#strings"
    	  },
    	  {
    		"include": "#components"
    	  },
    	  {
    		"include": "#machineclauses"
    	  },
    	  {
    		"include": "#control_blocks"
    	  },
    	  {
    		"include": "#keyword_control"
    	  },
    	  {
    		"include": "#keyword_operators"
    	  },
    	  {
    		"include": "#constant_values"
    	  },
    	  {
    		"include": "#preferences"
    	  },
    	  {
    		"include": "#identifiers"
    	  },
    	  {
    		"include": "#invalid"
    	  }
    	],
    	"repository": {
    	  "identifiers": {
    		"patterns": [
    		  {
    			"match": "\\b[a-zA-Z][a-zA-Z0-9_]*\\b",
    			"name": "identifier.classicalb"
    		  }
    		]
    	  },
    	  "pragma": {
    		"patterns": [
    		  {
    			"begin": "/\\*@\\b(package|import-package|import_package|symbolic|unit|label|desc|description|conversion|file)\\b",
    			"captures": {
    			  "0": {
    				"name": "punctuation.definition.tag.classicalb"
    			  }
    			},
    			"end": "\\*/",
    			"name": "identifier.classicalb"
    		  }
    		]
    	  },
    	  "comments": {
    		"patterns": [
    		  {
    			"begin": "/\\*",
    			"captures": {
    			  "0": {
    				"name": "punctuation.definition.comment.classicalb"
    			  }
    			},
    			"end": "\\*/",
    			"name": "comment.block.classicalb"
    		  },
    		  {
    			"begin": "//",
    			"captures": {
    			  "0": {
    				"name": "punctuation.definition.comment.classicalb"
    			  }
    			},
    			"end": "\n",
    			"name": "comment.line.classicalb"
    		  }
    		]
    	  },
    	  "strings": {
    		"patterns": [
    		  {
    			"begin": "\"",
    			"beginCaptures": {
    			  "0": {
    				"name": "punctuation.definition.string.begin.classicalb"
    			  }
    			},
    			"end": "\"",
    			"endCaptures": {
    			  "0": {
    				"name": "punctuation.definition.string.end.classicalb"
    			  }
    			},
    			"name": "string.quoted.double.classicalb",
    			"patterns": [
    			  {
    				"match": "\\\\.",
    				"name": "constant.character.escape.classicalb"
    			  },
    			  {
    				"match": "\"\"",
    				"name": "constant.character.escape.quote.classicalb"
    			  }
    			]
    		  },
    		  {
    			"begin": "'''",
    			"captures": {
    			  "0": {
    				"name": "punctuation.definition.string.begin.classicalb"
    			  }
    			},
    			"end": "'''",
    			"name": "string.quoted.triple.classicalb"
    		  },
    		  {
    			"begin": "```",
    			"captures": {
    				"0": {
    					"name": "punctuation.definition.string.begin.classicalb"
    				}
    			},
    			"end": "```",
    			"name": "string.quoted.backtickTriple.classicalb",
    			"patterns": [
    			  {
    				  "match": "\\$(\\[[^${}\\[\\]]*\\])?\\{[^${}\\[\\]]*\\}",
    				  "name": "constant.character.escape.template.classicalb"
    			  }
    			]
    		  }
    		]
    	  },
    	  "machineclauses": {
    		"patterns": [
    		  {
    			"match": "(?x)\n\\b(INITIALI(Z|S)ATION|ASSERTIONS|OPERATIONS|SEES|PROMOTES|USES\n|INCLUDES|IMPORTS|REFINES|EXTENDS|INVARIANT|CONCRETE_VARIABLES\n|ABSTRACT_VARIABLES|VARIABLES|PROPERTIES|CONSTANTS|ABSTRACT_CONSTANTS\n|CONCRETE_CONSTANTS|CONSTRAINTS|SETS|FREETYPES|DEFINITIONS|VALUES|GOAL)\\b",
    			"name": "storage.type.clause.classicalb"
    		  }
    		]
    	  },
    	  "keyword_control": {
    		"patterns": [
    		  {
    			"match": "(?x)\n\\b(skip|BE|DO|VARIANT|ELSIF|THEN|ELSE|EITHER|CASE|SELECT\n|ASSERT|WHEN|WHERE|OR|OF|IN)\\b",
    			"name": "keyword.control.classicalb"
    		  }
    		]
    	  },
    	  "keyword_operators": {
    		"patterns": [
    		  {
    			"match": "\\bnot\\b|¬|\\bor\\b|\\bbtrue\\b|\\bbfalse\\b|∨",
    			"name": "keyword.operator.logical.classicalb"
    		  },
    		  {
    			"match": "!|#|∀|∃|&|∧|<=>|=>|⇔|⇒",
    			"name": "keyword.operator.logical.classicalb"
    		  },
    		  {
    			"match": "≠|/=|=|==",
    			"name": "keyword.operator.equality.classicalb"
    		  },
    		  {
    			"match": "\\b(first|last|tail|front|rev|seq|seq1|conc)\\b",
    			"name": "keyword.operator.sequence.classicalb"
    		  },
    		  {
    			"match": "\\b(tree|btree|top|const|rank|father|son|sons|subtree|arity|bin|left|right|sizet|prefix|postfix|mirror|infix)\\b",
    			"name": "keyword.operator.tree.classicalb"
    		  },
    		  {
    			"match": "\\b(mod|succ|pred|ceiling|real|floor)\\b",
    			"name": "keyword.operator.numeric.classicalb"
    		  },
    		  {
    			"match": "\\b(rec|struct)\\b",
    			"name": "keyword.operator.record.classicalb"
    		  },
    		  {
    			"match": "\\b(ran|dom|id|prj1|prj2|closure1|closure|iterate|fnc|rel)\\b|%|λ",
    			"name": "keyword.operator.relation.classicalb"
    		  },
    		  {
    			"match": "bool",
    			"name": "keyword.operator.boolean.classicalb"
    		  },
    		  {
    			"match": "<--|:=|::",
    			"name": "keyword.operator.assignment.classicalb"
    		  },
    		  {
    			"match": "\\b(INTER|UNION|SIGMA|PI|POW|POW1|union|inter)\\b|⋂|⋃|∑|∏",
    			"name": "keyword.operator.set.classicalb"
    		  },
    		  {
    			"match": "\\b(min|max|card|size)\\b",
    			"name": "keyword.operator.set.classicalb"
    		  },
    		  {
    			"match": ":|∈|∉|\\\\/|/\\\\|∪|∩|⊄|⊈|⊂|⊆",
    			"name": "keyword.operator.set.classicalb"
    		  },
    		  {
    			"begin": "{",
    			"beginCaptures": {
    			  "0": {
    				"name": "punctuation.definition.set.begin.classicalb"
    			  }
    			},
    			"end": "}",
    			"endCaptures": {
    			  "0": {
    				"name": "punctuation.definition.set.end.classicalb"
    			  }
    			},
    			"patterns": [
    			  {
    				"include": "$self"
    			  }
    			]
    		  },
    		  {
    			"match": "-->|-->(>)?|>->(>)?|<->|>+>(>)?",
    			"name": "keyword.operator.relation.classicalb"
    		  },
    		  {
    			"match": "(\\|>(>)?)|((<)?<\\|)|(\\|->)",
    			"name": "keyword.operator.relation.classicalb"
    		  },
    		  {
    			"match": "↠|↦|⤀|⤖|⇸|⤔|◀|←|→|↔|↣|▶|⇾|⋖|⊗|◁|▷|⇽",
    			"name": "keyword.operator.relation.classicalb"
    		  },
    		  {
    			"match": "\\|\\|",
    			"name": "keyword.operator.parallel.classicalb"
    		  },
    		  {
    			"match": ">|<|>=|=<|≤|≥",
    			"name": "keyword.operator.numeric.classicalb"
    		  }
    		]
    	  },
    	  "constant_values": {
    		"patterns": [
    		  {
    			"match": "\\b\\d+",
    			"name": "constant.numeric.classicalb"
    		  },
    		  {
    			"match": "{}|∅",
    			"name": "constant.set.classicalb"
    		  },
    		  {
    			"match": "\\b(TRUE|FALSE)\\b",
    			"name": "constant.language.boolean.classicalb"
    		  },
    		  {
    			"match": "\\b(BOOL|STRING|INT(EGER)?|NAT(URAL)?(1)?|MININT|MAXINT|REAL|FLOAT)\\b",
    			"name": "constant.other.sets.classicalb"
    		  }
    		]
    	  },
    	  "control_blocks": {
    		"patterns": [
    		  {
    			"begin": "(?x)\n\\b(BEGIN|PRE|SELECT|WITNESS|ANY|LET|VAR|ASSERT|WHILE|IF|CHOICE|CASE|EITHER)\\b",
    			"beginCaptures": {
    			  "0": {
    				"name": "keyword.control.classicalb"
    			  }
    			},
    			"end": "\\bEND\\b",
    			"endCaptures": {
    			  "0": {
    				"name": "keyword.control.classicalb"
    			  }
    			},
    			"patterns": [
    			  {
    				"match": "\\bINVARIANT\\b",
    				"name": "keyword.control.classicalb"
    			  },
    			  {
    				"include": "$self"
    			  }
    			]
    		  }
    		]
    	  },
    	  "components": {
    		"patterns": [
    		  {
    			"begin": "\\b(MACHINE|SYSTEM|MODEL|REFINEMENT|IMPLEMENTATION)\\b",
    			"beginCaptures": {
    			  "0": {
    				"name": "storage.type.machine.start.classicalb"
    			  }
    			},
    			"end": "\\bEND\\b",
    			"endCaptures": {
    			  "0": {
    				"name": "storage.type.machine.end.classicalb"
    			  }
    			},
    			"name": "meta.machine.classicalb",
    			"patterns": [
    			  {
    				"include": "$self"
    			  }
    			]
    		  }
    		]
    	  },
    	  "preferences": {
    		"patterns": [
    		  {
    			"match": "(?x)\n\\b(GOAL|SCOPE|SET_PREF_\\w*|FORCE_SYMMETRY_\\w*|GOAL|ANIMATION_FUNCTION_DEFAULT\n|VISB_JSON_FILE|VISB_SVG_FILE|VISB_SVG_BOX|VISB_SVG_CONTENTS\\w*|VISB_SVG_OBJECTS\\w*|VISB_SVG_HOVERS\\w*|VISB_SVG_UPDATES\\w*|VISB_SVG_EVENTS\\w*|CUSTOM_GRAPH|CUSTOM_GRAPH_EDGES|CUSTOM_GRAPH_NODES|HEURISTIC_FUNCTION|ANIMATION_FUNCTION[0-9]*|ANIMATION_IMG\\w*\n|ANIMATION_STR\\w*|ASSERT_(LTL|CTL)\\w*)\\b",
    			"name": "entity.other.attribute-name.classicalb"
    		  }
    		]
    	  },
    	  "invalid": {
    		"patterns": [
    		  {
    			"match": "@|\\?|€",
    			"name": "invalid.illegal.other.classicalb"
    		  },
    		  {
    			"match": ";(\\s)*;",
    			"name": "invalid.illegal.other.classicalb"
    		  }
    		]
    	  }
    	}
      }