blob: 816747ad94f611bfab48563a86eab2ccdba84583 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
const MintParser = require('./base');
module.exports = class MintParserModules extends MintParser {
parse(file) {
let m;
let regex = /@(.*);/gm;
while ((m = regex.exec(file)) !== null) {
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
m.forEach((match, groupIndex) => {
if (groupIndex === 1) {
if (match.startsWith("mint.lang")) {
let name = match.trim().substr(10);
constructed += "const " + name + " = require(\"../_mint/internal/" + name + "\");\n";
}
}
});
}
return file.replace(/@(.*);/gm, "");
}
}
|