@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:122
author
• Const
author: "Luna Klatzer"
Defined in
kipper/target-js/src/index.ts:18
github
• Const
github: "https://github.com/Luna-Klatzer/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.10.4"
Defined in
kipper/target-js/src/index.ts:16
Functions
createJSFunctionSignature
▸ createJSFunctionSignature(signature
): string
Generates the JavaScript function signature, based on the signature metadata.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
signature |
Object |
The function signature metadata. |
signature.identifier |
string |
- |
signature.params |
string [] |
- |
Returns
string
Defined in
kipper/target-js/src/tools.ts:44
genJSFunction
▸ genJSFunction(signature
, body
): TranslatedCodeLine
[]
Generates a JavaScript function from the given signature and body.
Since
0.10.0
Parameters
Name | Type | Description |
---|---|---|
signature |
Object |
The signature of the function. |
signature.identifier |
string |
- |
signature.params |
string [] |
- |
body |
string |
The body of the function. |
Returns
TranslatedCodeLine
[]
Defined in
kipper/target-js/src/built-in-generator.ts:17
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:40
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:55
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:67