Class: Interpreter
The TagScript interpreter.
Constructors
new Interpreter()
new Interpreter(...
parsers
):Interpreter
Parameters
• ...parsers: IParser
[]
Returns
Source
lib/Interpreter/Interpreter.ts:47
Properties
parsers
protected
parsers:IParser
[]
Source
lib/Interpreter/Interpreter.ts:45
Methods
addParsers()
addParsers(...
parsers
):void
Add more parsers
Parameters
• ...parsers: IParser
[]
The parsers to add.
Returns
void
Source
lib/Interpreter/Interpreter.ts:56
checkWorkload()
private
checkWorkload(charLimit
,totalWork
,output
):undefined
|number
Parameters
• charLimit: null
| number
• totalWork: number
• output: string
Returns
undefined
| number
Source
lib/Interpreter/Interpreter.ts:117
getAcceptors()
protected
getAcceptors(ctx
):Promise ↗️
(opens in a new tab)<IParser
[]>
Parameters
• ctx: Context
Returns
Promise ↗️
(opens in a new tab)<IParser
[]>
Source
lib/Interpreter/Interpreter.ts:94
getContext()
private
getContext(node
,final
,response
,originalMessage
,tagLimit
,parenType
):Context
Parameters
• node: Node
• final: string
• response: Response
• originalMessage: string
• tagLimit: number
• parenType: ParenType
= ParenType.Both
Returns
Source
lib/Interpreter/Interpreter.ts:98
processTags()
private
processTags(ctx
,node
):Promise ↗️
(opens in a new tab)<null
|string
>
Parameters
• ctx: Context
• node: Node
Returns
Promise ↗️
(opens in a new tab)<null
| string
>
Source
lib/Interpreter/Interpreter.ts:104
run()
run(
message
,seedVariables
,charLimit
,tagLimit
,parenType
,keyValues
):Promise ↗️
(opens in a new tab)<Response
>
Processes a given TagScript string.
Parameters
• message: string
The TagScript string that to be processed.
• seedVariables= {}
A object containing strings to transformer to provide context variables for processing.
• charLimit: null
| number
= null
The maximum characters to process.
• tagLimit: number
= 2_000
The maximum tags to process.
• parenType: ParenType
= ParenType.Both
Whether the parameter should be followed after a "." or use parenthesis or both.
• keyValues: IKeyValues
= {}
Additional key value pairs that may be used by parsers during parsing.
Returns
Promise ↗️
(opens in a new tab)<Response
>
- Response class containing the raw string, processed body, actions and variables.
Source
lib/Interpreter/Interpreter.ts:80
setParsers()
setParsers(...
parsers
):void
Set new parsers
Parameters
• ...parsers: IParser
[]
The parsers to set.
Returns
void
Source
lib/Interpreter/Interpreter.ts:65
solve()
private
solve(message
,nodeOrderedList
,response
,charLimit
,tagLimit
,parenType
):Promise ↗️
(opens in a new tab)<string
>
Parameters
• message: string
• nodeOrderedList: Node
[]
• response: Response
• charLimit: null
| number
• tagLimit: number
= 2_000
• parenType: ParenType
= ParenType.Both
Returns
Promise ↗️
(opens in a new tab)<string
>
Source
lib/Interpreter/Interpreter.ts:150
textDeform()
private
textDeform(start
,end
,final
,output
): [string
,number
]
Parameters
• start: number
• end: number
• final: string
• output: string
Returns
[string
, number
]
Source
lib/Interpreter/Interpreter.ts:127
translateNodes()
private
translateNodes(nodeOrderedList
,index
,start
,differential
):void
Parameters
• nodeOrderedList: Node
[]
• index: number
• start: number
• differential: number
Returns
void
Source
lib/Interpreter/Interpreter.ts:135