scripts and highlighters fixes/extensions
[sxed.git] / config / sex / outparsers / urasm.sex
blob20b83a9947444c85f164f0eb230027cdb0216805
1 /*
2  * SXED -- sexy text editor engine, 2022
3  *
4  * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
5  * Understanding is not required. Only obedience.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, version 3 of the License ONLY.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 // return `nil`, or hash:
20 //   string filename
21 //   int line
22 //   int col (optional)
23 //   string type
24 // type is:
25 //   "error", "warning", "note"
26 // if hash doesn't have any non-optional field (or it has invalid type),
27 // it won't be used at all
29 //  FATAL at file ./xte_src/xte_sprite_list.zas, line 923
30 //  at file ./xte_src/xte_sprite_list.zas, line 923
32 register_comp_parser(func (frm, lidx) {
33   var ln = frm[lidx:lidx]; // with EOL
35   //UFO ERROR at file ././xte_src/xte_def_options.zas, line 245: ASSEMBLER: unbalanced stack
36   var mt = ln.match("^UFO ERROR at file ([^,]+), line (%d+):");
37   if (mt) {
38     return {
39       filename: mt[0],
40       line: int(mt[1]),
41       col: 0,
42       type: "error",
43     };
44   }
46   /*
47   //if (ln.indexof(", line ") <= 0) return nil;
49   mt = ln.match("^FATAL at file ([^,]+), line (%d+)");
50   if (mt) {
51     return {
52       filename: mt[0],
53       line: int(mt[1]),
54       col: 0,
55       type: "error",
56     };
57   }
59   mt = ln.match("^ERROR at file ([^,]+), line (%d+)");
60   if (mt) {
61     return {
62       filename: mt[0],
63       line: int(mt[1]),
64       col: 0,
65       type: "error",
66     };
67   }
69   mt = ln.match("^%s*at file ([^,]+), line (%d+)");
70   if (mt) {
71     return {
72       filename: mt[0],
73       line: int(mt[1]),
74       col: 0,
75       type: "error",
76     };
77   }
78   */
80   return nil;
81 }, "urasm");