Parse event files that are generated by IBM i compilers
npm install @ibm/ibmi-eventf-parser``bash`
npm i @ibm/ibmi-eventf-parser
---
FileReader is an implementation of ISequentialFileReader. You can find it in the vitest directory in case you also want to read a local EVFEVENT file.
`typescript${TEST_DIR}/SQLRPGLE.PGM.evfevent
const parser = new Parser();
const markers: MarkerCreator = new MarkerCreator();
const fileReader = new FileReader();
parser.parse(fileReader, markers);
assert.ok(markers.equals(0, '/home/REINHARD/builds/hll/sqlrpgle.pgm.sqlrpgle', 328, 'Precompile option COMMIT changed by SET OPTION statement.'));
assert.ok(markers.equals(1, '/home/REINHARD/builds/hll/includes/familly.rpgleinc', 23, 'The Definition-Type entry is not valid; defaults to parameter definition.'));
assert.ok(markers.equals(60, '/home/REINHARD/builds/hll/sqlrpgle.pgm.sqlrpgle', 0, 'Compilation stopped. Severity 30 errors found in program.'));
`
---
interface and then pass an instance into the parse method on the Parser class.For every error logged in the eventf, the following callback function will be called:
`typescript
public createMarker(record: ErrorInformationRecord, fileLocation: string, isReadOnly: string) {
//...
}
`where the
ErrorInformationRecord has all the information about the error included the original line and column range in the original source that this error was encountered in. The value is that the parser is able to interpret all of the expansion events from precompilers and includes to determine accurate token locations in the origination source file whose path is provided in the fileLocation.All data is read using the
ISequentialFileReader on the general parser.parse(fileReader: ISequentialFileReader, markerCreator?: IMarkerCreator) method. The readNextLine() method can use sockets, read from an array, read a local file, or use any other arbitrary mechanism to get the contents of the eventf.`typescript
export interface ISequentialFileReader {
readNextLine(): string | undefined;
}
`For full access to every record that was parsed in the eventf, set an implementation of
IProcessor on the parser using the parser.setProcessor()` method.