diff options
Diffstat (limited to '')
| -rwxr-xr-x | doc/docs/doc/README.md | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/doc/docs/doc/README.md b/doc/docs/doc/README.md index 07e35e7..11c9427 100755 --- a/doc/docs/doc/README.md +++ b/doc/docs/doc/README.md | |||
| @@ -4729,7 +4729,7 @@ Converts the code to the AST. | |||
| 4729 | 4729 | ||
| 4730 | **Signature:** | 4730 | **Signature:** |
| 4731 | ```lua | 4731 | ```lua |
| 4732 | to_ast: function(code: string, flattenLevel?: number, astName?: string): | 4732 | to_ast: function(code: string, flattenLevel?: number, astName?: string, reserveComment?: boolean): |
| 4733 | --[[AST]] AST | nil, | 4733 | --[[AST]] AST | nil, |
| 4734 | --[[error]] nil | string | 4734 | --[[error]] nil | string |
| 4735 | ``` | 4735 | ``` |
| @@ -4741,6 +4741,7 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string): | |||
| 4741 | | code | string | The code. | | 4741 | | code | string | The code. | |
| 4742 | | flattenLevel | integer | [Optional] The flatten level. Higher level means more flattening. Default is 0. Maximum is 2. | | 4742 | | flattenLevel | integer | [Optional] The flatten level. Higher level means more flattening. Default is 0. Maximum is 2. | |
| 4743 | | astName | string | [Optional] The AST name. Default is "File". | | 4743 | | astName | string | [Optional] The AST name. Default is "File". | |
| 4744 | | reserveComment | boolean | [Optional] Whether to reserve the original comments. Default is false. | | ||
| 4744 | 4745 | ||
| 4745 | **Returns:** | 4746 | **Returns:** |
| 4746 | 4747 | ||
| @@ -4749,6 +4750,33 @@ to_ast: function(code: string, flattenLevel?: number, astName?: string): | |||
| 4749 | | AST \| nil | The AST, or nil if the conversion failed. | | 4750 | | AST \| nil | The AST, or nil if the conversion failed. | |
| 4750 | | string \| nil | The error message, or nil if the conversion succeeded. | | 4751 | | string \| nil | The error message, or nil if the conversion succeeded. | |
| 4751 | 4752 | ||
| 4753 | #### format | ||
| 4754 | |||
| 4755 | **Type:** Function. | ||
| 4756 | |||
| 4757 | **Description:** | ||
| 4758 | |||
| 4759 | Formats the YueScript code. | ||
| 4760 | |||
| 4761 | **Signature:** | ||
| 4762 | ```lua | ||
| 4763 | format: function(code: string, tabSize?: number, reserveComment?: boolean): string | ||
| 4764 | ``` | ||
| 4765 | |||
| 4766 | **Parameters:** | ||
| 4767 | |||
| 4768 | | Parameter | Type | Description | | ||
| 4769 | | --- | --- | --- | | ||
| 4770 | | code | string | The code. | | ||
| 4771 | | tabSize | integer | [Optional] The tab size. Default is 4. | | ||
| 4772 | | reserveComment | boolean | [Optional] Whether to reserve the original comments. Default is true. | | ||
| 4773 | |||
| 4774 | **Returns:** | ||
| 4775 | |||
| 4776 | | Return Type | Description | | ||
| 4777 | | --- | --- | | ||
| 4778 | | string | The formatted code. | | ||
| 4779 | |||
| 4752 | #### __call | 4780 | #### __call |
| 4753 | 4781 | ||
| 4754 | **Type:** Metamethod. | 4782 | **Type:** Metamethod. |
| @@ -4820,6 +4848,19 @@ Whether the compiler should reserve the original line number in the compiled cod | |||
| 4820 | reserve_line_number: boolean | 4848 | reserve_line_number: boolean |
| 4821 | ``` | 4849 | ``` |
| 4822 | 4850 | ||
| 4851 | #### reserve_comment | ||
| 4852 | |||
| 4853 | **Type:** Field. | ||
| 4854 | |||
| 4855 | **Description:** | ||
| 4856 | |||
| 4857 | Whether the compiler should reserve the original comments in the compiled code. | ||
| 4858 | |||
| 4859 | **Signature:** | ||
| 4860 | ```lua | ||
| 4861 | reserve_comment: boolean | ||
| 4862 | ``` | ||
| 4863 | |||
| 4823 | #### space_over_tab | 4864 | #### space_over_tab |
| 4824 | 4865 | ||
| 4825 | **Type:** Field. | 4866 | **Type:** Field. |
