View raw

1 { 2 "name": "opam", 3 "scopeName": "source.ocaml.opam", 4 "fileTypes": [ 5 "opam" 6 ], 7 "patterns": [ 8 { 9 "include": "#comments" 10 }, 11 { 12 "include": "#fields" 13 }, 14 { 15 "include": "#values" 16 } 17 ], 18 "repository": { 19 "comments": { 20 "patterns": [ 21 { 22 "comment": "block comment", 23 "name": "comment.block.opam", 24 "begin": "\\(\\*", 25 "end": "\\*\\)" 26 }, 27 { 28 "comment": "line comment", 29 "name": "comment.line.opam", 30 "begin": "#", 31 "end": "$" 32 } 33 ] 34 }, 35 "fields": { 36 "comment": "labeled field", 37 "match": "^([[:word:]-]*[[:alpha:]][[:word:]-]*)(:)", 38 "captures": { 39 "1": { 40 "name": "entity.name.tag.opam" 41 }, 42 "2": { 43 "name": "keyword.operator.opam" 44 } 45 } 46 }, 47 "values": { 48 "patterns": [ 49 { 50 "comment": "boolean literal", 51 "name": "constant.language.opam", 52 "match": "\\b(true|false)\\b" 53 }, 54 { 55 "comment": "integer literal", 56 "name": "constant.numeric.decimal.opam", 57 "match": "(\\b|\\-?)[[:digit:]]+\\b" 58 }, 59 { 60 "comment": "double-quote string literal", 61 "name": "string.quoted.double.opam", 62 "begin": "\"", 63 "end": "\"", 64 "patterns": [ 65 { 66 "include": "#string-elements" 67 } 68 ] 69 }, 70 { 71 "comment": "triple-double-quote string literal", 72 "name": "string.quoted.triple-double.opam", 73 "begin": "\"\"\"", 74 "end": "\"\"\"", 75 "patterns": [ 76 { 77 "include": "#string-elements" 78 } 79 ] 80 }, 81 { 82 "comment": "operator", 83 "name": "keyword.operator.opam", 84 "match": "[!=<>\\|&?:]+" 85 }, 86 { 87 "comment": "identifier", 88 "match": "\\b([[:word:]+-]+)\\b", 89 "name": "variable.parameter.opam" 90 } 91 ] 92 }, 93 "string-elements": { 94 "patterns": [ 95 { 96 "comment": "escaped backslash", 97 "name": "constant.character.escape.opam", 98 "match": "\\\\\\\\" 99 }, 100 { 101 "comment": "escaped quote or whitespace", 102 "name": "constant.character.escape.opam", 103 "match": "\\\\[\"ntbr\\n]" 104 }, 105 { 106 "comment": "character from decimal ASCII code", 107 "name": "constant.character.escape.opam", 108 "match": "\\\\[[:digit:]]{3}" 109 }, 110 { 111 "comment": "character from hexadecimal ASCII code", 112 "name": "constant.character.escape.opam", 113 "match": "\\\\x[[:xdigit:]]{2}" 114 }, 115 { 116 "comment": "variable interpolation", 117 "name": "constant.variable.opam", 118 "begin": "%\\{", 119 "end": "}\\%" 120 }, 121 { 122 "comment": "unknown escape sequence", 123 "name": "invalid.illegal.unknown-escape.opam", 124 "match": "\\\\." 125 } 126 ] 127 } 128 } 129 }