@kipper/target-js
Table of contents
Classes
- JavaScriptTargetBuiltInGenerator
- JavaScriptTargetCodeGenerator
- JavaScriptTargetSemanticAnalyser
- KipperJavaScriptTarget
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:123
author
• Const
author: "Luna Klatzer"
Defined in
kipper/target-js/src/index.ts:18
github
• Const
github: "https://github.com/Kipper-Lang/Kipper"
Defined in
kipper/target-js/src/index.ts:22
license
• Const
license: "GPL-3.0-or-later"
Defined in
kipper/target-js/src/index.ts:20
name
• Const
name: "\@kipper/target-js"
Defined in
kipper/target-js/src/index.ts:14
version
• Const
version: "0.11.0"
Defined in
kipper/target-js/src/index.ts:16
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:48
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