@kipper/target-js
Table of contents
Classes
- JavaScriptTargetBuiltInGenerator
- JavaScriptTargetCodeGenerator
- JavaScriptTargetSemanticAnalyser
- KipperJavaScriptTarget
- RuntimeTypesGenerator
Variables
Functions
- createJSFunctionSignature
- genJSFunction
- genJSVariable
- getJSFunctionSignature
- indentLines
- removeBraces
Variables
TargetJS
• Const TargetJS: typeof KipperJavaScriptTarget = KipperJavaScriptTarget
The JavaScript translation target for the Kipper language.
Alias for KipperJavaScriptTarget.
Since
0.10.0
Defined in
kipper/target-js/src/target.ts:140
author
• Const author: "Luna Klatzer"
Defined in
kipper/target-js/src/index.ts:19
github
• Const github: "https://github.com/Kipper-Lang/Kipper"
Defined in
kipper/target-js/src/index.ts:23
license
• Const license: "GPL-3.0-or-later"
Defined in
kipper/target-js/src/index.ts:21
name
• Const name: "\@kipper/target-js"
Defined in
kipper/target-js/src/index.ts:15
version
• Const version: "0.12.1"
Defined in
kipper/target-js/src/index.ts:17
Functions
createJSFunctionSignature
▸ createJSFunctionSignature(signature, ignoreParams?): string
Generates the JavaScript function signature, based on the signature metadata.
Since
0.10.0
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
signature |
Object |
undefined |
The function signature metadata. |
signature.identifier |
string |
undefined |
- |
signature.params |
string[] |
undefined |
- |
ignoreParams |
boolean |
false |
Whether or not to ignore the parameters of the function. |
Returns
string
Defined in
kipper/target-js/src/tools.ts:45
genJSFunction
▸ genJSFunction(signature, body, ignoreParams?): TranslatedCodeLine[]
Generates a JavaScript function from the given signature and body.
Since
0.10.0
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
signature |
Object |
undefined |
The signature of the function. |
signature.identifier |
string |
undefined |
- |
signature.params |
string[] |
undefined |
- |
body |
string |
undefined |
The body of the function. |
ignoreParams |
boolean |
false |
Whether or not to ignore the parameters of the function. |
Returns
TranslatedCodeLine[]
Defined in
kipper/target-js/src/built-in-generator.ts:24
genJSVariable
▸ genJSVariable(varSpec, value): TranslatedCodeLine
Generates a JavaScript local or global variable from the given variable and value.
Parameters
| Name | Type | Description |
|---|---|---|
varSpec |
BuiltInVariable |
The variable to generate. |
value |
string |
The value of the variable. |
Returns
TranslatedCodeLine
Defined in
kipper/target-js/src/built-in-generator.ts:37
getJSFunctionSignature
▸ getJSFunctionSignature(funcSpec): Object
Generates the signature for the function based on the funcSpec, which can be used in an JavaScript env.
Since
0.10.0
Parameters
| Name | Type | Description |
|---|---|---|
funcSpec |
any |
The function spec object containing the metadata of the function. |
Returns
Object
| Name | Type |
|---|---|
identifier |
string |
params |
string[] |
Defined in
kipper/target-js/src/tools.ts:20
indentLines
▸ indentLines(arr, spaces?): TranslatedCodeLine[]
Indents the lines of the arr with the specified number of spaces.
Since
0.10.0
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
arr |
TranslatedCodeLine[] |
undefined |
The array of code lines. |
spaces |
number |
2 |
The number of spaces to add at the start of every line. |
Returns
TranslatedCodeLine[]
Defined in
kipper/target-js/src/tools.ts:59
removeBraces
▸ removeBraces(arr): TranslatedCodeLine[]
Removes the first braces around the given code lines that were generated by translating a CompoundStatement.
Since
0.10.0
Parameters
| Name | Type | Description |
|---|---|---|
arr |
TranslatedCodeLine[] |
The array of code lines that. |
Returns
TranslatedCodeLine[]
Defined in
kipper/target-js/src/tools.ts:71