From b9fa45864dea7073dbc1e39649d72b1ddadd0217 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Fri, 15 Nov 2019 09:29:10 -0800 Subject: [PATCH] Use simpler highlighting textmate syntax Changes from: https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_format=auto&grammar_url=https%3A%2F%2Fraw.githubusercontent.com%2Fjpienaar%2Fmlir-grammar%2Fmaster%2Fgrammars%2Fmlir.json&grammar_text=&code_source=from-url&code_url=https%3A%2F%2Fraw.githubusercontent.com%2Fjpienaar%2Fmlir-grammar%2Fmaster%2Fsample.mlir&code= To: https://github-lightshow.herokuapp.com/?utf8=%E2%9C%93&scope=from-url&grammar_format=auto&grammar_url=https%3A%2F%2Fraw.githubusercontent.com%2Fjpienaar%2Fmlir-grammar%2Fsimpler%2Fgrammars%2Fmlir.json&grammar_text=&code_source=from-url&code_url=https%3A%2F%2Fraw.githubusercontent.com%2Fjpienaar%2Fmlir-grammar%2Fmaster%2Fsample.mlir&code= Which I think is an improvement. PiperOrigin-RevId: 280674770 --- mlir/utils/textmate/mlir.json | 425 ++++++++---------------------------------- 1 file changed, 73 insertions(+), 352 deletions(-) diff --git a/mlir/utils/textmate/mlir.json b/mlir/utils/textmate/mlir.json index bc9c18b..8399a97 100644 --- a/mlir/utils/textmate/mlir.json +++ b/mlir/utils/textmate/mlir.json @@ -1,392 +1,113 @@ { - "fileTypes" : [ + "fileTypes":[ "mlir" ], - "repository" : { - "container" : { - "end" : ">", - "begin" : "(complex|tuple)<", - "beginCaptures" : { - "1" : { - "name" : "keyword.container.mlir" - } - }, - "patterns" : [ - { - "include" : "#types" - } - ], - "name" : "meta.types.container.mlir" + "repository":{ + "attribute":{ + "match":"\\W[\\w_][\\w\\d_.$]*\\s*=", + "name":"meta.attribute.mlir" }, - "loc" : { - "end" : "\\)", - "begin" : "\\b(loc)\\(", - "beginCaptures" : { - "1" : { - "name" : "keyword.loc.mlir" - } - }, - "patterns" : [ - { - "include" : "#loc_fusedloc" - }, - { - "include" : "#loc_nameloc" - }, - { - "include" : "#op_generic" - } - ], - "name" : "meta.loc.mlir" + "branch_target":{ + "match":"\\^bb[\\w\\d_$\\.-]+", + "name":"entity.name.label.mlir" }, - "integer" : { - "match" : "[1-9][0-9]*", - "name" : "constant.numeric.mlir" + "comment":{ + "match":"\/\/.*$", + "name":"comment.line.double-slash.mlir" }, - "op" : { - "patterns" : [ - { - "include" : "#terminator" - }, - { - "include" : "#op_generic" - } - ] - }, - "loc_nameloc" : { - "patterns" : [ - { - "include" : "#string" - } - ], - "name" : "meta.location.mlir" - }, - "bool_constant" : { - "match" : "\\b(true|false)\\b", - "captures" : { - "1" : { - "name" : "constant.language.mlir" + "identifier":{ + "match":"[\\%#@][\\w_][\\w\\d_.$]*", + "captures":{ + "0":{ + "name":"variable.mlir" } }, - "name" : "constant.language.mlir" + "name":"meta.identifier.mlir" }, - "string" : { - "end" : "\"", - "begin" : "\"", - "beginCaptures" : { - "0" : { - "name" : "punctuation.definition.string.begin.mlir" - } - }, - "patterns" : [ - { - "match" : "\\\\[nt\"]", - "name" : "constant.character.escape.mlir" - }, - { - "match" : "\\\\.", - "name" : "invalid.illegal.mlir" - } - ], - "endCaptures" : { - "0" : { - "name" : "punctuation.definition.string.end.mlir" + "integer":{ + "match":"[\\Wx]([0-9]+)", + "captures":{ + "1":{ + "name":"constant.numeric.mlir" } }, - "name" : "string.quoted.double.mlir" + "name":"meta.identifier.mlir" }, - "terminator" : { - "end" : "\\n", - "begin" : "(br|cond_br|return)", - "beginCaptures" : { - "1" : { - "name" : "keyword.control.mlir" + "string":{ + "end":"\"", + "begin":"\"", + "beginCaptures":{ + "0":{ + "name":"punctuation.definition.string.begin.mlir" } }, - "patterns" : [ - { - "include" : "#comment" - }, - { - "include" : "#branch_target" - }, - { - "include" : "#identifier" - }, - { - "include" : "#types" - }, - { - "include" : "#loc" - } - ] - }, - "region" : { - "end" : "(?=})", - "begin" : "{", - "patterns" : [ - { - "include" : "#branch_target" - }, - { - "include" : "#op" - }, - { - "include" : "#attributes" - }, - { - "include" : "#comment" - }, - { - "include" : "#string" - } - ], - "name" : "meta.region.mlir" - }, - "constant" : { - "patterns" : [ - { - "include" : "#bool_constant" - }, - { - "include" : "#integer" - }, - { - "include" : "#string" - } - ], - "name" : "constants.other.mlir" - }, - "loc_fusedloc" : { - "end" : "\\]", - "begin" : "(fused)(<.*>)?\\[", - "beginCaptures" : { - "1" : { - "name" : "keyword.loc.mlir" - }, - "2" : { - "patterns" : [ - { - "include" : "#string" - } - ] - } - }, - "patterns" : [ - { - "include" : "#string" - } - ], - "name" : "meta.location.mlir" - }, - "branch_target" : { - "end" : "[:,\\n]", - "begin" : "(\\^bb[\\w\\d_$\\.-]+)", - "beginCaptures" : { - "1" : { - "name" : "entity.name.label.mlir" - } - }, - "patterns" : [ - { - "include" : "#branch_target_region" - }, - { - "include" : "#comment" - } - ], - "name" : "meta.branch_target.mlir" - }, - "types" : { - "patterns" : [ - { - "include" : "#container" - }, + "patterns":[ { - "include" : "#shaped_container" + "match":"\\\\[nt\"]", + "name":"constant.character.escape.mlir" }, { - "include" : "#standard_simple_types" + "match":"\\\\.", + "name":"invalid.illegal.mlir" } ], - "name" : "meta.types.mlir" - }, - "attribute_keywords" : { - "match" : "\\b(dense|none|opaque|sparse)\\b", - "captures" : { - "1" : { - "name" : "keyword.attributes.mlir" - } - } - }, - "identifier" : { - "match" : "[\\%#][a-zA-Z0-9][\\w\\d_]*", - "captures" : { - "0" : { - "name" : "variable.mlir" + "endCaptures":{ + "0":{ + "name":"punctuation.definition.string.end.mlir" } }, - "name" : "meta.identifier.mlir" + "name":"string.quoted.double.mlir" }, - "shaped_container" : { - "end" : ">", - "begin" : "(memref|tensor|vector)<", - "beginCaptures" : { - "1" : { - "name" : "keyword.shaped_container.mlir" + "types":{ + "match":"[\\Wx](index|i[1-9][0-9]*|f16|bf16|f32|f64|memref|tensor|vector)\\b", + "captures":{ + "1":{ + "name":"storage.type.mlir" } }, - "patterns" : [ - { - "include" : "#types" - } - ], - "name" : "meta.types.standard.shaped_container.mlir" - }, - "standard_simple_types" : { - "match" : "\\b(index|i[1-9]\\d*|f16|bf16|f32|f64)\\b", - "captures" : { - "1" : { - "name" : "keyword.types.standard.simple.mlir" - } - }, - "name" : "meta.types.standard.simple.mlir" + "name":"meta.types.simple.mlir" + } + }, + "patterns":[ + { + "include":"#comment" }, - "function_attributes" : { - "end" : "}", - "begin" : "(attributes)\\s*{", - "beginCaptures" : { - "1" : { - "name" : "keyword.attributes.mlir" - } - }, - "patterns" : [ - { - "include" : "#constant" - } - ], - "name" : "meta.attributes.function.mlir" + { + "include":"#string" }, - "op_generic" : { - "end" : "\\n", - "begin" : "((%[\\w\\d_]*)\\s*)=\\s*(?=\")", - "beginCaptures" : { - "2" : { - "name" : "variable.mlir" - } - }, - "patterns" : [ - { - "include" : "#comment" - }, - { - "include" : "#attributes" - }, - { - "include" : "#identifier" - }, - { - "include" : "#loc" - }, - { - "include" : "#string" + { + "match":"\\b(func)\\b\\s*(@[\\w_][\\w\\d_.$]*)", + "captures":{ + "1":{ + "name":"keyword.function.mlir" }, - { - "include" : "#types" + "2":{ + "name":"entity.name.function.mlir" } - ], - "name" : "meta.op.generic.mlir" - }, - "function_results" : { - "end" : "\\)", - "begin" : "->\\s*\\(", - "patterns" : [ - { - "include" : "#types" - } - ], - "name" : "meta.function.results.mlir" + }, + "name":"support.function.mlir" }, - "branch_target_region" : { - "end" : "\\)", - "begin" : "\\(", - "patterns" : [ - { - "include" : "#identifier" - }, - { - "include" : "#types" - } - ], - "name" : "meta.branch_target.mlir" + { + "match":"\\b(attributes|br|call|constant|loc|return)\\b", + "name":"keyword.module.mlir" }, - "comment" : { - "match" : "\/\/.*$", - "name" : "comment.line.double-slash.mlir" + { + "include":"#identifier" }, - "attributes" : { - "end" : "}", - "begin" : "{", - "patterns" : [ - { - "include" : "#attribute_keywords" - }, - { - "include" : "#constant" - } - ], - "name" : "meta.attributes.mlir" + { + "include":"#branch_target" }, - "function_params" : { - "end" : "\\)", - "begin" : "\\(", - "patterns" : [ - { - "include" : "#identifier" - }, - { - "include" : "#types" - } - ] - } - }, - "patterns" : [ { - "match" : "\\b(module)\\b", - "name" : "keyword.module.mlir" + "include":"#attribute" }, { - "end" : "}", - "begin" : "\\b(func)\\b\\s*(@[a-zA-Z_][a-zA-Z_0-9\\.]*)", - "beginCaptures" : { - "1" : { - "name" : "keyword.function.mlir" - }, - "2" : { - "name" : "entity.name.function.mlir" - } - }, - "patterns" : [ - { - "include" : "#function_params" - }, - { - "include" : "#function_attributes" - }, - { - "include" : "#function_results" - }, - { - "include" : "#region" - } - ], - "name" : "support.function.mlir" + "include":"#types" }, { - "include" : "#comment", - "name" : "comment.line.double-slash.mlir" + "include":"#integer" } ], - "name" : "MLIR", - "scopeName" : "source.mlir" + "name":"MLIR", + "scopeName":"source.mlir" } + -- 2.7.4