From 6f6272bfe0ee91a7e62455fc9557f8d963385132 Mon Sep 17 00:00:00 2001
From: dixoxib <132107919+dixoxib@users.noreply.github.com>
Date: Sat, 13 May 2023 22:28:36 +0200
Subject: [PATCH 1/4] riscv.js adaption for CodeMirror5
---
riscv.js | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/riscv.js b/riscv.js
index ffbd2ad..37a610f 100644
--- a/riscv.js
+++ b/riscv.js
@@ -1,3 +1,13 @@
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
// prettier-ignore
const directives = [
// Architecture independent directives.
@@ -122,11 +132,9 @@ const extC = instructions([
"c.slli", "c.srai", "c.srli", "c.sub", "c.subw", "c.sw", "c.swsp", "c.xor",
]);
-export const defineMode = (CodeMirror) => {
+
CodeMirror.defineSimpleMode("riscv", {
- meta: {
- lineComment: "#",
- },
+
start: [
{ regex: /#.*/, token: "comment" },
@@ -157,7 +165,10 @@ export const defineMode = (CodeMirror) => {
{ regex: registers, token: "variable" },
{ regex: registerAbiNames, token: "variable-2" },
],
+ meta: {
+ lineComment: "#",
+ }
});
CodeMirror.defineMIME("text/x-riscv", "riscv");
-};
+});
From e1146173c669999647402012474f4599c126c51b Mon Sep 17 00:00:00 2001
From: dixoxib <132107919+dixoxib@users.noreply.github.com>
Date: Sat, 13 May 2023 22:39:12 +0200
Subject: [PATCH 2/4] index.html adapted for CodeMirror5
---
index.html | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/index.html b/index.html
index 9a6146c..82b92f9 100644
--- a/index.html
+++ b/index.html
@@ -6,6 +6,11 @@
+
+
+
+
+