|
3 | 3 | import * as Control_Applicative from "https://compile.purescript.org/output/Control.Applicative/index.js";
|
4 | 4 | import * as Control_Apply from "https://compile.purescript.org/output/Control.Apply/index.js";
|
5 | 5 | import * as Control_Bind from "https://compile.purescript.org/output/Control.Bind/index.js";
|
| 6 | +import * as Data_Boolean from "https://compile.purescript.org/output/Data.Boolean/index.js"; |
6 | 7 | import * as Data_Either from "https://compile.purescript.org/output/Data.Either/index.js";
|
7 | 8 | import * as Data_Functor from "https://compile.purescript.org/output/Data.Functor/index.js";
|
8 | 9 | import * as Data_Int from "https://compile.purescript.org/output/Data.Int/index.js";
|
9 | 10 | import * as Data_Maybe from "https://compile.purescript.org/output/Data.Maybe/index.js";
|
10 | 11 | import * as Data_Show from "https://compile.purescript.org/output/Data.Show/index.js";
|
| 12 | +import * as Data_String_Regex from "https://compile.purescript.org/output/Data.String.Regex/index.js"; |
| 13 | +import * as Data_String_Regex_Flags from "https://compile.purescript.org/output/Data.String.Regex.Flags/index.js"; |
| 14 | +import * as Data_String_Regex_Unsafe from "https://compile.purescript.org/output/Data.String.Regex.Unsafe/index.js"; |
11 | 15 | import * as Effect_Console from "https://compile.purescript.org/output/Effect.Console/index.js";
|
12 | 16 | import * as StringParser_CodePoints from "https://compile.purescript.org/output/StringParser.CodePoints/index.js";
|
13 | 17 | import * as StringParser_Parser from "https://compile.purescript.org/output/StringParser.Parser/index.js";
|
@@ -45,6 +49,15 @@ var logShow = /* #__PURE__ */ Effect_Console.logShow(/* #__PURE__ */ showRecord(
|
45 | 49 | return "pos";
|
46 | 50 | }
|
47 | 51 | })(Data_Show.showInt))(Data_Show.showString)));
|
| 52 | +var logShow1 = /* #__PURE__ */ Effect_Console.logShow(/* #__PURE__ */ Data_Maybe.showMaybe(/* #__PURE__ */ showRecord(/* #__PURE__ */ Data_Show.showRecordFieldsCons({ |
| 53 | + reflectSymbol: function () { |
| 54 | + return "origin"; |
| 55 | + } |
| 56 | +})(/* #__PURE__ */ Data_Show.showRecordFieldsConsNil({ |
| 57 | + reflectSymbol: function () { |
| 58 | + return "type"; |
| 59 | + } |
| 60 | +})(Data_Show.showString))(Data_Show.showString)))); |
48 | 61 |
|
49 | 62 | // Parse a line of NuttX Stack Dump.
|
50 | 63 | // Given this line of NuttX Stack Dump: `stack_dump: 0xc02027e0: c0202010 00000000 00000001 00000000 00000000 00000000 8000ad8a 00000000`
|
@@ -113,11 +126,17 @@ var parseException = /* #__PURE__ */ discard1(/* #__PURE__ */ $$void(/* #__PURE_
|
113 | 126 | });
|
114 | 127 | });
|
115 | 128 | });
|
116 |
| -var identifyAddress = function (v) { |
117 |
| - return new Data_Maybe.Just({ |
118 |
| - mod: "aaaa", |
119 |
| - type: "bbbb" |
120 |
| - }); |
| 129 | +var identifyAddress = function (s) { |
| 130 | + if (Data_Maybe.isJust(Data_String_Regex.match(Data_String_Regex_Unsafe.unsafeRegex("a")(Data_String_Regex_Flags.noFlags))(s))) { |
| 131 | + return new Data_Maybe.Just({ |
| 132 | + origin: "a", |
| 133 | + type: "b" |
| 134 | + }); |
| 135 | + }; |
| 136 | + if (Data_Boolean.otherwise) { |
| 137 | + return Data_Maybe.Nothing.value; |
| 138 | + }; |
| 139 | + throw new Error("Failed pattern match at Main (line 42, column 1 - line 42, column 69): " + [ s.constructor.name ]); |
121 | 140 | };
|
122 | 141 |
|
123 | 142 | // Given this NuttX Exception: `riscv_exception: EXCEPTION: Instruction page fault. MCAUSE: 000000000000000c, EPC: 000000008000ad8a, MTVAL: 000000008000ad8a`
|
@@ -155,7 +174,7 @@ var doRunParser = function (dictShow) {
|
155 | 174 | if (v instanceof Data_Either.Right) {
|
156 | 175 | return Effect_Console.log("Result: " + show1(v.value0))();
|
157 | 176 | };
|
158 |
| - throw new Error("Failed pattern match at Main (line 188, column 3 - line 190, column 52): " + [ v.constructor.name ]); |
| 177 | + throw new Error("Failed pattern match at Main (line 198, column 3 - line 200, column 52): " + [ v.constructor.name ]); |
159 | 178 | })();
|
160 | 179 | return Effect_Console.log("-----")();
|
161 | 180 | };
|
@@ -218,11 +237,18 @@ var doRunParser2 = /* #__PURE__ */ doRunParser(/* #__PURE__ */ showRecord(/* #__
|
218 | 237 | }
|
219 | 238 | })(Data_Show.showString))(Data_Show.showString))(Data_Show.showString))(Data_Show.showString))(Data_Show.showString))(Data_Show.showString))(Data_Show.showString))(Data_Show.showString))(Data_Show.showString)));
|
220 | 239 |
|
| 240 | +// identifyAddress _ = Just |
| 241 | +// { |
| 242 | +// origin: "aaaa" |
| 243 | +// , type: "bbbb" |
| 244 | +// } |
221 | 245 | // Parse the NuttX Exception and NuttX Stack Dump. Explain the NuttX Exception.
|
222 | 246 | // `Effect` says that it will do Side Effects (printing to console)
|
223 | 247 | // `Unit` means that no value will be returned
|
224 | 248 | // The next line declares the Function Type. We can actually erase it, VSCode PureScript Extension will helpfully suggest it for us.
|
225 | 249 | var printResults = function __do() {
|
| 250 | + logShow1(identifyAddress("abc"))(); |
| 251 | + logShow1(identifyAddress("bc"))(); |
226 | 252 | Effect_Console.log(explainException(12)("epc")("mtval"))();
|
227 | 253 | Effect_Console.log(explainException(13)("epc")("mtval"))();
|
228 | 254 | Effect_Console.log(explainException(0)("epc")("mtval"))();
|
|
0 commit comments