Namespace: utils
Table of contents
Functions
- getConversionFunctionIdentifier
- getNaturalOrZero
- getParseRuleSource
- getParseTreeSource
- getTokenIntervalSource
- getTokenSource
- titleCase
Functions
getConversionFunctionIdentifier
▸ getConversionFunctionIdentifier(originalType
, destType
): string
Generates for the specific types the corresponding conversion function identifier that should be implemented by the KipperTargetBuiltInGenerator.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
originalType |
string |
The original type. |
destType |
string |
The type to convert to. |
Returns
string
Defined in
kipper/core/src/utils.ts:88
getNaturalOrZero
▸ getNaturalOrZero(num
): number
Returns num unchanged if its positive, otherwise if its negative it will return 0.
Since
0.4.0
Parameters
Name | Type |
---|---|
num |
number |
Returns
number
Defined in
kipper/core/src/utils.ts:67
getParseRuleSource
▸ getParseRuleSource(antlrCtx
): string
Returns the token source for the passed antlrCtx instance.
Since
0.4.0
Parameters
Name | Type | Description |
---|---|---|
antlrCtx |
KipperParserRuleContext |
The token antlr4 context. |
Returns
string
Defined in
kipper/core/src/utils.ts:16
getParseTreeSource
▸ getParseTreeSource(inputStream
, parseTree
): any
Get the source code for a parse tree.
Since
0.6.0
Parameters
Name | Type | Description |
---|---|---|
inputStream |
CharStream |
The input stream to fetch from. |
parseTree |
ParseTree |
The parse tree. |
Returns
any
Defined in
kipper/core/src/utils.ts:59
getTokenIntervalSource
▸ getTokenIntervalSource(inputStream
, start
, stop
): string
Get the source code for two tokens (interval between these two tokens).
Since
0.6.0
Parameters
Name | Type | Description |
---|---|---|
inputStream |
CharStream |
The input stream to fetch from. |
start |
Token |
The start token |
stop |
Token |
The stop token |
Returns
string
Defined in
kipper/core/src/utils.ts:39
getTokenSource
▸ getTokenSource(inputStream
, token
): any
Get the source code for a single token.
Since
0.6.0
Parameters
Name | Type | Description |
---|---|---|
inputStream |
CharStream |
The input stream to fetch from. |
token |
Token |
The token to get the source code from. |
Returns
any
Defined in
kipper/core/src/utils.ts:49
titleCase
▸ titleCase(str
): string
Apply title-case formatting on the specific string e.g. the first character of a word/char sequence must always be uppercase.
Since
0.8.0
Parameters
Name | Type | Description |
---|---|---|
str |
string |
The string to modify. |
Returns
string
Defined in
kipper/core/src/utils.ts:77