From f71c75dd7182091075d9401f4f04635944811ece Mon Sep 17 00:00:00 2001 From: James McCrystal <30939190+jmccrystal@users.noreply.github.com> Date: Tue, 14 Jan 2025 03:07:47 -1000 Subject: [PATCH] add Mojo support (#1107) (#1185) * fix #1107 Adds support for Mojo language * add Mojo support with test (#1107) * add Mojo support with test (#1107) * add Mojo support with test (#1107) --- languages.json | 6 ++++++ tests/data/mojo.mojo | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/data/mojo.mojo diff --git a/languages.json b/languages.json index c37f1d2..13685b9 100644 --- a/languages.json +++ b/languages.json @@ -1107,6 +1107,12 @@ "extensions": ["def"], "line_comment": [";"] }, + "Mojo": { + "line_comment": ["#"], + "doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""], ["'''", "'''"]], + "quotes": [["\\\"", "\\\""], ["'", "'"]], + "extensions": ["mojo", "🔥"] + }, "MonkeyC": { "name": "Monkey C", "extensions": ["mc"], diff --git a/tests/data/mojo.mojo b/tests/data/mojo.mojo new file mode 100644 index 0000000..73ec04d --- /dev/null +++ b/tests/data/mojo.mojo @@ -0,0 +1,21 @@ +# 21 lines 15 code 3 comments 3 blanks + + +''' +This is a docstring. +# It has multiple lines. +This is the end of the docstring. +''' +def main(): + # Hello Mojo! + string = "Hello Mojo!" + # The following line prints the string "Hello Mojo!" + print(string) + + """ + This piece of code prints + the numbers "9", "6", and "3". + 'Here is a quote.' + """ + for x in range(9, 0, -3): + print(x)