lua-doc-extractor
Advanced tools
| { | ||
| "name": "lua-doc-extractor", | ||
| "version": "3.3.2", | ||
| "version": "3.3.3", | ||
| "description": "Extracts lua documentation from C-style comments", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
| import { LuaNamedType, LuaType } from "./luaType"; | ||
| export type Attribute = KnownAttribute | DefaultAttribute; | ||
| export type KnownAttribute = ClassAttribute | EnumAttribute | FieldAttribute | FunctionAttribute | GlobalAttribute | ParamAttribute | TableAttribute; | ||
| export type KnownAttribute = ClassAttribute | EnumAttribute | FieldAttribute | FunctionAttribute | GlobalAttribute | ParamAttribute | ReturnAttribute | TableAttribute; | ||
| interface BaseAttribute { | ||
@@ -52,2 +52,9 @@ attributeType: string; | ||
| } | ||
| export interface ReturnAttribute extends BaseAttribute { | ||
| attributeType: "return"; | ||
| args: { | ||
| type: LuaType; | ||
| description: string; | ||
| }; | ||
| } | ||
| export interface FieldAttribute extends BaseAttribute { | ||
@@ -54,0 +61,0 @@ attributeType: "field"; |
@@ -39,2 +39,6 @@ "use strict"; | ||
| } | ||
| case "return": { | ||
| const { type, description } = known.args; | ||
| return format(known.attributeType, (0, luaType_1.formatType)(type), description); | ||
| } | ||
| case "field": { | ||
@@ -41,0 +45,0 @@ const { name, type, description } = known.args; |
@@ -18,3 +18,3 @@ "use strict"; | ||
| comment: { | ||
| indent: /^\s+\*(?!\/)/, | ||
| indent: /^\s*\*(?!\/)/, | ||
| commentEnd: { match: /\*+\//, pop: 1 }, | ||
@@ -21,0 +21,0 @@ text: moo_1.default.fallback, |
@@ -40,2 +40,3 @@ "use strict"; | ||
| paramAttr: "@param", | ||
| returnAttr: "@return", | ||
| }), | ||
@@ -48,3 +49,3 @@ match: /@[^\s]+/, | ||
| newline: { match: /\r?\n/, lineBreaks: true }, | ||
| literal: /[-+]?[0-9]+|"[^"]*?"/, | ||
| literal: /[-+]?[0-9]+|"[^"]*?"|false|true|nil/, | ||
| // Matches all whitespace except linefeeds. | ||
@@ -51,0 +52,0 @@ // https://stackoverflow.com/a/3469155/317135 |
@@ -36,2 +36,4 @@ "use strict"; | ||
| }, | ||
| { "name": "attribute", "symbols": [(docLexer_1.docLexer.has("returnAttr") ? { type: "returnAttr" } : returnAttr), "__", "unionType", "unionDesc"], "postprocess": ([, , type, description]) => (0, attribute_1.createAttribute)("return", { type, description }) | ||
| }, | ||
| { "name": "attribute", "symbols": ["fieldAttr"], "postprocess": id }, | ||
@@ -38,0 +40,0 @@ { "name": "attribute", "symbols": [(docLexer_1.docLexer.has("attribute") ? { type: "attribute" } : attribute), "lines"], "postprocess": ([a, description]) => (0, attribute_1.createAttribute)(a.value, { description }) |
+1
-1
| { | ||
| "name": "lua-doc-extractor", | ||
| "version": "3.3.2", | ||
| "version": "3.3.3", | ||
| "description": "Extracts lua documentation from C-style comments", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
71303
1%1612
0.88%