diff --git a/THIRD-PARTY-LICENSES.md b/THIRD-PARTY-LICENSES.md index d10d08be2..8a0d4a062 100644 --- a/THIRD-PARTY-LICENSES.md +++ b/THIRD-PARTY-LICENSES.md @@ -120,9 +120,23 @@ The project uses the following third-party libraries or assets - **License**: MIT License - **License Link**: https://github.com/shentao/vue-multiselect/blob/master/LICENSE +### OCamllex + +- **Source**: https://github.com/textmate/ocaml.tmbundle/blob/master/Syntaxes/OCamllex.tmLanguage +- **Commit**: 1eff26848b39368414cb4214183a2cba22f12d0e +- **License**: Permission to copy, use, modify, sell and distribute this software is granted. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose. +- **License Link**: https://github.com/textmate/ocaml.tmbundle/tree/master#license + +### OCamlyacc + +- **Source**: https://github.com/textmate/ocaml.tmbundle/blob/master/Syntaxes/OCamlyacc.tmLanguage +- **Commit**: 08a892aef6a4b285b1902d9ed1427653fce53e31 +- **License**: Permission to copy, use, modify, sell and distribute this software is granted. This software is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose. +- **License Link**: https://github.com/textmate/ocaml.tmbundle/tree/master#license + ### Erlang - **Source**: https://github.com/shentao/vue-multiselect/blob/master/docs/shiki/languages/erlang.tmLanguage.json - **Commit**: 8092917041f0ae02cbe4c6982deddc931c6adecd - **License**: MIT License -- **License Link**: https://github.com/shentao/vue-multiselect/blob/master/LICENSE \ No newline at end of file +- **License Link**: https://github.com/shentao/vue-multiselect/blob/master/LICENSE diff --git a/src/Models/TextMateHelper.cs b/src/Models/TextMateHelper.cs index 0dd3b5ac7..3d01d57cc 100644 --- a/src/Models/TextMateHelper.cs +++ b/src/Models/TextMateHelper.cs @@ -29,6 +29,8 @@ public static class GrammarUtility new ExtraGrammar("source.vue", [".vue"], "vue.json"), new ExtraGrammar("source.erlang", [".erl", ".escript", ".hrl"], "erlang.json"), new ExtraGrammar("source.ocaml", [".ml", ".mli"], "ocaml.json"), + new ExtraGrammar("source.ocamllex", [".mll"], "ocamllex.json"), + new ExtraGrammar("source.ocamlyacc", [".mly"], "ocamlyacc.json"), ]; private static readonly Dictionary s_cachedRawGrammars = new(); diff --git a/src/Resources/Grammars/ocaml.json b/src/Resources/Grammars/ocaml.json index 84d6f82f3..26674d6eb 100644 --- a/src/Resources/Grammars/ocaml.json +++ b/src/Resources/Grammars/ocaml.json @@ -729,7 +729,7 @@ "commentBlock": { "begin": "\\(\\*(?!\\*[^\\)])", "end": "\\*\\)", - "name": "comment constant.regexp meta.separator.markdown", + "name": "comment", "contentName": "emphasis", "patterns": [ { @@ -743,7 +743,7 @@ "commentDoc": { "begin": "\\(\\*\\*", "end": "\\*\\)", - "name": "comment constant.regexp meta.separator.markdown", + "name": "comment", "patterns": [ { "match": "\\*" @@ -2958,4 +2958,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/Resources/Grammars/ocamllex.json b/src/Resources/Grammars/ocamllex.json new file mode 100644 index 000000000..80795ad9e --- /dev/null +++ b/src/Resources/Grammars/ocamllex.json @@ -0,0 +1,302 @@ +{ + "name": "ocamllex", + "scopeName": "source.ocamllex", + "fileTypes": [ "mll" ], + "foldingStartMarker": "{", + "foldingStopMarker": "}", + "keyEquivalent": "^~O", + "patterns": [ + { + "begin": "^\\s*({)", + "beginCaptures": { + "1": { + "name": "punctuation.section.embedded.ocaml.begin.ocamllex" + } + }, + "end": "^\\s*(})", + "endCaptures": { + "1": { + "name": "punctuation.section.embedded.ocaml.end.ocamllex" + } + }, + "name": "meta.embedded.ocaml", + "patterns": [ + { + "include": "source.ocaml" + } + ] + }, + { + "begin": "\\b(let)\\s+([a-z][a-zA-Z0-9'_]*)\\s+=", + "beginCaptures": { + "1": { + "name": "keyword.other.pattern-definition.ocamllex" + }, + "2": { + "name": "entity.name.type.pattern.stupid-goddamn-hack.ocamllex" + } + }, + "end": "^(?:\\s*let)|(?:\\s*(rule|$))", + "name": "meta.pattern-definition.ocaml", + "patterns": [ + { + "include": "#match-patterns" + } + ] + }, + { + "begin": "(rule|and)\\s+([a-z][a-zA-Z0-9_]*)\\s+(=)\\s+(parse)(?=\\s*$)|((?", + "endCaptures": { + "0": { + "name": "punctuation.definition.type-declaration.end.ocamlyacc" + } + }, + "name": "meta.token.type-declaration.ocamlyacc", + "patterns": [ + { + "include": "source.ocaml" + } + ] + } + ] + } + } +}