Script Parser
The Script Parser enables you to write your own Parser using JavaScript.
To operate, a Script Parser must implement a few functions.
The functions do not use parameters.
Note: The script for the Script
Parser is running in a separate JavaScript Engine.
This means that the script cannot access any variables that are available,
or have been set, in the normal Hooks of an AssemblyLine.
Passing data between the hosting Connector
and the script is done by using predefined objects. One of these predefined
objects is the result object which is used to communicate status
information. Upon entry into either function, the status field is
set to normal which causes the hosting Parser to continue calls.
Signaling end-of-input or errors is done by setting the status and
message fields in this object. The entry object is populated
on calls to writeEntry and is expected to be populated in the readEntry function.
When reading entries you have the inp BufferedReader object
available for reading character data from a stream. When writing entries
you have the out BufferedWriter object available for writing
character data to a stream.You can add your own parameters to the configuration and obtain these by using the parser object.
Note: When you use a Script Connector or Parser, the script
is copied from the Library where it resides and into your configuration
file. This has the advantage that you can customize the script, but
with the disadvantage that new versions are not known to your AssemblyLine.
To work around this disadvantage, remove the old Script Parser from the AssemblyLine and re-introduce it.