mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-13 06:51:34 +00:00
Set up documentation generation
This commit is contained in:
@ -3,7 +3,10 @@ var fs = require("fs");
|
||||
var messages = require(__dirname + "/../src/diagnosticMessages.json");
|
||||
|
||||
var sb = [
|
||||
"// code below is generated from diagnosticsMessages.json by scripts/build-diagnostics\n",
|
||||
"/**\n",
|
||||
" * Generated from diagnosticsMessages.json. Do not edit.\n",
|
||||
" * @module diagnostics\n",
|
||||
" *//***/\n\n",
|
||||
"/* tslint:disable:max-line-length */\n\n"
|
||||
];
|
||||
|
||||
@ -11,6 +14,7 @@ function makeKey(text) {
|
||||
return text.replace(/[^\w]+/g, "_").replace(/_+$/, "");
|
||||
}
|
||||
|
||||
sb.push("/** Enum of available diagnostic codes. */\n");
|
||||
sb.push("export enum DiagnosticCode {\n");
|
||||
|
||||
var first = true;
|
||||
@ -24,7 +28,9 @@ Object.keys(messages).forEach(text => {
|
||||
sb.push(" " + key + " = " + messages[text]);
|
||||
});
|
||||
|
||||
sb.push("\n}\n\nexport function diagnosticCodeToString(code: DiagnosticCode): string {\n switch (code) {\n");
|
||||
sb.push("\n}\n\n");
|
||||
sb.push("/** Translates a diagnostic code to its respective string. */\n");
|
||||
sb.push("export function diagnosticCodeToString(code: DiagnosticCode): string {\n switch (code) {\n");
|
||||
|
||||
Object.keys(messages).forEach(text => {
|
||||
sb.push(" case " + messages[text] + ": return " + JSON.stringify(text) + ";\n");
|
||||
|
Reference in New Issue
Block a user