@ibm/ibmi-eventf-parser 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{"use strict";var t={732(t,e){function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;e.default=function(t){!function(t){var e=s(t);if("string"!==e)throw new TypeError("Expected a string, got a ".concat(e))}(t);var e=t;if(0===e.length)return".";var i=47===e.charCodeAt(0),r=47===e.charCodeAt(e.length-1);return 0!==(e=function(t,e){for(var s,i="",r=0,n=-1,o=0,u=0;u<=t.length;++u){if(u<t.length)s=t.charCodeAt(u);else{if(47===s)break;s=47}if(47===s){if(n===u-1||1===o);else if(n!==u-1&&2===o){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var a=i.lastIndexOf("/");if(a!==i.length-1){-1===a?(i="",r=0):r=(i=i.slice(0,a)).length-1-i.lastIndexOf("/"),n=u,o=0;continue}}else if(2===i.length||1===i.length){i="",r=0,n=u,o=0;continue}e&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+t.slice(n+1,u):i=t.slice(n+1,u),r=u-n-1;n=u,o=0}else 46===s&&-1!==o?++o:o=-1}return i}(e=function(t){try{return decodeURIComponent(t)}catch(e){return t}}(e),!i)).length||i||(e="."),e.length>0&&r&&(e+="/"),i?"/"+e:e},t.exports=e.default},233(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.ExpansionProcessor=void 0;const i=s(187);e.ExpansionProcessor=class{constructor(){this.PRE_COMPILE_PROCESSOR_ID=999,this.postProcessingNeeded=!0,this._noProcessorEventsYet=!0,this._containsPreCompileProcessorBlocks=!1}processErrorRecord(t){this.currentProcessor.addErrorInformation(t)}processExpansionRecord(t){this.currentProcessor.setContainsExpansionEvents(!0),this.currentProcessor.getMappingTable().addExpansionRecord(t)}processFeedbackCodeRecord(t){}processFileEndRecord(t){try{this.currentProcessor.closeFile(t)}catch(t){throw this.postProcessingNeeded=!1,new Error(t.message?t.message:t)}}processFileIDRecord(t){try{const e=t.getSourceId();if(this.currentProcessor.isProcessorIDZero())1!==e||this.currentProcessor.getInputFile()||this.currentProcessor.setInputFile(t),this.currentProcessor.getMappingTable().addFileToFileTable(t);else{if(e>1){if(!this.currentProcessor.getOutputFile())return void this.currentProcessor.setOutputFile(t)}else 1!==e||this.currentProcessor.getInputFile()||this.currentProcessor.setInputFile(t);this.currentProcessor.addFile(t)}}catch(t){throw this.postProcessingNeeded=!1,new Error(t.message?t.message:t)}}processMapDefineRecord(t){}processMapEndRecord(t){}processMapStartRecord(t){}processProcessorRecord(t){this._containsPreCompileProcessorBlocks||t.getOutputId()!==this.PRE_COMPILE_PROCESSOR_ID||(this._containsPreCompileProcessorBlocks=!0);try{this.currentProcessor&&this.currentProcessor.processorEnded()}catch(t){throw this.postProcessingNeeded=!1,new Error(t.message?t.message:t)}const e=this.constructEventsFileProcessorBlock(t);this._noProcessorEventsYet&&(e.setFirstInEventsFile(!0),this._noProcessorEventsYet=!1),e.setPreviousProcessor(this.currentProcessor),this.currentProcessor=e}constructEventsFileProcessorBlock(t){return new i.ProcessorBlock(t)}processProgramRecord(t){}processTimestampRecord(t){this._noProcessorEventsYet=!0}doPreProcessing(){return!1}doPostProcessing(){return!(this.postProcessingNeeded&&this._containsPreCompileProcessorBlocks&&this.determineAndSetMappingSupport(this.currentProcessor)&&(this.currentProcessor.resolveFileNamesForAllErrors(),1))}determineAndSetMappingSupport(t){let e=!1,s=t;for(;s;){const t=this.isMappingSupportedByCurrentEventsFile(s);for(this.setMappingSupportForCurrentEventsFile(s,t),!e&&t&&(e=!0);s&&!s.getIsFirstInEventsFile();)s=s.getPreviousProcessorBlock();s&&(s=s.getPreviousProcessorBlock())}return e}setMappingSupportForCurrentEventsFile(t,e){let s=t;for(;s;)s.setMappingSupported(e),s=s.getIsFirstInEventsFile()?void 0:s.getPreviousProcessorBlock()}isMappingSupportedByCurrentEventsFile(t){let e;e=t.getOutputFile()?!!t.getContainsExpansionEvents()||0!==t.getTotalNumberOfLinesInOutputFile()&&t.getTotalNumberOfLinesInOutputFile()===t.getTotalNumberOfLinesInInputFiles():!(!t.getPreviousProcessorBlock()||t.getIsFirstInEventsFile());const s=t.getPreviousProcessorBlock();return s&&!t.getIsFirstInEventsFile()&&(e=e&&this.isMappingSupportedByCurrentEventsFile(s)),e}getAllErrors(){return this.currentProcessor?this.currentProcessor.getAllProcessorErrors():[]}getAllFileIDRecords(){return this.currentProcessor?this.currentProcessor.getMappingTable().getAllFileIDRecords():[]}}},548(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MapTable=void 0;class s{constructor(t){this.inputStartLine=0,this.inputEndLine=-1,this.outputStartLine=0,this.outputEndLine=-1,"number"==typeof t?this.inputFileID=t:(this.inputStartLine=t.getInputStartLine(),this.inputEndLine=t.getInputEndLine(),this.inputFileID=t.getInputFileID(),this.outputStartLine=t.getOutputStartLine(),this.outputEndLine=t.getOutputEndLine())}getInputEndLine(){return this.inputEndLine}setInputEndLine(t){this.inputEndLine=t}getInputFileID(){return this.inputFileID}setInputFileID(t){this.inputFileID=t}getInputStartLine(){return this.inputStartLine}setInputStartLine(t){this.inputStartLine=t}getOutputEndLine(){return this.outputEndLine}setOutputEndLine(t){this.outputEndLine=t}getOutputStartLine(){return this.outputStartLine}setOutputStartLine(t){this.outputStartLine=t}shiftOutputLines(t){this.outputStartLine+=t,this.outputEndLine>0&&(this.outputEndLine+=t)}containsOutputLine(t){return-1===this.outputEndLine?t>=this.outputStartLine:t>=this.outputStartLine&&t<=this.outputEndLine}containsInputLine(t,e){return-1===this.inputEndLine?t>=this.inputStartLine&&e===this.inputFileID:t>=this.inputStartLine&&t<=this.inputEndLine&&e===this.inputFileID}fixInputRangeBasedOnOutputRange(){this.inputEndLine=this.outputEndLine-this.outputStartLine+this.inputStartLine}fixOutputRangeBasedOnInputRange(){this.outputEndLine=this.inputEndLine-this.inputStartLine+this.outputStartLine}}class i{constructor(t){this.ID=t,this.lines=0}getID(){return this.ID}getLinesProcessed(){return this.lines}increaseLinesProcessed(t){this.lines+=t}}e.MapTable=class{constructor(){this.map=[],this.queueExpansion=[],this.files=new r,this.lookupIndex=0,this.fileTable=new Map}addFileInformation(t){const e=this.createOpenEndedSourceLineRange(t),s=new i(t.getSourceId());if(!this.files.isEmpty()){const t=this.files.peek(),s=this.map[this.map.length-1];s.getOutputStartLine()===e.getOutputStartLine()?this.map.pop():(s.setOutputEndLine(e.getOutputStartLine()-1),s.setInputEndLine(s.getOutputEndLine()-s.getOutputStartLine()+s.getInputStartLine()),t?.increaseLinesProcessed(s.getInputEndLine()-s.getInputStartLine()+1))}this.map.push(e),this.files.push(s),this.fileTable.set(t.getSourceId(),t)}addFileToFileTable(t){this.fileTable.set(t.getSourceId(),t)}closeFile(t){if(this.files.isEmpty())throw new Error(`A FILEEND event does not have a matching FILEID.\nFaulty event: ${t.toString()}`);const e=this.files.pop();if(e?.getID()!==t.getFileId())throw new Error(`The ID field of the FILEEND event does not match the ID field of the last FILEID event.\nMismatched IDs: \t FILEID: ${e?.getID()}\t FILEEND: ${t.toString()}`);const i=this.map[this.map.length-1];if(i.getInputFileID()!==t.getFileId())throw new Error(`The ID field of the FILEEND event does not match the ID field of the last SourceLineRange.\nMismatched IDs: \t FILEID: ${i.getInputFileID()}\t FILEEND: ${t.toString()}`);let r=0;try{r=t.getExpansion()}catch(e){throw new Error(`Unable to parse the expansion field of the FILEEND record to an integer\nFaulty record: ${t.toString()}`)}if(0!==r){if(i.setInputEndLine(i.getInputStartLine()+r-e.getLinesProcessed()-1),i.setOutputEndLine(i.getOutputStartLine()+r-e.getLinesProcessed()-1),this.files.isEmpty())return;const t=this.files.peek(),n=new s(t.getID());n.setInputStartLine(t.getLinesProcessed()+1),n.setOutputStartLine(i.getOutputEndLine()+1),this.map.push(n)}else{if(i.setInputEndLine(i.getInputStartLine()),i.setOutputStartLine(i.getOutputStartLine()-1),i.setOutputEndLine(i.getOutputStartLine()),this.files.isEmpty())return;const t=this.files.peek(),e=new s(t.getID());e.setInputStartLine(t.getLinesProcessed()+1),e.setOutputStartLine(i.getOutputStartLine()+1),this.map.push(e)}}createOpenEndedSourceLineRange(t){let e=1;try{e=t.getLine()}catch(e){throw new Error(`Unable to parse the line field of the FILEID record to an integer\nFaulty record: ${t.toString()}`)}const i=new s(t.getSourceId());if(i.setInputStartLine(1),this.files.isEmpty())i.setOutputStartLine(1);else{const t=this.map[this.map.length-1],s=this.files.peek();s&&i.setOutputStartLine(t.getOutputStartLine()+e-s.getLinesProcessed())}return i}addExpansionRecord(t){this.queueExpansion.push(t)}getSourceLineRangeForOutputLine(t){for(const e of this.map)if(e.containsOutputLine(t))return e}optimizedSourceLineRangeLookup(t){for(let e=this.lookupIndex;e<this.map.length;e++){const s=this.map[e];if(s.containsOutputLine(t))return this.lookupIndex=e,s}for(let e=0;e<this.lookupIndex&&e<this.map.length;e++){const s=this.map[e];if(s.containsOutputLine(t))return this.lookupIndex=e,s}}getSourceLineRangeForInputLine(t,e){for(const s of this.map)if(s.containsInputLine(t,e))return s}shiftRangesBy(t,e){for(let s=e;s<this.map.length;s++)this.map[s].shiftOutputLines(t)}handleExpansion(t){const e=this.createSourceLineRange(t);let s;if(e.getOutputStartLine()-this.map[this.map.length-1].getOutputEndLine()===1){if(e.getInputStartLine()===e.getInputEndLine())return void this.map.push(e)}else s=e.getInputStartLine()!==e.getInputEndLine()||0===e.getOutputStartLine()&&0===e.getOutputEndLine()?this.getSourceLineRangeForInputLine(e.getInputStartLine(),e.getInputFileID()):this.getSourceLineRangeForOutputLine(e.getOutputStartLine());this.splitExpandedSourceLineRange(e,s)}splitExpandedSourceLineRange(t,e){const i=this.map.indexOf(e),r=0===t.getOutputStartLine()&&0===t.getOutputEndLine(),n=r?t.getInputStartLine()-t.getInputEndLine()-1:t.getOutputEndLine()-t.getOutputStartLine()+1;if(r)if(t.getInputStartLine()===e.getInputStartLine()&&t.getInputEndLine()===e.getInputEndLine())this.map.splice(i,1),this.shiftRangesBy(n,i);else if(t.getInputStartLine()===e.getInputStartLine())e.setInputStartLine(t.getInputEndLine()+1),e.setOutputStartLine(e.getOutputStartLine()+Math.abs(n)),this.shiftRangesBy(n,i);else if(t.getInputEndLine()===e.getInputEndLine())e.setInputEndLine(t.getInputStartLine()-1),e.setOutputEndLine(e.getOutputEndLine()-Math.abs(n)),this.shiftRangesBy(n,i+1);else{const r=new s(e);e.setInputEndLine(t.getInputStartLine()-1),e.fixOutputRangeBasedOnInputRange(),r.setInputStartLine(t.getInputEndLine()+1),r.setOutputStartLine(e.getOutputEndLine()+Math.abs(n)+1),this.map.splice(i+1,0,r),this.shiftRangesBy(n,i+1)}else if(e.getOutputStartLine()===t.getOutputStartLine())t.getInputStartLine()===t.getInputEndLine()&&(this.map.splice(i,0,t),this.shiftRangesBy(n,i+1));else{const r=new s(e);e.setOutputEndLine(t.getOutputStartLine()-1),e.fixInputRangeBasedOnOutputRange(),this.map.splice(i+1,0,t),r.setInputStartLine(e.getInputEndLine()+1),r.setOutputStartLine(e.getOutputEndLine()+1),this.map.splice(i+2,0,r),this.shiftRangesBy(n,i+2)}}createSourceLineRange(t){const e=new s(t.getInputFileID());let i=0,r=0,n=0,o=0;try{i=t.getInputLineStart(),r=t.getInputLineEnd(),n=t.getOutputLineStart(),o=t.getOutputLineEnd()}catch(e){throw new Error(`Unable to parse the fields of the EXPANSION record to integers\nFaulty record: ${t.toString()}`)}return e.setInputStartLine(i),e.setInputEndLine(r),e.setOutputStartLine(n),e.setOutputEndLine(o),e}getFileIDRecordForFileID(t){return this.fileTable.get(t)}getFileLocationForFileID(t){const e=this.getFileIDRecordForFileID(t);if(e)return e.getFileName()}modifyErrorInformation(t){const e=t.getStmtLine(),s=this.optimizedSourceLineRangeLookup(e);if(!s)throw new Error(`The line number on which ERROR occurs could not be found in the map.\nFaulty event: ${t.toString()}`);try{t.setStmtLine(this.getLineFromSourceLineRange(s,e)),t.setFileId(s.getInputFileID());const i=t.getStartErrLine();t.setStartErrLine(this.getLineFromSourceLineRange(s,i));const r=t.getEndErrLine();t.setEndErrLine(this.getLineFromSourceLineRange(s,r)),t.setFileName(this.fileTable.get(s.getInputFileID()).getFileName())}catch(e){throw new Error(`Unable to parse the line fields of the ERROR record to integers\nFaulty record: ${t.toString()}`)}}getLineFromSourceLineRange(t,e){return t?t.getInputEndLine()-t.getInputStartLine()===t.getOutputEndLine()-t.getOutputStartLine()||-1===t.getInputEndLine()&&-1===t.getOutputEndLine()?e-t.getOutputStartLine()+t.getInputStartLine():t.getInputStartLine():e}finalizeMap(){if(!this.files.isEmpty())throw new Error(`One or more FILEID records do not have matching FILEEND records\nList of outstanding FILEID records: ${JSON.stringify(this.files)}`);this.queueExpansion.forEach(t=>{this.handleExpansion(t)});const t=new s(1);t.setInputStartLine(0),t.setInputEndLine(0),t.setOutputStartLine(0),t.setOutputEndLine(0),this.map.unshift(t)}toString(){let t="";return this.map.forEach(e=>{t+=`${e.getInputFileID()}: [${e.getInputStartLine()},${e.getInputEndLine()}]--\x3e[${e.getOutputStartLine()},${e.getOutputEndLine()}]\n`}),t}getAllFileIDRecords(){if(!this.fileTable||0===this.fileTable.size)return[];const t=new Set;for(let e of this.fileTable.keys()){const s=this.fileTable.get(e);t.add(s)}return Array.from(t.values())}};class r{constructor(){this.stack=[]}push(t){this.stack.push(t)}pop(){return this.stack.pop()}peek(){return this.stack[this.stack.length-1]}isEmpty(){return 0===this.stack.length}size(){return this.stack.length}}},709(t,e,s){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0;const r=s(32),n=s(597),o=s(257),u=s(368),a=s(611),p=s(834),l=s(156),c=s(233),h=i(s(732));class g{constructor(t,e){this.location=t,this.browseMode=e}getLocation(){return this.location}isReadOnly(){return this.browseMode.toString()}setReadOnly(t){this.browseMode=t}}class d{constructor(t){this.iSequentialFileReader=t}readNextLine(){if(this.peakLine){const t=this.peakLine;return this.peakLine=void 0,t}return this.iSequentialFileReader.readNextLine()}peakNextRecordType(){return this.peakLine=this.iSequentialFileReader.readNextLine(),this.peakLine?.split(/\s+/).filter(t=>""!==t)[0]}}e.Parser=class{constructor(){this._loggingEnabled=!1,this.sourceTable=new Map}getUntilTheEndOfTheLine(t,e){let s=e[t++];for(;t<e.length;){s=s.concat(" ");let i=e[t++];s=s.concat(i)}return s}loggingEnabled(t){this._loggingEnabled=t}log(t){this._loggingEnabled&&console.log(t)}parse(t,e){let s,i;this.processor||(this.processor=new c.ExpansionProcessor),this.processor?.doPreProcessing();const h=new d(t);let I=h.readNextLine();for(;I;){let t=I.split(/\s+/).filter(t=>""!==t),e=0;for(;e<t.length;){if(s=t[e++],s===r.IRecordT.ERROR_INFORMATION){const s=parseInt(t[e++]);i=parseInt(t[e++]);let r=this.sourceTable.get(i);if(!r)if(0===i){r=this.sourceTable.get(1)||new g("",!1)}else r=new g("",!1);const n=parseInt(t[e++]),o=parseInt(t[e++]),u=parseInt(t[e++]),p=parseInt(t[e++]),l=parseInt(t[e++]),c=parseInt(t[e++]),h=t[e++],d=t[e++],I=parseInt(t[e++]),E=parseInt(t[e++]),L=this.getUntilTheEndOfTheLine(e,t),F=new a.ErrorInformationRecord(s,i,n,o,u,p,l,c,h,d,I,E,L);F.setFileName(r.getLocation()),this.processor&&this.processor.processErrorRecord(F);break}if(s===r.IRecordT.FILE_ID){let s=!1;const n=parseInt(t[e++]);i=parseInt(t[e++]);const o=parseInt(t[e++]),a=parseInt(t[e++]);let p=I.substring(28);this.log(`EventsFileParser: location from line 1 = ${p}`);let l=h.peakNextRecordType();for(;l===r.IRecordT.FILE_CONT;){if(I=h.readNextLine(),!I)throw new Error("Events file has incorrect format. End of file encountered before location length satisfied.");t=I.split(" "),p+=I.substring(28),this.log(`EventsFileParser: location from line 1 = ${p}`),l=h.peakNextRecordType()}let c=p.substring(p.length-16,p.length-2);try{parseInt(c)}catch(t){c=""}const d=parseInt(p.charAt(p.length-1)),E=" "===p.charAt(p.length-2);s=!(1!==d||!E),p=p.substring(0,p.length-17),p=this.resolveRelativePath(p);const L=new g(p,s);if((this.lastOutputFile&&p===this.lastOutputFile.getLocation()||this.currentOutputFile&&p===this.currentOutputFile.getLocation())&&L.setReadOnly(!0),999===i&&(this.lastOutputFile?(this.lastOutputFile=this.currentOutputFile,this.currentOutputFile=L):this.lastOutputFile=this.currentOutputFile=L),this.sourceTable.set(i,L),this.processor){const t=new u.FileIDRecord(n,i,o,a,p,c.toString(),d);try{this.processor.processFileIDRecord(t)}catch(t){const e=t.message?t.message:t;this.log(e),this.exception=new Error(e)}}break}if(s===r.IRecordT.FILE_END){if(this.processor){const s=parseInt(t[e++]),i=parseInt(t[e++]),r=parseInt(t[e++]),n=new p.FileEndRecord(s,i,r);try{this.processor?.processFileEndRecord(n)}catch(t){const e=t.message?t.message:t;this.log(e),this.exception=new Error(e)}}break}if(s===r.IRecordT.EXPANSION){if(this.processor){const s=parseInt(t[e++]),i=parseInt(t[e++]),r=parseInt(t[e++]),n=parseInt(t[e++]),o=parseInt(t[e++]),u=parseInt(t[e++]),a=parseInt(t[e++]),p=new l.ExpansionRecord(s,i,r,n,o,u,a);this.processor?.processExpansionRecord(p)}break}if(s===r.IRecordT.TIMESTAMP){if(this.processor){const s=parseInt(t[e++]),i=t[e++];let r=new n.TimestampRecord(s,i);this.processor?.processTimestampRecord(r)}break}if(s===r.IRecordT.PROCESSOR){if(this.processor){const s=parseInt(t[e++]),i=parseInt(t[e++]),r=parseInt(t[e++]);let n=new o.ProcessorRecord(s,i,r);try{this.processor?.processProcessorRecord(n)}catch(t){const e=t.message?t.message:t;this.log(e),this.exception=new Error(e)}}break}if(s===r.IRecordT.PROGRAM||s===r.IRecordT.MAP_DEFINE||s===r.IRecordT.MAP_END||s===r.IRecordT.MAP_START||s===r.IRecordT.FEEDBACK_CODE||0===s.trim().length)break;throw new Error(`Events file has incorrect format. Unexpected line type. LT=${I}`)}I&&(I=h.readNextLine())}if(this.processor)try{this.processor?.doPostProcessing()}catch(t){this.exception=new Error(t.message?t.message:t)}e&&this.getAllErrors().forEach(t=>{const s=this.sourceTable.get(t.getFileId());s&&e.createMarker(t,t.getFileName(),s.isReadOnly())})}resolveRelativePath(t){return(t=(0,h.default)(t).toString()).replace(/\\/g,"/")}getException(){return this.exception}setProcessor(t){this.processor=t}getAllErrors(){if(this.processor){const t=this.processor?.getAllErrors();let e=[];return e=e.concat(...t),e}return[]}getAllFileIDRecords(){return this.processor?this.processor.getAllFileIDRecords():[]}}},187(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.ProcessorBlock=void 0;const i=s(548);e.ProcessorBlock=class{constructor(t){this.INPUT_FILE_ID=1,this.containsExpansionEvents=!1,this.isFirstInEventsFile=!1,this.mappingSupported=!1,this.totalNumberOfLinesInOutputFile=0,this.totalNumberOfLinesInInputFiles=0,this.currentProcessor=t,this.mappingTable=new i.MapTable,this.errors=[]}getInputFile(){return this.inputFile}getInitialInputFile(){return this.previousProcessorBlock&&!this.getIsFirstInEventsFile()?this.previousProcessorBlock.getInitialInputFile():this.getInputFile()}setInputFile(t){this.inputFile=t}addFile(t){this.mappingTable.addFileInformation(t)}closeFile(t){if(this.outputFile){if(t.getFileId()===this.outputFile.getSourceId())return void this.setTotalNumberOfLinesInOutputFile(t.getExpansion());this.increaseTotalNumberOfLinesInInputFiles(t.getExpansion()),this.mappingTable.closeFile(t)}}getOutputFile(){return this.outputFile}setOutputFile(t){this.outputFile=t}getMappingTable(){return this.mappingTable}isProcessorIDZero(){return 0===this.currentProcessor.getOutputId()}addErrorInformation(t){this.errors.push(t)}processorEnded(){this.mappingTable.finalizeMap()}setPreviousProcessor(t){this.previousProcessorBlock=t}setContainsExpansionEvents(t){this.containsExpansionEvents=t}getContainsExpansionEvents(){return this.containsExpansionEvents}increaseTotalNumberOfLinesInInputFiles(t){this.totalNumberOfLinesInInputFiles+=t}getTotalNumberOfLinesInInputFiles(){return this.totalNumberOfLinesInInputFiles}setTotalNumberOfLinesInOutputFile(t){this.totalNumberOfLinesInOutputFile=t}getTotalNumberOfLinesInOutputFile(){return this.totalNumberOfLinesInOutputFile}getPreviousProcessorBlock(){return this.previousProcessorBlock}modifyErrorInformation(t){this.mappingTable.modifyErrorInformation(t);let e="",s=-1;const i=this.getInputFile();i&&(e=i.getFileName(),s=i.getSourceId()),!this.previousProcessorBlock||this.getIsFirstInEventsFile()||!this.isMappingSupported()||t.getFileId()!==s&&t.getFileName()!==e||this.previousProcessorBlock.modifyErrorInformation(t)}setFirstInEventsFile(t){this.isFirstInEventsFile=t}getIsFirstInEventsFile(){return this.isFirstInEventsFile}setMappingSupported(t){this.mappingSupported=t}isMappingSupported(){return this.mappingSupported}isFileReadOnly(t){return 1===t.getFlag()||this.previousProcessorBlock&&!this.getIsFirstInEventsFile()&&void 0!==this.previousProcessorBlock.getOutputFile()&&t.getFileName()===this.previousProcessorBlock.getOutputFile().getFileName()||void 0!==this.getOutputFile()&&t.getFileName()===this.getOutputFile().getFileName()}getAllProcessorErrors(){let t=[];return this.previousProcessorBlock&&(t=this.previousProcessorBlock.getAllProcessorErrors()),t.push(this.errors),t}resolveFileNamesForAllErrors(){this.previousProcessorBlock&&this.previousProcessorBlock.resolveFileNamesForAllErrors(),this.errors.forEach(t=>{this.resolveFileNameAndDetermineIfReadOnly(t)})}resolveFileNameAndDetermineIfReadOnly(t){let e=!1;if(this.previousProcessorBlock&&!this.getIsFirstInEventsFile()&&this.isMappingSupported()&&t.getFileId()===this.INPUT_FILE_ID)this.previousProcessorBlock.modifyErrorInformation(t);else{const s=this.mappingTable.getFileLocationForFileID(t.getFileId());if(s){const i=this.mappingTable.getFileIDRecordForFileID(t.getFileId());e=!!i&&this.isFileReadOnly(i),t.setFileName(s)}else{const s=this.getInitialInputFile();e=!!s&&this.isFileReadOnly(s),t.setFileName(s?.getFileName()||""),t.setStmtLine(0),t.setStartErrLine(0),t.setTokenStart(0),t.setEndErrLine(0),t.setTokenEnd(0)}}return e}}},611(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorInformationRecord=void 0;const i=s(32);e.ErrorInformationRecord=class{constructor(t,e,s,i,r,n,o,u,a,p,l,c,h){this.version=t,this.fileId=e,this.annotClass=s,this.stmtLine=i,this.startErrLine=r,this.tokenStart=n,this.endErrLine=o,this.tokenEnd=u,this.msgId=a,this.sevChar=p,this.sevNum=l,this.length=c,this.msg=h,this.fileName=""}getRecordType(){return i.IRecordT.ERROR_INFORMATION}getVersion(){return this.version}getFileId(){return this.fileId}setFileId(t){this.fileId=t}getFileName(){return this.fileName}setFileName(t){this.fileName=t}getAnnotClass(){return this.annotClass}getStmtLine(){return this.stmtLine}setStmtLine(t){this.stmtLine=t}getStartErrLine(){return this.startErrLine}setStartErrLine(t){this.startErrLine=t}getTokenStart(){return this.tokenStart}setTokenStart(t){this.tokenStart=t}getEndErrLine(){return this.endErrLine}setEndErrLine(t){this.endErrLine=t}getTokenEnd(){return this.tokenEnd}setTokenEnd(t){this.tokenEnd=t}getMsgId(){return this.msgId}getSevChar(){return this.sevChar}getSevNum(){return this.sevNum}getLength(){return this.length}getMsg(){return this.msg}toString(){return`${i.IRecordT.ERROR_INFORMATION}\t${this.version} ${this.fileId} ${this.annotClass} ${this.stmtLine} ${this.startErrLine} ${this.tokenStart} ${this.endErrLine} ${this.tokenEnd} ${this.msgId} ${this.sevChar} ${this.sevNum} ${this.length} ${this.msg}`}}},156(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.ExpansionRecord=void 0;const i=s(32);e.ExpansionRecord=class{constructor(t,e,s,i,r,n,o){this.version=t,this.inputFileID=e,this.inputLineStart=s,this.inputLineEnd=i,this.outputFileID=r,this.outputLineStart=n,this.outputLineEnd=o}getRecordType(){return i.IRecordT.EXPANSION}getVersion(){return this.version}getInputFileID(){return this.inputFileID}getInputLineStart(){return this.inputLineStart}getInputLineEnd(){return this.inputLineEnd}getOutputFileID(){return this.outputFileID}getOutputLineStart(){return this.outputLineStart}getOutputLineEnd(){return this.outputLineEnd}toString(){return`${i.IRecordT.EXPANSION}\t${this.version} ${this.inputFileID} ${this.inputLineStart} ${this.inputLineEnd} ${this.outputFileID} ${this.outputLineStart} ${this.outputLineEnd}`}}},834(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.FileEndRecord=void 0;const i=s(32);e.FileEndRecord=class{constructor(t,e,s){this.version=t,this.fileId=e,this.expansion=s}getRecordType(){return i.IRecordT.FILE_END}getVersion(){return this.version}getFileId(){return this.fileId}getExpansion(){return this.expansion}toString(){return`${i.IRecordT.FILE_END}\t${this.version} ${this.fileId} ${this.expansion}`}}},368(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.FileIDRecord=void 0;const i=s(32);e.FileIDRecord=class{constructor(t,e,s,i,r,n,o){this.version=t,this.sourceId=e,this.line=s,this.length=i,this.fileName=r,this.timestamp=n,this.flag=o}getRecordType(){return i.IRecordT.FILE_ID}getVersion(){return this.version}getSourceId(){return this.sourceId}getLine(){return this.line}getLength(){return this.length}getFileName(){return this.fileName}getTimestamp(){return this.timestamp}getFlag(){return this.flag}toString(){return`${i.IRecordT.FILE_ID}\t${this.version} ${this.sourceId} ${this.line} ${this.length} ${this.fileName} ${this.timestamp} ${this.flag}`}}},32(t,e){var s;Object.defineProperty(e,"__esModule",{value:!0}),e.IRecordT=void 0,function(t){t.TIMESTAMP="TIMESTAMP",t.PROCESSOR="PROCESSOR",t.FILE_ID="FILEID",t.FILE_CONT="FILEIDCONT",t.FILE_END="FILEEND",t.ERROR_INFORMATION="ERROR",t.PROGRAM="PROGRAM",t.MAP_DEFINE="MAPDEFINE",t.MAP_START="MAPSTART",t.MAP_END="MAPEND",t.FEEDBACK_CODE="FEEDBACK",t.EXPANSION="EXPANSION"}(s||(e.IRecordT=s={}))},257(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.ProcessorRecord=void 0;const i=s(32);e.ProcessorRecord=class{constructor(t,e,s){this.version=t,this.outputId=e,this.lineClass=s}getRecordType(){return i.IRecordT.PROCESSOR}getVersion(){return this.version}getOutputId(){return this.outputId}getLineClass(){return this.lineClass}toString(){return`${i.IRecordT.PROCESSOR}\t${this.version} ${this.outputId} ${this.lineClass}`}}},597(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.TimestampRecord=void 0;const i=s(32);e.TimestampRecord=class{constructor(t,e){this.version=t,this.timestamp=e}getRecordType(){return i.IRecordT.TIMESTAMP}getVersion(){return this.version}getTimestamp(){return this.timestamp}toString(){return`${i.IRecordT.TIMESTAMP}\t${this.version} ${this.timestamp}`}}}},e={};function s(i){var r=e[i];if(void 0!==r)return r.exports;var n=e[i]={exports:{}};return t[i].call(n.exports,n,n.exports,s),n.exports}var i={};(()=>{var t=i;Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorInformationRecord=t.Parser=void 0;var e=s(709);Object.defineProperty(t,"Parser",{enumerable:!0,get:function(){return e.Parser}});var r=s(611);Object.defineProperty(t,"ErrorInformationRecord",{enumerable:!0,get:function(){return r.ErrorInformationRecord}})})();var r=exports;for(var n in i)r[n]=i[n];i.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var t={732(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=void 0,e.normalize=t=>{(t=>{const e=typeof t;if("string"!==e)throw new TypeError(`Expected a string, got a ${e}`)})(t);let e=t;if(0===e.length)return".";const s=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return e=(t=>{try{return decodeURIComponent(t)}catch{return t}})(e),e=((t,e)=>{let s,i="",r=0,n=-1,o=0;for(let u=0;u<=t.length;++u){if(u<t.length)s=t.charCodeAt(u);else{if(47===s)break;s=47}if(47===s){if(n===u-1||1===o);else if(n!==u-1&&2===o){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){const t=i.lastIndexOf("/");if(t!==i.length-1){-1===t?(i="",r=0):(i=i.slice(0,t),r=i.length-1-i.lastIndexOf("/")),n=u,o=0;continue}}else if(2===i.length||1===i.length){i="",r=0,n=u,o=0;continue}e&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+t.slice(n+1,u):i=t.slice(n+1,u),r=u-n-1;n=u,o=0}else 46===s&&-1!==o?++o:o=-1}return i})(e,!s),0!==e.length||s||(e="."),e.length>0&&i&&(e+="/"),s?"/"+e:e},e.default=e.normalize},233(t,e,s){e.ExpansionProcessor=void 0;const i=s(187);e.ExpansionProcessor=class{constructor(){this.PRE_COMPILE_PROCESSOR_ID=999,this.postProcessingNeeded=!0,this._noProcessorEventsYet=!0,this._containsPreCompileProcessorBlocks=!1}processErrorRecord(t){this.currentProcessor.addErrorInformation(t)}processExpansionRecord(t){this.currentProcessor.setContainsExpansionEvents(!0),this.currentProcessor.getMappingTable().addExpansionRecord(t)}processFeedbackCodeRecord(t){}processFileEndRecord(t){try{this.currentProcessor.closeFile(t)}catch(t){throw this.postProcessingNeeded=!1,new Error(t.message?t.message:t)}}processFileIDRecord(t){try{const e=t.getSourceId();if(this.currentProcessor.isProcessorIDZero())1!==e||this.currentProcessor.getInputFile()||this.currentProcessor.setInputFile(t),this.currentProcessor.getMappingTable().addFileToFileTable(t);else{if(e>1){if(!this.currentProcessor.getOutputFile())return void this.currentProcessor.setOutputFile(t)}else 1!==e||this.currentProcessor.getInputFile()||this.currentProcessor.setInputFile(t);this.currentProcessor.addFile(t)}}catch(t){throw this.postProcessingNeeded=!1,new Error(t.message?t.message:t)}}processMapDefineRecord(t){}processMapEndRecord(t){}processMapStartRecord(t){}processProcessorRecord(t){this._containsPreCompileProcessorBlocks||t.getOutputId()!==this.PRE_COMPILE_PROCESSOR_ID||(this._containsPreCompileProcessorBlocks=!0);try{this.currentProcessor&&this.currentProcessor.processorEnded()}catch(t){throw this.postProcessingNeeded=!1,new Error(t.message?t.message:t)}const e=this.constructEventsFileProcessorBlock(t);this._noProcessorEventsYet&&(e.setFirstInEventsFile(!0),this._noProcessorEventsYet=!1),e.setPreviousProcessor(this.currentProcessor),this.currentProcessor=e}constructEventsFileProcessorBlock(t){return new i.ProcessorBlock(t)}processProgramRecord(t){}processTimestampRecord(t){this._noProcessorEventsYet=!0}doPreProcessing(){return!1}doPostProcessing(){return!(this.postProcessingNeeded&&this._containsPreCompileProcessorBlocks&&this.determineAndSetMappingSupport(this.currentProcessor)&&(this.currentProcessor.resolveFileNamesForAllErrors(),1))}determineAndSetMappingSupport(t){let e=!1,s=t;for(;s;){const t=this.isMappingSupportedByCurrentEventsFile(s);for(this.setMappingSupportForCurrentEventsFile(s,t),!e&&t&&(e=!0);s&&!s.getIsFirstInEventsFile();)s=s.getPreviousProcessorBlock();s&&(s=s.getPreviousProcessorBlock())}return e}setMappingSupportForCurrentEventsFile(t,e){let s=t;for(;s;)s.setMappingSupported(e),s=s.getIsFirstInEventsFile()?void 0:s.getPreviousProcessorBlock()}isMappingSupportedByCurrentEventsFile(t){let e;e=t.getOutputFile()?!!t.getContainsExpansionEvents()||0!==t.getTotalNumberOfLinesInOutputFile()&&t.getTotalNumberOfLinesInOutputFile()===t.getTotalNumberOfLinesInInputFiles():!(!t.getPreviousProcessorBlock()||t.getIsFirstInEventsFile());const s=t.getPreviousProcessorBlock();return s&&!t.getIsFirstInEventsFile()&&(e=e&&this.isMappingSupportedByCurrentEventsFile(s)),e}getAllErrors(){return this.currentProcessor?this.currentProcessor.getAllProcessorErrors():[]}getAllFileIDRecords(){return this.currentProcessor?this.currentProcessor.getMappingTable().getAllFileIDRecords():[]}}},548(t,e){e.MapTable=void 0;class s{constructor(t){this.inputStartLine=0,this.inputEndLine=-1,this.outputStartLine=0,this.outputEndLine=-1,"number"==typeof t?this.inputFileID=t:(this.inputStartLine=t.getInputStartLine(),this.inputEndLine=t.getInputEndLine(),this.inputFileID=t.getInputFileID(),this.outputStartLine=t.getOutputStartLine(),this.outputEndLine=t.getOutputEndLine())}getInputEndLine(){return this.inputEndLine}setInputEndLine(t){this.inputEndLine=t}getInputFileID(){return this.inputFileID}setInputFileID(t){this.inputFileID=t}getInputStartLine(){return this.inputStartLine}setInputStartLine(t){this.inputStartLine=t}getOutputEndLine(){return this.outputEndLine}setOutputEndLine(t){this.outputEndLine=t}getOutputStartLine(){return this.outputStartLine}setOutputStartLine(t){this.outputStartLine=t}shiftOutputLines(t){this.outputStartLine+=t,this.outputEndLine>0&&(this.outputEndLine+=t)}containsOutputLine(t){return-1===this.outputEndLine?t>=this.outputStartLine:t>=this.outputStartLine&&t<=this.outputEndLine}containsInputLine(t,e){return-1===this.inputEndLine?t>=this.inputStartLine&&e===this.inputFileID:t>=this.inputStartLine&&t<=this.inputEndLine&&e===this.inputFileID}fixInputRangeBasedOnOutputRange(){this.inputEndLine=this.outputEndLine-this.outputStartLine+this.inputStartLine}fixOutputRangeBasedOnInputRange(){this.outputEndLine=this.inputEndLine-this.inputStartLine+this.outputStartLine}}class i{constructor(t){this.ID=t,this.lines=0}getID(){return this.ID}getLinesProcessed(){return this.lines}increaseLinesProcessed(t){this.lines+=t}}e.MapTable=class{constructor(){this.map=[],this.queueExpansion=[],this.files=new r,this.lookupIndex=0,this.fileTable=new Map}addFileInformation(t){const e=this.createOpenEndedSourceLineRange(t),s=new i(t.getSourceId());if(!this.files.isEmpty()){const t=this.files.peek(),s=this.map[this.map.length-1];s.getOutputStartLine()===e.getOutputStartLine()?this.map.pop():(s.setOutputEndLine(e.getOutputStartLine()-1),s.setInputEndLine(s.getOutputEndLine()-s.getOutputStartLine()+s.getInputStartLine()),t?.increaseLinesProcessed(s.getInputEndLine()-s.getInputStartLine()+1))}this.map.push(e),this.files.push(s),this.fileTable.set(t.getSourceId(),t)}addFileToFileTable(t){this.fileTable.set(t.getSourceId(),t)}closeFile(t){if(this.files.isEmpty())throw new Error(`A FILEEND event does not have a matching FILEID.\nFaulty event: ${t.toString()}`);const e=this.files.pop();if(e?.getID()!==t.getFileId())throw new Error(`The ID field of the FILEEND event does not match the ID field of the last FILEID event.\nMismatched IDs: \t FILEID: ${e?.getID()}\t FILEEND: ${t.toString()}`);const i=this.map[this.map.length-1];if(i.getInputFileID()!==t.getFileId())throw new Error(`The ID field of the FILEEND event does not match the ID field of the last SourceLineRange.\nMismatched IDs: \t FILEID: ${i.getInputFileID()}\t FILEEND: ${t.toString()}`);let r=0;try{r=t.getExpansion()}catch(e){throw new Error(`Unable to parse the expansion field of the FILEEND record to an integer\nFaulty record: ${t.toString()}`)}if(0!==r){if(i.setInputEndLine(i.getInputStartLine()+r-e.getLinesProcessed()-1),i.setOutputEndLine(i.getOutputStartLine()+r-e.getLinesProcessed()-1),this.files.isEmpty())return;const t=this.files.peek(),n=new s(t.getID());n.setInputStartLine(t.getLinesProcessed()+1),n.setOutputStartLine(i.getOutputEndLine()+1),this.map.push(n)}else{if(i.setInputEndLine(i.getInputStartLine()),i.setOutputStartLine(i.getOutputStartLine()-1),i.setOutputEndLine(i.getOutputStartLine()),this.files.isEmpty())return;const t=this.files.peek(),e=new s(t.getID());e.setInputStartLine(t.getLinesProcessed()+1),e.setOutputStartLine(i.getOutputStartLine()+1),this.map.push(e)}}createOpenEndedSourceLineRange(t){let e=1;try{e=t.getLine()}catch(e){throw new Error(`Unable to parse the line field of the FILEID record to an integer\nFaulty record: ${t.toString()}`)}const i=new s(t.getSourceId());if(i.setInputStartLine(1),this.files.isEmpty())i.setOutputStartLine(1);else{const t=this.map[this.map.length-1],s=this.files.peek();s&&i.setOutputStartLine(t.getOutputStartLine()+e-s.getLinesProcessed())}return i}addExpansionRecord(t){this.queueExpansion.push(t)}getSourceLineRangeForOutputLine(t){for(const e of this.map)if(e.containsOutputLine(t))return e}optimizedSourceLineRangeLookup(t){for(let e=this.lookupIndex;e<this.map.length;e++){const s=this.map[e];if(s.containsOutputLine(t))return this.lookupIndex=e,s}for(let e=0;e<this.lookupIndex&&e<this.map.length;e++){const s=this.map[e];if(s.containsOutputLine(t))return this.lookupIndex=e,s}}getSourceLineRangeForInputLine(t,e){for(const s of this.map)if(s.containsInputLine(t,e))return s}shiftRangesBy(t,e){for(let s=e;s<this.map.length;s++)this.map[s].shiftOutputLines(t)}handleExpansion(t){const e=this.createSourceLineRange(t);let s;if(e.getOutputStartLine()-this.map[this.map.length-1].getOutputEndLine()===1){if(e.getInputStartLine()===e.getInputEndLine())return void this.map.push(e)}else s=e.getInputStartLine()!==e.getInputEndLine()||0===e.getOutputStartLine()&&0===e.getOutputEndLine()?this.getSourceLineRangeForInputLine(e.getInputStartLine(),e.getInputFileID()):this.getSourceLineRangeForOutputLine(e.getOutputStartLine());this.splitExpandedSourceLineRange(e,s)}splitExpandedSourceLineRange(t,e){const i=this.map.indexOf(e),r=0===t.getOutputStartLine()&&0===t.getOutputEndLine(),n=r?t.getInputStartLine()-t.getInputEndLine()-1:t.getOutputEndLine()-t.getOutputStartLine()+1;if(r)if(t.getInputStartLine()===e.getInputStartLine()&&t.getInputEndLine()===e.getInputEndLine())this.map.splice(i,1),this.shiftRangesBy(n,i);else if(t.getInputStartLine()===e.getInputStartLine())e.setInputStartLine(t.getInputEndLine()+1),e.setOutputStartLine(e.getOutputStartLine()+Math.abs(n)),this.shiftRangesBy(n,i);else if(t.getInputEndLine()===e.getInputEndLine())e.setInputEndLine(t.getInputStartLine()-1),e.setOutputEndLine(e.getOutputEndLine()-Math.abs(n)),this.shiftRangesBy(n,i+1);else{const r=new s(e);e.setInputEndLine(t.getInputStartLine()-1),e.fixOutputRangeBasedOnInputRange(),r.setInputStartLine(t.getInputEndLine()+1),r.setOutputStartLine(e.getOutputEndLine()+Math.abs(n)+1),this.map.splice(i+1,0,r),this.shiftRangesBy(n,i+1)}else if(e.getOutputStartLine()===t.getOutputStartLine())t.getInputStartLine()===t.getInputEndLine()&&(this.map.splice(i,0,t),this.shiftRangesBy(n,i+1));else{const r=new s(e);e.setOutputEndLine(t.getOutputStartLine()-1),e.fixInputRangeBasedOnOutputRange(),this.map.splice(i+1,0,t),r.setInputStartLine(e.getInputEndLine()+1),r.setOutputStartLine(e.getOutputEndLine()+1),this.map.splice(i+2,0,r),this.shiftRangesBy(n,i+2)}}createSourceLineRange(t){const e=new s(t.getInputFileID());let i=0,r=0,n=0,o=0;try{i=t.getInputLineStart(),r=t.getInputLineEnd(),n=t.getOutputLineStart(),o=t.getOutputLineEnd()}catch(e){throw new Error(`Unable to parse the fields of the EXPANSION record to integers\nFaulty record: ${t.toString()}`)}return e.setInputStartLine(i),e.setInputEndLine(r),e.setOutputStartLine(n),e.setOutputEndLine(o),e}getFileIDRecordForFileID(t){return this.fileTable.get(t)}getFileLocationForFileID(t){const e=this.getFileIDRecordForFileID(t);if(e)return e.getFileName()}modifyErrorInformation(t){const e=t.getStmtLine(),s=this.optimizedSourceLineRangeLookup(e);if(!s)throw new Error(`The line number on which ERROR occurs could not be found in the map.\nFaulty event: ${t.toString()}`);try{t.setStmtLine(this.getLineFromSourceLineRange(s,e)),t.setFileId(s.getInputFileID());const i=t.getStartErrLine();t.setStartErrLine(this.getLineFromSourceLineRange(s,i));const r=t.getEndErrLine();t.setEndErrLine(this.getLineFromSourceLineRange(s,r)),t.setFileName(this.fileTable.get(s.getInputFileID()).getFileName())}catch(e){throw new Error(`Unable to parse the line fields of the ERROR record to integers\nFaulty record: ${t.toString()}`)}}getLineFromSourceLineRange(t,e){return t?t.getInputEndLine()-t.getInputStartLine()===t.getOutputEndLine()-t.getOutputStartLine()||-1===t.getInputEndLine()&&-1===t.getOutputEndLine()?e-t.getOutputStartLine()+t.getInputStartLine():t.getInputStartLine():e}finalizeMap(){if(!this.files.isEmpty())throw new Error(`One or more FILEID records do not have matching FILEEND records\nList of outstanding FILEID records: ${JSON.stringify(this.files)}`);this.queueExpansion.forEach(t=>{this.handleExpansion(t)});const t=new s(1);t.setInputStartLine(0),t.setInputEndLine(0),t.setOutputStartLine(0),t.setOutputEndLine(0),this.map.unshift(t)}toString(){let t="";return this.map.forEach(e=>{t+=`${e.getInputFileID()}: [${e.getInputStartLine()},${e.getInputEndLine()}]--\x3e[${e.getOutputStartLine()},${e.getOutputEndLine()}]\n`}),t}getAllFileIDRecords(){if(!this.fileTable||0===this.fileTable.size)return[];const t=new Set;for(let e of this.fileTable.keys()){const s=this.fileTable.get(e);t.add(s)}return Array.from(t.values())}};class r{constructor(){this.stack=[]}push(t){this.stack.push(t)}pop(){return this.stack.pop()}peek(){return this.stack[this.stack.length-1]}isEmpty(){return 0===this.stack.length}size(){return this.stack.length}}},709(t,e,s){var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0;const r=s(32),n=s(597),o=s(257),u=s(368),a=s(611),p=s(834),l=s(156),c=s(233),h=i(s(732));class g{constructor(t,e){this.location=t,this.browseMode=e}getLocation(){return this.location}isReadOnly(){return this.browseMode.toString()}setReadOnly(t){this.browseMode=t}}class d{constructor(t){this.iSequentialFileReader=t}readNextLine(){if(this.peakLine){const t=this.peakLine;return this.peakLine=void 0,t}return this.iSequentialFileReader.readNextLine()}peakNextRecordType(){return this.peakLine=this.iSequentialFileReader.readNextLine(),this.peakLine?.split(/\s+/).filter(t=>""!==t)[0]}}e.Parser=class{constructor(){this._loggingEnabled=!1,this.sourceTable=new Map}getUntilTheEndOfTheLine(t,e){let s=e[t++];for(;t<e.length;){s=s.concat(" ");let i=e[t++];s=s.concat(i)}return s}loggingEnabled(t){this._loggingEnabled=t}log(t){this._loggingEnabled&&console.log(t)}parse(t,e){let s,i;this.processor||(this.processor=new c.ExpansionProcessor),this.processor?.doPreProcessing();const h=new d(t);let I=h.readNextLine();for(;I;){let t=I.split(/\s+/).filter(t=>""!==t),e=0;for(;e<t.length;){if(s=t[e++],s===r.IRecordT.ERROR_INFORMATION){const s=parseInt(t[e++]);i=parseInt(t[e++]);let r=this.sourceTable.get(i);if(!r)if(0===i){r=this.sourceTable.get(1)||new g("",!1)}else r=new g("",!1);const n=parseInt(t[e++]),o=parseInt(t[e++]),u=parseInt(t[e++]),p=parseInt(t[e++]),l=parseInt(t[e++]),c=parseInt(t[e++]),h=t[e++],d=t[e++],I=parseInt(t[e++]),E=parseInt(t[e++]),L=this.getUntilTheEndOfTheLine(e,t),F=new a.ErrorInformationRecord(s,i,n,o,u,p,l,c,h,d,I,E,L);F.setFileName(r.getLocation()),this.processor&&this.processor.processErrorRecord(F);break}if(s===r.IRecordT.FILE_ID){let s=!1;const n=parseInt(t[e++]);i=parseInt(t[e++]);const o=parseInt(t[e++]),a=parseInt(t[e++]);let p=I.substring(28);this.log(`EventsFileParser: location from line 1 = ${p}`);let l=h.peakNextRecordType();for(;l===r.IRecordT.FILE_CONT;){if(I=h.readNextLine(),!I)throw new Error("Events file has incorrect format. End of file encountered before location length satisfied.");t=I.split(" "),p+=I.substring(28),this.log(`EventsFileParser: location from line 1 = ${p}`),l=h.peakNextRecordType()}let c=p.substring(p.length-16,p.length-2);try{parseInt(c)}catch(t){c=""}const d=parseInt(p.charAt(p.length-1)),E=" "===p.charAt(p.length-2);s=!(1!==d||!E),p=p.substring(0,p.length-17),p=this.resolveRelativePath(p);const L=new g(p,s);if((this.lastOutputFile&&p===this.lastOutputFile.getLocation()||this.currentOutputFile&&p===this.currentOutputFile.getLocation())&&L.setReadOnly(!0),999===i&&(this.lastOutputFile?(this.lastOutputFile=this.currentOutputFile,this.currentOutputFile=L):this.lastOutputFile=this.currentOutputFile=L),this.sourceTable.set(i,L),this.processor){const t=new u.FileIDRecord(n,i,o,a,p,c.toString(),d);try{this.processor.processFileIDRecord(t)}catch(t){const e=t.message?t.message:t;this.log(e),this.exception=new Error(e)}}break}if(s===r.IRecordT.FILE_END){if(this.processor){const s=parseInt(t[e++]),i=parseInt(t[e++]),r=parseInt(t[e++]),n=new p.FileEndRecord(s,i,r);try{this.processor?.processFileEndRecord(n)}catch(t){const e=t.message?t.message:t;this.log(e),this.exception=new Error(e)}}break}if(s===r.IRecordT.EXPANSION){if(this.processor){const s=parseInt(t[e++]),i=parseInt(t[e++]),r=parseInt(t[e++]),n=parseInt(t[e++]),o=parseInt(t[e++]),u=parseInt(t[e++]),a=parseInt(t[e++]),p=new l.ExpansionRecord(s,i,r,n,o,u,a);this.processor?.processExpansionRecord(p)}break}if(s===r.IRecordT.TIMESTAMP){if(this.processor){const s=parseInt(t[e++]),i=t[e++];let r=new n.TimestampRecord(s,i);this.processor?.processTimestampRecord(r)}break}if(s===r.IRecordT.PROCESSOR){if(this.processor){const s=parseInt(t[e++]),i=parseInt(t[e++]),r=parseInt(t[e++]);let n=new o.ProcessorRecord(s,i,r);try{this.processor?.processProcessorRecord(n)}catch(t){const e=t.message?t.message:t;this.log(e),this.exception=new Error(e)}}break}if(s===r.IRecordT.PROGRAM||s===r.IRecordT.MAP_DEFINE||s===r.IRecordT.MAP_END||s===r.IRecordT.MAP_START||s===r.IRecordT.FEEDBACK_CODE||0===s.trim().length)break;throw new Error(`Events file has incorrect format. Unexpected line type. LT=${I}`)}I&&(I=h.readNextLine())}if(this.processor)try{this.processor?.doPostProcessing()}catch(t){this.exception=new Error(t.message?t.message:t)}e&&this.getAllErrors().forEach(t=>{const s=this.sourceTable.get(t.getFileId());s&&e.createMarker(t,t.getFileName(),s.isReadOnly())})}resolveRelativePath(t){return(t=(0,h.default)(t).toString()).replace(/\\/g,"/")}getException(){return this.exception}setProcessor(t){this.processor=t}getAllErrors(){if(this.processor){const t=this.processor?.getAllErrors();let e=[];return e=e.concat(...t),e}return[]}getAllFileIDRecords(){return this.processor?this.processor.getAllFileIDRecords():[]}}},187(t,e,s){e.ProcessorBlock=void 0;const i=s(548);e.ProcessorBlock=class{constructor(t){this.INPUT_FILE_ID=1,this.containsExpansionEvents=!1,this.isFirstInEventsFile=!1,this.mappingSupported=!1,this.totalNumberOfLinesInOutputFile=0,this.totalNumberOfLinesInInputFiles=0,this.currentProcessor=t,this.mappingTable=new i.MapTable,this.errors=[]}getInputFile(){return this.inputFile}getInitialInputFile(){return this.previousProcessorBlock&&!this.getIsFirstInEventsFile()?this.previousProcessorBlock.getInitialInputFile():this.getInputFile()}setInputFile(t){this.inputFile=t}addFile(t){this.mappingTable.addFileInformation(t)}closeFile(t){if(this.outputFile){if(t.getFileId()===this.outputFile.getSourceId())return void this.setTotalNumberOfLinesInOutputFile(t.getExpansion());this.increaseTotalNumberOfLinesInInputFiles(t.getExpansion()),this.mappingTable.closeFile(t)}}getOutputFile(){return this.outputFile}setOutputFile(t){this.outputFile=t}getMappingTable(){return this.mappingTable}isProcessorIDZero(){return 0===this.currentProcessor.getOutputId()}addErrorInformation(t){this.errors.push(t)}processorEnded(){this.mappingTable.finalizeMap()}setPreviousProcessor(t){this.previousProcessorBlock=t}setContainsExpansionEvents(t){this.containsExpansionEvents=t}getContainsExpansionEvents(){return this.containsExpansionEvents}increaseTotalNumberOfLinesInInputFiles(t){this.totalNumberOfLinesInInputFiles+=t}getTotalNumberOfLinesInInputFiles(){return this.totalNumberOfLinesInInputFiles}setTotalNumberOfLinesInOutputFile(t){this.totalNumberOfLinesInOutputFile=t}getTotalNumberOfLinesInOutputFile(){return this.totalNumberOfLinesInOutputFile}getPreviousProcessorBlock(){return this.previousProcessorBlock}modifyErrorInformation(t){this.mappingTable.modifyErrorInformation(t);let e="",s=-1;const i=this.getInputFile();i&&(e=i.getFileName(),s=i.getSourceId()),!this.previousProcessorBlock||this.getIsFirstInEventsFile()||!this.isMappingSupported()||t.getFileId()!==s&&t.getFileName()!==e||this.previousProcessorBlock.modifyErrorInformation(t)}setFirstInEventsFile(t){this.isFirstInEventsFile=t}getIsFirstInEventsFile(){return this.isFirstInEventsFile}setMappingSupported(t){this.mappingSupported=t}isMappingSupported(){return this.mappingSupported}isFileReadOnly(t){return 1===t.getFlag()||this.previousProcessorBlock&&!this.getIsFirstInEventsFile()&&void 0!==this.previousProcessorBlock.getOutputFile()&&t.getFileName()===this.previousProcessorBlock.getOutputFile().getFileName()||void 0!==this.getOutputFile()&&t.getFileName()===this.getOutputFile().getFileName()}getAllProcessorErrors(){let t=[];return this.previousProcessorBlock&&(t=this.previousProcessorBlock.getAllProcessorErrors()),t.push(this.errors),t}resolveFileNamesForAllErrors(){this.previousProcessorBlock&&this.previousProcessorBlock.resolveFileNamesForAllErrors(),this.errors.forEach(t=>{this.resolveFileNameAndDetermineIfReadOnly(t)})}resolveFileNameAndDetermineIfReadOnly(t){let e=!1;if(this.previousProcessorBlock&&!this.getIsFirstInEventsFile()&&this.isMappingSupported()&&t.getFileId()===this.INPUT_FILE_ID)this.previousProcessorBlock.modifyErrorInformation(t);else{const s=this.mappingTable.getFileLocationForFileID(t.getFileId());if(s){const i=this.mappingTable.getFileIDRecordForFileID(t.getFileId());e=!!i&&this.isFileReadOnly(i),t.setFileName(s)}else{const s=this.getInitialInputFile();e=!!s&&this.isFileReadOnly(s),t.setFileName(s?.getFileName()||""),t.setStmtLine(0),t.setStartErrLine(0),t.setTokenStart(0),t.setEndErrLine(0),t.setTokenEnd(0)}}return e}}},611(t,e,s){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorInformationRecord=void 0;const i=s(32);e.ErrorInformationRecord=class{constructor(t,e,s,i,r,n,o,u,a,p,l,c,h){this.version=t,this.fileId=e,this.annotClass=s,this.stmtLine=i,this.startErrLine=r,this.tokenStart=n,this.endErrLine=o,this.tokenEnd=u,this.msgId=a,this.sevChar=p,this.sevNum=l,this.length=c,this.msg=h,this.fileName=""}getRecordType(){return i.IRecordT.ERROR_INFORMATION}getVersion(){return this.version}getFileId(){return this.fileId}setFileId(t){this.fileId=t}getFileName(){return this.fileName}setFileName(t){this.fileName=t}getAnnotClass(){return this.annotClass}getStmtLine(){return this.stmtLine}setStmtLine(t){this.stmtLine=t}getStartErrLine(){return this.startErrLine}setStartErrLine(t){this.startErrLine=t}getTokenStart(){return this.tokenStart}setTokenStart(t){this.tokenStart=t}getEndErrLine(){return this.endErrLine}setEndErrLine(t){this.endErrLine=t}getTokenEnd(){return this.tokenEnd}setTokenEnd(t){this.tokenEnd=t}getMsgId(){return this.msgId}getSevChar(){return this.sevChar}getSevNum(){return this.sevNum}getLength(){return this.length}getMsg(){return this.msg}toString(){return`${i.IRecordT.ERROR_INFORMATION}\t${this.version} ${this.fileId} ${this.annotClass} ${this.stmtLine} ${this.startErrLine} ${this.tokenStart} ${this.endErrLine} ${this.tokenEnd} ${this.msgId} ${this.sevChar} ${this.sevNum} ${this.length} ${this.msg}`}}},156(t,e,s){e.ExpansionRecord=void 0;const i=s(32);e.ExpansionRecord=class{constructor(t,e,s,i,r,n,o){this.version=t,this.inputFileID=e,this.inputLineStart=s,this.inputLineEnd=i,this.outputFileID=r,this.outputLineStart=n,this.outputLineEnd=o}getRecordType(){return i.IRecordT.EXPANSION}getVersion(){return this.version}getInputFileID(){return this.inputFileID}getInputLineStart(){return this.inputLineStart}getInputLineEnd(){return this.inputLineEnd}getOutputFileID(){return this.outputFileID}getOutputLineStart(){return this.outputLineStart}getOutputLineEnd(){return this.outputLineEnd}toString(){return`${i.IRecordT.EXPANSION}\t${this.version} ${this.inputFileID} ${this.inputLineStart} ${this.inputLineEnd} ${this.outputFileID} ${this.outputLineStart} ${this.outputLineEnd}`}}},834(t,e,s){e.FileEndRecord=void 0;const i=s(32);e.FileEndRecord=class{constructor(t,e,s){this.version=t,this.fileId=e,this.expansion=s}getRecordType(){return i.IRecordT.FILE_END}getVersion(){return this.version}getFileId(){return this.fileId}getExpansion(){return this.expansion}toString(){return`${i.IRecordT.FILE_END}\t${this.version} ${this.fileId} ${this.expansion}`}}},368(t,e,s){e.FileIDRecord=void 0;const i=s(32);e.FileIDRecord=class{constructor(t,e,s,i,r,n,o){this.version=t,this.sourceId=e,this.line=s,this.length=i,this.fileName=r,this.timestamp=n,this.flag=o}getRecordType(){return i.IRecordT.FILE_ID}getVersion(){return this.version}getSourceId(){return this.sourceId}getLine(){return this.line}getLength(){return this.length}getFileName(){return this.fileName}getTimestamp(){return this.timestamp}getFlag(){return this.flag}toString(){return`${i.IRecordT.FILE_ID}\t${this.version} ${this.sourceId} ${this.line} ${this.length} ${this.fileName} ${this.timestamp} ${this.flag}`}}},32(t,e){var s;e.IRecordT=void 0,function(t){t.TIMESTAMP="TIMESTAMP",t.PROCESSOR="PROCESSOR",t.FILE_ID="FILEID",t.FILE_CONT="FILEIDCONT",t.FILE_END="FILEEND",t.ERROR_INFORMATION="ERROR",t.PROGRAM="PROGRAM",t.MAP_DEFINE="MAPDEFINE",t.MAP_START="MAPSTART",t.MAP_END="MAPEND",t.FEEDBACK_CODE="FEEDBACK",t.EXPANSION="EXPANSION"}(s||(e.IRecordT=s={}))},257(t,e,s){e.ProcessorRecord=void 0;const i=s(32);e.ProcessorRecord=class{constructor(t,e,s){this.version=t,this.outputId=e,this.lineClass=s}getRecordType(){return i.IRecordT.PROCESSOR}getVersion(){return this.version}getOutputId(){return this.outputId}getLineClass(){return this.lineClass}toString(){return`${i.IRecordT.PROCESSOR}\t${this.version} ${this.outputId} ${this.lineClass}`}}},597(t,e,s){e.TimestampRecord=void 0;const i=s(32);e.TimestampRecord=class{constructor(t,e){this.version=t,this.timestamp=e}getRecordType(){return i.IRecordT.TIMESTAMP}getVersion(){return this.version}getTimestamp(){return this.timestamp}toString(){return`${i.IRecordT.TIMESTAMP}\t${this.version} ${this.timestamp}`}}}};const e={};function s(i){const r=e[i];if(void 0!==r)return r.exports;const n=e[i]={exports:{}};return t[i].call(n.exports,n,n.exports,s),n.exports}let i={};(()=>{let t=i;Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorInformationRecord=t.Parser=void 0;var e=s(709);Object.defineProperty(t,"Parser",{enumerable:!0,get:function(){return e.Parser}});var r=s(611);Object.defineProperty(t,"ErrorInformationRecord",{enumerable:!0,get:function(){return r.ErrorInformationRecord}})})();const r=exports;for(var n in i)r[n]=i[n];i.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED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aAAAsE,GACN,OAAOtI,EAAA6C,SAAS4G,SACjB,CAEO,UAAAlB,GACN,OAAOpU,KAAK4O,OACb,CAOO,YAAAuG,GACN,OAAOnV,KAAK6P,SACb,CAEO,QAAAzI,GACN,MAAO,GAAGyE,EAAA6C,SAAS4G,cACbtV,KAAK4O,WAAW5O,KAAK6P,WAC5B,KChCD0F,EAAA,GAGA,SAAAzV,EAAA0V,GAEA,IAAAC,EAAAF,EAAAC,GACA,QAAAhS,IAAAiS,EACA,OAAAA,EAAAzX,QAGA,IAAA2B,EAAA4V,EAAAC,GAAA,CAGAxX,QAAA,IAOA,OAHA0X,EAAAF,GAAAG,KAAAhW,EAAA3B,QAAA2B,EAAAA,EAAA3B,QAAA8B,GAGAH,EAAA3B,OACA,kHClBA,IAAA4X,EAAA9V,EAAA,KAAShC,OAAAC,eAAAC,EAAA,UAAA6X,YAAA,EAAArM,IAAA,kBAAAoM,EAAAtI,MAAM,IACf,IAAArB,EAAAnM,EAAA,KAAShC,OAAAC,eAAAC,EAAA,0BAAA6X,YAAA,EAAArM,IAAA,kBAAAyC,EAAAsD,sBAAsB","sources":["webpack://@ibm/ibmi-eventf-parser/./node_modules/path-normalize/lib/index.js","webpack://@ibm/ibmi-eventf-parser/./src/ExpansionProcessor.ts","webpack://@ibm/ibmi-eventf-parser/./src/MapTable.ts","webpack://@ibm/ibmi-eventf-parser/./src/Parser.ts","webpack://@ibm/ibmi-eventf-parser/./src/ProcessorBlock.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/ErrorInformationRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/ExpansionRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/FileEndRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/FileIDRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/IRecordT.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/ProcessorRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/TimestampRecord.ts","webpack://@ibm/ibmi-eventf-parser/webpack/bootstrap","webpack://@ibm/ibmi-eventf-parser/./src/index.ts"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n/* eslint-disable max-depth, max-statements, complexity, max-lines-per-function */\nvar SLASH = 47;\nvar DOT = 46;\nvar assertPath = function assertPath(path) {\n var t = _typeof(path);\n if (t !== 'string') {\n throw new TypeError(\"Expected a string, got a \".concat(t));\n }\n};\n\n// this function is directly from node source\nvar posixNormalize = function posixNormalize(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n } else if (code === SLASH) {\n break;\n } else {\n code = SLASH;\n }\n if (code === SLASH) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0) {\n res += '/..';\n } else {\n res = '..';\n }\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0) {\n res += '/' + path.slice(lastSlash + 1, i);\n } else {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === DOT && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n};\nvar decode = function decode(s) {\n try {\n return decodeURIComponent(s);\n } catch (_unused) {\n return s;\n }\n};\nvar normalize = function normalize(p) {\n assertPath(p);\n var path = p;\n if (path.length === 0) {\n return '.';\n }\n var isAbsolute = path.charCodeAt(0) === SLASH;\n var trailingSeparator = path.charCodeAt(path.length - 1) === SLASH;\n path = decode(path);\n path = posixNormalize(path, !isAbsolute);\n if (path.length === 0 && !isAbsolute) {\n path = '.';\n }\n if (path.length > 0 && trailingSeparator) {\n path += '/';\n }\n if (isAbsolute) {\n return '/' + path;\n }\n return path;\n};\nvar _default = normalize;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IProcessor } from \"./IProcessor\";\nimport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nimport { ExpansionRecord } from \"./record/ExpansionRecord\";\nimport { FeedbackCodeRecord } from \"./record/FeedbackCodeRecord\";\nimport { FileEndRecord } from \"./record/FileEndRecord\";\nimport { FileIDRecord } from \"./record/FileIDRecord\";\nimport { MapDefineRecord } from \"./record/MapDefineRecord\";\nimport { MapEndRecord } from \"./record/MapEndRecord\";\nimport { MapStartRecord } from \"./record/MapStartRecord\";\nimport { ProcessorBlock } from \"./ProcessorBlock\";\nimport { ProcessorRecord } from \"./record/ProcessorRecord\";\nimport { ProgramRecord } from \"./record/ProgramRecord\";\nimport { TimestampRecord } from \"./record/TimestampRecord\";\n\nexport class ExpansionProcessor implements IProcessor {\n\tprivate PRE_COMPILE_PROCESSOR_ID = 999;\n\n\tprotected currentProcessor: ProcessorBlock | undefined;\n\n\t// Flags any errors that occur during processing and disables the processor if needed\n\tprotected postProcessingNeeded: boolean = true;\n\n\t// Flags if the Events File contains any EXPANSION Events or not\n\t// private containsExpansionEvents: boolean = false;\n\n\t// Needed for events files that contain multiple events files that have been combined into one (as done in iProjects).\n\t// Gets set to true at the beginning of each new \"sub\" events file (marked by a new TIMESTAMP record),\n\t// and to false after each first PROCESSOR event in the \"sub\" events file.\n\t// The scope of this variable is only the current \"sub\" events file.\n\tprivate _noProcessorEventsYet: boolean = true;\n\n\t// Needed to decide whether to do mappings of errors to input members\n\t// If true, temporary output members are involved, and mappings may be needed (unless not supported by pre-compilers)\n\tprotected _containsPreCompileProcessorBlocks: boolean = false;\n\n\tconstructor() { }\n\n\tpublic processErrorRecord(record: ErrorInformationRecord) {\n\t\tthis.currentProcessor!.addErrorInformation(record);\n\t}\n\n\tpublic processExpansionRecord(record: ExpansionRecord) {\n\t\t// this.containsExpansionEvents = true;\n\t\tthis.currentProcessor!.setContainsExpansionEvents(true);\n\t\tthis.currentProcessor!.getMappingTable().addExpansionRecord(record);\n\t}\n\n\tpublic processFeedbackCodeRecord(record: FeedbackCodeRecord) { }\n\n\tpublic processFileEndRecord(record: FileEndRecord) {\n\t\ttry {\n\t\t\tthis.currentProcessor!.closeFile(record);\n\t\t} catch (e: any) {\n\t\t\tthis.postProcessingNeeded = false;\n\t\t\tthrow new Error(e.message ? e.message : e);\n\t\t}\n\t}\n\n\tpublic processFileIDRecord(record: FileIDRecord) {\n\t\t// The try-catch block is there to flag any problems, disable processing and allow regular Events File processing to continue\n\t\ttry {\n\t\t\tconst fileID = record.getSourceId();\n\n\t\t\tif (!this.currentProcessor!.isProcessorIDZero()) {\n\t\t\t\tif (fileID > 1) {\n\t\t\t\t\tif (!this.currentProcessor!.getOutputFile()) {\n\t\t\t\t\t\tthis.currentProcessor!.setOutputFile(record);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else if (fileID === 1 && !this.currentProcessor!.getInputFile()) {\n\t\t\t\t\tthis.currentProcessor!.setInputFile(record);\n\t\t\t\t}\n\n\t\t\t\tthis.currentProcessor!.addFile(record);\n\t\t\t} else {\n\t\t\t\t// We need to keep track of all files in the compiler processor block to be able to get the location for files\n\t\t\t\tif (fileID === 1 && !this.currentProcessor!.getInputFile()) {\n\t\t\t\t\tthis.currentProcessor!.setInputFile(record);\n\t\t\t\t}\n\n\t\t\t\tthis.currentProcessor!.getMappingTable().addFileToFileTable(record);\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\tthis.postProcessingNeeded = false;\n\t\t\tthrow new Error(e.message ? e.message : e);\n\t\t}\n\t}\n\n\tpublic processMapDefineRecord(record: MapDefineRecord) { }\n\n\tpublic processMapEndRecord(record: MapEndRecord) { }\n\n\tpublic processMapStartRecord(record: MapStartRecord) { }\n\n\tpublic processProcessorRecord(record: ProcessorRecord) {\n\t\tif (!this._containsPreCompileProcessorBlocks && record.getOutputId() === this.PRE_COMPILE_PROCESSOR_ID) {\n\t\t\tthis._containsPreCompileProcessorBlocks = true;\n\t\t}\n\n\t\ttry {\n\t\t\tif (this.currentProcessor!) {\n\t\t\t\tthis.currentProcessor!.processorEnded();\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\tthis.postProcessingNeeded = false;\n\t\t\tthrow new Error(e.message ? e.message : e);\n\t\t}\n\n\t\tconst newProcessor = this.constructEventsFileProcessorBlock(record);\n\n\t\t// Set this processor block as the first one in the current \"sub\" events file\n\t\t// (needed for events file that contains multiple events files that have been combined into one)\n\t\tif (this._noProcessorEventsYet) {\n\t\t\tnewProcessor.setFirstInEventsFile(true);\n\t\t\tthis._noProcessorEventsYet = false;\n\t\t}\n\n\t\tnewProcessor.setPreviousProcessor(this.currentProcessor!);\n\t\tthis.currentProcessor! = newProcessor;\n\t}\n\n\n\tprotected constructEventsFileProcessorBlock(record: ProcessorRecord): ProcessorBlock {\n\t\treturn new ProcessorBlock(record);\n\t}\n\n\tpublic processProgramRecord(record: ProgramRecord) { }\n\n\tpublic processTimestampRecord(record: TimestampRecord) {\n\t\tthis._noProcessorEventsYet = true;\n\t}\n\n\tpublic doPreProcessing(): boolean {\n\t\treturn false;\n\t}\n\n\tpublic doPostProcessing(): boolean {\n\t\tif (!this.postProcessingNeeded || !this._containsPreCompileProcessorBlocks || !this.determineAndSetMappingSupport(this.currentProcessor!)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.currentProcessor!.resolveFileNamesForAllErrors();\n\t\treturn false;\n\t}\n\n\t/** \n\t * Recursively determines whether the events file (or any of the \"sub\" events files\n\t * when multiple have been combined into one) supports mapping of errors from the \n\t * final temporary output member to the original input members.\n\t * Also sets a property of each processor block for whether it supports mappings.\n\t * Mapping is supported for an events file if all its processor blocks support error mapping.\n\t * IMPORTANT: When called at the top level, this method should only be called on the \n\t * very last processor block of the [combined] events file.\n\t * \n\t * @param lastProcessorBlock The first processor block to check. When called at the top\n\t * level, this should be the very last processor block of the [combined] events file.\n\t * @return True if any of the events files support mapping of errors, false otherwise.\n\t */\n\tprotected determineAndSetMappingSupport(lastProcessorBlock: ProcessorBlock): boolean {\n\t\tlet isMappingSupportedByAny = false;\n\t\tlet curProc: ProcessorBlock | undefined = lastProcessorBlock;\n\n\t\twhile (curProc) {\n\t\t\tconst curSupport = this.isMappingSupportedByCurrentEventsFile(curProc);\n\t\t\tthis.setMappingSupportForCurrentEventsFile(curProc, curSupport);\n\n\t\t\tif (!isMappingSupportedByAny && curSupport) {\n\t\t\t\tisMappingSupportedByAny = true;\n\t\t\t}\n\n\t\t\t// Iterate to the first processor block in the current \"sub\" events file,\n\t\t\twhile (curProc && !curProc.getIsFirstInEventsFile()) {\n\t\t\t\tcurProc = curProc.getPreviousProcessorBlock();\n\t\t\t}\n\n\t\t\t// Use it to get the previous \"sub\" events file's last processor block\t\t\t\n\t\t\tif (curProc) {\n\t\t\t\tcurProc = curProc.getPreviousProcessorBlock();\n\t\t\t}\n\t\t}\n\n\t\treturn isMappingSupportedByAny;\n\t}\n\n\t/**\n\t * Sets the supportsMappings property for each processor block in the current events file\n\t * to the value provided.\n\t * IMPORTANT: This method should only be called on the last processor block\n\t * of the current events file.\n\t * \n\t * @param lastProcessorBlock The last processor block of the current events file.\n\t * @param support Boolean value corresponding to whether the current events file requires \n\t * and supports mappings.\n\t */\n\tprivate setMappingSupportForCurrentEventsFile(lastProcessorBlock: ProcessorBlock, support: boolean) {\n\t\tlet curProc: ProcessorBlock | undefined = lastProcessorBlock;\n\n\t\twhile (curProc) {\n\t\t\tcurProc.setMappingSupported(support);\n\n\t\t\tif (curProc.getIsFirstInEventsFile()) {\n\t\t\t\tcurProc = undefined;\n\t\t\t} else {\n\t\t\t\tcurProc = curProc.getPreviousProcessorBlock();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Recursively determines whether the current events file (or \"sub\" events file in the case of\n\t * multiple events files combined into one) requires and supports mapping of errors\n\t * from its output file to its input files. An [\"sub\"] events file supports mapping of\n\t * errors if all of its processor blocks support error mappings.\n\t * For individual processor blocks in the events file:\n\t * For compile processor blocks, when they come after pre-compile processor blocks(s),\n\t * mapping is considered to be supported. If they do not come after pre-compile\n\t * block(s), there is no need to do mappings, so mapping is not considered supported.\n\t * For pre-compile processor blocks (which will have temporary output members),\n\t * mapping is supported if there are expansion events, or if there are no\n\t * expansion events but the total number of lines written to the output\n\t * file equals the total number of lines read from the input files, and is not zero.\n\t * IMPORTANT: When called at the top level, this method should only be called on \n\t * the last processor block of the current events file.\n\t * \n\t * @param lastProcessorBlock The last processor block of the current events file. \n\t * @return True if the current events file supports mapping of errors, false otherwise.\n\t */\n\tprivate isMappingSupportedByCurrentEventsFile(lastProcessorBlock: ProcessorBlock): boolean {\n\t\tlet supported: boolean;\n\n\t\tif (!lastProcessorBlock.getOutputFile()) {\n\t\t\t// Compile processor block case\n\t\t\tif (!lastProcessorBlock.getPreviousProcessorBlock() || lastProcessorBlock.getIsFirstInEventsFile()) {\n\t\t\t\tsupported = false;\n\t\t\t} else {\n\t\t\t\tsupported = true;\n\t\t\t}\n\t\t} else if (lastProcessorBlock.getContainsExpansionEvents()) {\n\t\t\tsupported = true;\n\t\t} else if (lastProcessorBlock.getTotalNumberOfLinesInOutputFile() === 0) {\n\t\t\tsupported = false;\n\t\t} else {\n\t\t\tsupported = lastProcessorBlock.getTotalNumberOfLinesInOutputFile() === lastProcessorBlock.getTotalNumberOfLinesInInputFiles();\n\t\t}\n\n\t\tconst previousProcessorBlock = lastProcessorBlock.getPreviousProcessorBlock();\n\t\tif (previousProcessorBlock && !lastProcessorBlock.getIsFirstInEventsFile()) {\n\t\t\tsupported = supported && this.isMappingSupportedByCurrentEventsFile(previousProcessorBlock);\n\t\t}\n\n\t\treturn supported;\n\t}\n\n\tpublic getAllErrors(): ErrorInformationRecord[][] {\n\t\tif (this.currentProcessor!) {\n\t\t\treturn this.currentProcessor!.getAllProcessorErrors();\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tpublic getAllFileIDRecords(): FileIDRecord[] {\n\t\tif (this.currentProcessor!) {\n\t\t\treturn this.currentProcessor!.getMappingTable().getAllFileIDRecords();\n\t\t} else {\n\t\t\treturn [];\n\t\t}\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nimport { ExpansionRecord } from \"./record/ExpansionRecord\";\nimport { FileEndRecord } from \"./record/FileEndRecord\";\nimport { FileIDRecord } from \"./record/FileIDRecord\";\n\n/**\n * Class used as a container of line numbers and file IDs for each range\n * of lines in the map.\n */\nclass SourceLineRange {\n\t// Input File Info\n\tprivate inputStartLine: number = 0;\n\tprivate inputEndLine: number = -1;\n\tprivate inputFileID: number;\n\n\t// Output File Info\n\tprivate outputStartLine: number = 0;\n\tprivate outputEndLine: number = -1;\n\n\tconstructor(input: number | SourceLineRange) {\n\t\tif (typeof input === 'number') {\n\t\t\t// Input is fileID\n\t\t\tthis.inputFileID = input;\n\t\t} else {\n\t\t\t// Input is other range to copy\n\t\t\tthis.inputStartLine = input.getInputStartLine();\n\t\t\tthis.inputEndLine = input.getInputEndLine();\n\t\t\tthis.inputFileID = input.getInputFileID();\n\t\t\tthis.outputStartLine = input.getOutputStartLine();\n\t\t\tthis.outputEndLine = input.getOutputEndLine();\n\t\t}\n\t}\n\n\tpublic getInputEndLine(): number {\n\t\treturn this.inputEndLine;\n\t}\n\n\tpublic setInputEndLine(endLine: number) {\n\t\tthis.inputEndLine = endLine;\n\t}\n\n\tpublic getInputFileID(): number {\n\t\treturn this.inputFileID;\n\t}\n\n\tpublic setInputFileID(fileID: number) {\n\t\tthis.inputFileID = fileID;\n\t}\n\n\tpublic getInputStartLine(): number {\n\t\treturn this.inputStartLine;\n\t}\n\n\tpublic setInputStartLine(startLine: number) {\n\t\tthis.inputStartLine = startLine;\n\t}\n\n\tpublic getOutputEndLine(): number {\n\t\treturn this.outputEndLine;\n\t}\n\n\tpublic setOutputEndLine(endLine: number) {\n\t\tthis.outputEndLine = endLine;\n\t}\n\n\tpublic getOutputStartLine(): number {\n\t\treturn this.outputStartLine;\n\t}\n\n\tpublic setOutputStartLine(startLine: number) {\n\t\tthis.outputStartLine = startLine;\n\t}\n\n\t/**\n\t * Shifts the output file start and end lines by a certain amount.\n\t * If the end line is -1, no need to change it.\n\t * \n\t * @param amount Amount by which the line numbers need to be shifted.\n\t */\n\tpublic shiftOutputLines(amount: number) {\n\t\tthis.outputStartLine += amount;\n\n\t\tif (this.outputEndLine > 0) {\n\t\t\tthis.outputEndLine += amount;\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the output file line number is present in this container.\n\t * \n\t * @param line The line number to be checked.\n\t * @return True if the line is present in the range or false otherwise.\n\t */\n\tpublic containsOutputLine(line: number): boolean {\n\t\tif (this.outputEndLine === -1) {\n\t\t\treturn line >= this.outputStartLine;\n\t\t}\n\n\t\treturn line >= this.outputStartLine && line <= this.outputEndLine;\n\t}\n\n\t/**\n\t * Checks if the input file line number is present in this container.\n\t * \n\t * @param line The line number to be checked.\n\t * @param ID ID of the input file that contains the line.\n\t * @return True if the line is present in the range or false otherwise.\n\t */\n\tpublic containsInputLine(line: number, ID: number): boolean {\n\t\tif (this.inputEndLine === -1) {\n\t\t\treturn line >= this.inputStartLine && ID === (this.inputFileID);\n\t\t}\n\n\t\treturn line >= this.inputStartLine && line <= this.inputEndLine && ID === (this.inputFileID);\n\t}\n\n\t/**\n\t * A helper method to compute the input file end line number based on the other line numbers.\n\t */\n\tpublic fixInputRangeBasedOnOutputRange() {\n\t\tthis.inputEndLine = this.outputEndLine - this.outputStartLine + this.inputStartLine;\n\t}\n\n\t/**\n\t * A helper method to compute the output file end line number based on the other line numbers.\n\t */\n\tpublic fixOutputRangeBasedOnInputRange() {\n\t\tthis.outputEndLine = this.inputEndLine - this.inputStartLine + this.outputStartLine;\n\t}\n}\n\n/**\n * Class used as a container of the file ID and the number of lines processed so far.\n */\nclass FileIDLinesPair {\n\tprivate lines: number;\n\n\tconstructor(private ID: number) {\n\t\tthis.lines = 0;\n\t}\n\n\tpublic getID(): number {\n\t\treturn this.ID;\n\t}\n\n\tpublic getLinesProcessed(): number {\n\t\treturn this.lines;\n\t}\n\n\tpublic increaseLinesProcessed(amount: number) {\n\t\tthis.lines += amount;\n\t}\n}\n\nexport class MapTable {\n\t// Map of SourceLineRanges\n\tprivate map: SourceLineRange[] = [];\n\n\t// Holds the EXPANSION records until processed\n\tprivate queueExpansion: ExpansionRecord[] = [];\n\n\t// Data needed to determine where copybook SourceLineRange should be inserted in the list\n\tprivate files: ArrayStack<FileIDLinesPair> = new ArrayStack<FileIDLinesPair>();\n\tprivate lookupIndex: number = 0;\n\n\t// Hashtable of File IDs and locations for fast lookup\n\tprivate fileTable: Map<number, FileIDRecord> = new Map<number, FileIDRecord>();\n\n\tconstructor() { }\n\n\t/**\n\t * Adds file information to the map.\n\t * \n\t * @param Tecord The File ID record.\n\t */\n\tpublic addFileInformation(record: FileIDRecord) {\n\t\tconst range = this.createOpenEndedSourceLineRange(record);\n\t\tconst file = new FileIDLinesPair(record.getSourceId());\n\n\t\t// This should mean that the new FILEID is a copy member\n\t\tif (!this.files.isEmpty()) {\n\t\t\tconst parentFile = this.files.peek();\n\n\t\t\tconst parentRange = this.map[this.map.length - 1];\n\t\t\tif (parentRange.getOutputStartLine() === range.getOutputStartLine()) {\n\t\t\t\tthis.map.pop();\n\t\t\t} else {\n\t\t\t\tparentRange.setOutputEndLine(range.getOutputStartLine() - 1);\n\t\t\t\tparentRange.setInputEndLine(parentRange.getOutputEndLine() - parentRange.getOutputStartLine() + parentRange.getInputStartLine());\n\n\t\t\t\t// Add 2 to account for the /copy statement that was commented out\n\t\t\t\tparentFile?.increaseLinesProcessed(parentRange.getInputEndLine() - parentRange.getInputStartLine() + 1);\n\t\t\t}\n\t\t}\n\n\t\tthis.map.push(range);\n\t\tthis.files.push(file);\n\t\tthis.fileTable.set(record.getSourceId(), record);\n\t}\n\n\t/**\n\t * Adds file information only to the file table. This is useful for processing the\n\t * compiler (000) processor block, since we don't need to keep track of line mappings\n\t * and FileIDLinesPair pairings.\n\t * \n\t * @param record The File ID record\n\t */\n\tpublic addFileToFileTable(record: FileIDRecord) {\n\t\tthis.fileTable.set(record.getSourceId(), record);\n\t}\n\n\t/**\n\t * Sets the correct bounds for the files in the map that were added using `AddFileInformation()`.\n\t * \n\t * @param record The File End record that contains the number of lines in the source.\n\t */\n\tpublic closeFile(record: FileEndRecord) {\n\t\t// Make sure that the stack is not empty\n\t\tif (this.files.isEmpty()) {\n\t\t\tthrow new Error(`A FILEEND event does not have a matching FILEID.\\n`\n\t\t\t\t+ `Faulty event: ${record.toString()}`);\n\t\t}\n\n\t\tconst file = this.files.pop();\n\n\t\t// Make sure that the FILEID matches the FILEEND on the stack\n\t\tif (file?.getID() !== (record.getFileId())) {\n\t\t\tthrow new Error(`The ID field of the FILEEND event does not match the ID field of the last FILEID event.\\n`\n\t\t\t\t+ `Mismatched IDs: \\t FILEID: ${file?.getID()}\\t FILEEND: ${record.toString()}`);\n\t\t}\n\n\t\tconst last = this.map[this.map.length - 1];\n\n\t\t// Make sure that last retrieved node matches the ID of the FILEEND\n\t\tif (last.getInputFileID() !== (record.getFileId())) {\n\t\t\tthrow new Error(`The ID field of the FILEEND event does not match the ID field of the last SourceLineRange.\\n`\n\t\t\t\t+ `Mismatched IDs: \\t FILEID: ${last.getInputFileID()}\\t FILEEND: ${record.toString()}`);\n\t\t}\n\n\t\tlet expansion = 0;\n\t\ttry {\n\t\t\texpansion = record.getExpansion();\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`Unable to parse the expansion field of the FILEEND record to an integer\\n`\n\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t}\n\n\t\t// If the expansion field of the FileEnd record is different than 0, use that information to set the bounds\n\t\tif (expansion !== 0) {\n\t\t\tlast.setInputEndLine(last.getInputStartLine() + expansion - file.getLinesProcessed() - 1);\n\t\t\tlast.setOutputEndLine(last.getOutputStartLine() + expansion - file.getLinesProcessed() - 1);\n\n\t\t\t// All files have been handled\n\t\t\tif (this.files.isEmpty()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst parent = this.files.peek()!;\n\t\t\tconst range = new SourceLineRange(parent.getID());\n\t\t\trange.setInputStartLine(parent.getLinesProcessed() + 1);\n\t\t\trange.setOutputStartLine(last.getOutputEndLine() + 1);\n\n\t\t\tthis.map.push(range);\n\t\t} else {\n\t\t\t// If the expansion field is 0, assume that the bounds go to the end of the file\n\t\t\t// defect 7526: according to Gina Whitney, the expansion field is only 0 if the copy file\n\t\t\t// is empty, or if we are working with 5.4 or 6.1 before the PTF that enabled expansion events\n\t\t\t// So we will handle this as if it were an empty include and that should work for both cases.\n\t\t\tlast.setInputEndLine(last.getInputStartLine());\n\t\t\tlast.setOutputStartLine(last.getOutputStartLine() - 1); // No output whatsoever, so point errors to commented out include\n\t\t\tlast.setOutputEndLine(last.getOutputStartLine());\n\n\t\t\t// All files have been handled -i.e. this was the end of the containing file\n\t\t\tif (this.files.isEmpty()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise this was the end of an included file\n\t\t\t// Now add an entry for the remainder of the containing file\n\t\t\tconst parent = this.files.peek()!;\n\t\t\tconst range = new SourceLineRange(parent.getID());\n\t\t\trange.setInputStartLine(parent.getLinesProcessed() + 1);\n\t\t\trange.setOutputStartLine(last.getOutputStartLine() + 1);\n\t\t\tthis.map.push(range);\n\t\t}\n\t}\n\n\t/**\n\t * Create a `SourceLineRange` with open bounds. The bounds will be set once the FileEnd record is read.\n\t * \n\t * @param record The FileID record that contains information about where the `SourceLineRange` should start.\n\t */\n\tprivate createOpenEndedSourceLineRange(record: FileIDRecord): SourceLineRange {\n\t\tlet line = 1;\n\t\ttry {\n\t\t\tline = record.getLine();\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`Unable to parse the line field of the FILEID record to an integer\\n`\n\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t}\n\n\t\tconst range = new SourceLineRange(record.getSourceId());\n\t\trange.setInputStartLine(1);\n\n\n\t\t// We need to take into consideration lines that have already been mapped to the output file.\n\t\t// line - parentFile.getLinesProcessed() === lines between the new /copy and the old /copy\n\t\tif (!this.files.isEmpty()) {\n\t\t\tconst parentRange = this.map[this.map.length - 1];\n\t\t\tconst parentFile = this.files.peek();\n\n\t\t\tif (parentFile) {\n\t\t\t\trange.setOutputStartLine(parentRange.getOutputStartLine() + line - parentFile.getLinesProcessed());\n\t\t\t}\n\t\t} else {\n\t\t\trange.setOutputStartLine(1);\n\t\t}\n\n\t\treturn range;\n\t}\n\n\tpublic addExpansionRecord(record: ExpansionRecord) {\n\t\tthis.queueExpansion.push(record);\n\t}\n\n\tprivate getSourceLineRangeForOutputLine(line: number): SourceLineRange | undefined {\n\t\tfor (const range of this.map) {\n\t\t\tif (range.containsOutputLine(line)) {\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate optimizedSourceLineRangeLookup(line: number): SourceLineRange | undefined {\n\t\t// Start searching from last known position\n\t\tfor (let i = this.lookupIndex; i < this.map.length; i++) {\n\t\t\tconst range = this.map[i];\n\t\t\tif (range.containsOutputLine(line)) {\n\t\t\t\tthis.lookupIndex = i;\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\n\t\t// If not found, wrap around and search from beginning\n\t\tfor (let i = 0; i < this.lookupIndex && i < this.map.length; i++) {\n\t\t\tconst range = this.map[i];\n\t\t\tif (range.containsOutputLine(line)) {\n\t\t\t\tthis.lookupIndex = i;\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getSourceLineRangeForInputLine(line: number, id: number): SourceLineRange | undefined {\n\t\tfor (const range of this.map) {\n\t\t\tif (range.containsInputLine(line, id)) {\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate shiftRangesBy(amount: number, atIndex: number) {\n\t\tfor (let i = atIndex; i < this.map.length; i++) {\n\t\t\t(this.map[i]).shiftOutputLines(amount);\n\t\t}\n\t}\n\n\tprivate handleExpansion(record: ExpansionRecord) {\n\t\tconst expansionRange = this.createSourceLineRange(record);\n\t\tlet expandedSource: SourceLineRange | undefined;\n\n\t\t// Handle the case where the expansion comes at the end of file (right after the last range)\n\t\tif (expansionRange.getOutputStartLine() - (this.map[this.map.length - 1]).getOutputEndLine() === 1) {\n\t\t\tif (expansionRange.getInputStartLine() === expansionRange.getInputEndLine()) {\n\t\t\t\tthis.map.push(expansionRange);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// 05/25/09: There are currently no regular expansion events where the input start and input end lines are different,\n\t\t// so there is currently no implementation to handle such events, \n\t\t// and this code should only be reached by negative expansion events.\n\t\telse if (expansionRange.getInputStartLine() !== expansionRange.getInputEndLine() || (expansionRange.getOutputStartLine() === 0 && expansionRange.getOutputEndLine() === 0)) {\n\t\t\texpandedSource = this.getSourceLineRangeForInputLine(expansionRange.getInputStartLine(), expansionRange.getInputFileID());\n\t\t} else {\n\t\t\texpandedSource = this.getSourceLineRangeForOutputLine(expansionRange.getOutputStartLine());\n\t\t}\n\n\t\tthis.splitExpandedSourceLineRange(expansionRange, expandedSource!);\n\t}\n\n\tprivate splitExpandedSourceLineRange(expansion: SourceLineRange, expanded: SourceLineRange) {\n\t\tconst index = this.map.indexOf(expanded);\n\t\tconst isExpansionNegative = expansion.getOutputStartLine() === 0 && expansion.getOutputEndLine() === 0;\n\t\tconst expansionSize = (isExpansionNegative) ?\n\t\t\texpansion.getInputStartLine() - expansion.getInputEndLine() - 1 :\n\t\t\texpansion.getOutputEndLine() - expansion.getOutputStartLine() + 1;\n\n\n\t\t// Handle a negative expansion event\n\t\tif (isExpansionNegative) {\n\t\t\tif (expansion.getInputStartLine() === expanded.getInputStartLine() && expansion.getInputEndLine() === expanded.getInputEndLine()) {\n\t\t\t\t// Assume 1 to 1 mapping\n\t\t\t\tthis.map.splice(index, 1);\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index);\n\t\t\t} else if (expansion.getInputStartLine() === expanded.getInputStartLine()) {\n\t\t\t\texpanded.setInputStartLine(expansion.getInputEndLine() + 1);\n\t\t\t\texpanded.setOutputStartLine(expanded.getOutputStartLine() + Math.abs(expansionSize));\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index);\n\t\t\t} else if (expansion.getInputEndLine() === expanded.getInputEndLine()) {\n\t\t\t\t//Assume 1 to 1 mapping\n\t\t\t\texpanded.setInputEndLine(expansion.getInputStartLine() - 1);\n\t\t\t\texpanded.setOutputEndLine(expanded.getOutputEndLine() - Math.abs(expansionSize));\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index + 1);\n\t\t\t} else {\n\t\t\t\tconst extraRange = new SourceLineRange(expanded);\n\n\t\t\t\texpanded.setInputEndLine(expansion.getInputStartLine() - 1);\n\t\t\t\texpanded.fixOutputRangeBasedOnInputRange();\n\n\t\t\t\textraRange.setInputStartLine(expansion.getInputEndLine() + 1);\n\t\t\t\textraRange.setOutputStartLine(expanded.getOutputEndLine() + Math.abs(expansionSize) + 1);\n\n\t\t\t\tthis.map.splice(index + 1, 0, extraRange);\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index + 1);\n\t\t\t}\n\t\t} else if (expanded.getOutputStartLine() === expansion.getOutputStartLine()) {\n\t\t\t// Only supports expansions where expansion.getInputStartLine() === expansion.getInputEndLine()\n\n\t\t\t// Insert the expansion before the current range\n\t\t\t// (to keep the output ranges sorted), and then\n\t\t\t// shift the output ranges by amount of expansion.\n\t\t\tif (expansion.getInputStartLine() === expansion.getInputEndLine()) {\n\t\t\t\tthis.map.splice(index, 0, expansion);\n\t\t\t\tthis.shiftRangesBy(expansionSize, index + 1);\n\n\t\t\t}\n\t\t}\n\n\t\t// Not necessary - handled the same way as generic case:\n\t\t// else if(expanded.getOutputEndLine() === expansion.getOutputEndLine()){\n\t\t// }\n\n\t\t// Handle generic case\n\t\telse {\n\t\t\t// Only supports expansions where expansion.getInputStartLine() === expansion.getInputEndLine()\n\n\t\t\t// Split the current range in half at the point of expansion's output start,\n\t\t\t// insert the expansion between the two halves, and shift the outputs of the\n\t\t\t// remaining ranges (starting with the second half) by the mount of the expansion.\n\t\t\tconst extraRange = new SourceLineRange(expanded);\n\n\t\t\texpanded.setOutputEndLine(expansion.getOutputStartLine() - 1);\n\t\t\texpanded.fixInputRangeBasedOnOutputRange();\n\n\t\t\tthis.map.splice(index + 1, 0, expansion);\n\n\t\t\textraRange.setInputStartLine(expanded.getInputEndLine() + 1);\n\t\t\textraRange.setOutputStartLine(expanded.getOutputEndLine() + 1);\n\t\t\tthis.map.splice(index + 2, 0, extraRange);\n\n\t\t\tthis.shiftRangesBy(expansionSize, index + 2);\n\t\t}\n\t}\n\n\tprivate createSourceLineRange(record: ExpansionRecord): SourceLineRange {\n\t\tconst range = new SourceLineRange(record.getInputFileID());\n\n\t\tlet iStart = 0, iEnd = 0, oStart = 0, oEnd = 0;\n\t\ttry {\n\t\t\tiStart = record.getInputLineStart();\n\t\t\tiEnd = record.getInputLineEnd();\n\t\t\toStart = record.getOutputLineStart();\n\t\t\toEnd = record.getOutputLineEnd();\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`Unable to parse the fields of the EXPANSION record to integers\\n`\n\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t}\n\n\t\trange.setInputStartLine(iStart);\n\t\trange.setInputEndLine(iEnd);\n\t\trange.setOutputStartLine(oStart);\n\t\trange.setOutputEndLine(oEnd);\n\n\t\treturn range;\n\t}\n\n\t/**\n\t * Returns the QSYSEventsFileFileIDRecord corresponding to a file ID.\n\t * \n\t * @param ID The ID of the file to look for.\n\t * @return The FileIDRecord corresponding to the file ID if it exists in the table, `undefined` otherwise.\n\t */\n\tpublic getFileIDRecordForFileID(ID: number): FileIDRecord | undefined {\n\t\treturn this.fileTable.get(ID);\n\t}\n\n\tpublic getFileLocationForFileID(ID: number): string | undefined {\n\t\tconst fileRecord = this.getFileIDRecordForFileID(ID);\n\n\t\tif (fileRecord) {\n\t\t\treturn fileRecord.getFileName();\n\t\t}\n\t}\n\n\t/**\n\t * Modifies the information contained in the Error record based on the available map.\n\t * \n\t * @param record The Error record to be modified.\n\t */\n\tpublic modifyErrorInformation(record: ErrorInformationRecord) {\n\t\tconst statementLine = record.getStmtLine();\n\t\tconst range = this.optimizedSourceLineRangeLookup(statementLine);\n\n\t\tif (!range) {\n\t\t\tthrow new Error(`The line number on which ERROR occurs could not be found in the map.\\n`\n\t\t\t\t+ `Faulty event: ${record.toString()}`);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\trecord.setStmtLine(this.getLineFromSourceLineRange(range, statementLine));\n\t\t\t\trecord.setFileId(range.getInputFileID());\n\n\t\t\t\tconst startLineNumber = record.getStartErrLine();\n\t\t\t\trecord.setStartErrLine(this.getLineFromSourceLineRange(range, startLineNumber));\n\n\t\t\t\tconst endLineNumber = record.getEndErrLine();\n\t\t\t\trecord.setEndErrLine(this.getLineFromSourceLineRange(range, endLineNumber));\n\n\t\t\t\trecord.setFileName((this.fileTable.get(range.getInputFileID())!).getFileName());\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(`Unable to parse the line fields of the ERROR record to integers\\n`\n\t\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t\t}\n\n\t\t}\n\t}\n\n\t/**\n\t * Calculates the line number based on the initial number and how many lines where \n\t * shifted in the expansion process.\n\t * \n\t * @param range `SourceLineRange` that contains mapping information.\n\t * @param initial The line number.\n\t * @return The new line number.\n\t */\n\tprivate getLineFromSourceLineRange(range: SourceLineRange, initial: number): number {\n\t\tif (!range) {\n\t\t\treturn initial;\n\t\t}\n\n\t\tif (range.getInputEndLine() - range.getInputStartLine() === range.getOutputEndLine() - range.getOutputStartLine()) {\n\t\t\treturn initial - range.getOutputStartLine() + range.getInputStartLine();\n\t\t}\n\t\t// Temporary fix for the problem where all errors in the last range get mapped to getInputStartLine\n\t\t// when the last range has open bounds\n\t\telse if (range.getInputEndLine() === -1 && range.getOutputEndLine() === -1) {\n\t\t\treturn initial - range.getOutputStartLine() + range.getInputStartLine();\n\t\t} else {\n\t\t\treturn range.getInputStartLine();\n\t\t}\n\t}\n\n\tpublic finalizeMap() {\n\t\tif (!this.files.isEmpty()) {\n\t\t\tthrow new Error(\n\t\t\t\t`One or more FILEID records do not have matching FILEEND records\\n`\n\t\t\t\t+ `List of outstanding FILEID records: ${JSON.stringify(this.files)}`);\n\t\t}\n\n\t\tthis.queueExpansion.forEach(expansion => {\n\t\t\tthis.handleExpansion(expansion);\n\t\t});\n\n\t\t// This handles errors at line 0 of the main source file.\n\t\t// Those are usually sev 40 errors.\n\t\tconst header = new SourceLineRange(1);\n\t\theader.setInputStartLine(0);\n\t\theader.setInputEndLine(0);\n\t\theader.setOutputStartLine(0);\n\t\theader.setOutputEndLine(0);\n\n\t\tthis.map.unshift(header);\n\t}\n\n\t/**\n\t * Prints the map.\n\t */\n\tpublic toString(): string {\n\t\tlet buffer = '';\n\n\t\tthis.map.forEach(range => {\n\t\t\tbuffer += `${range.getInputFileID()}: [${range.getInputStartLine()},${range.getInputEndLine()}]`\n\t\t\t\t+ `-->[${range.getOutputStartLine()},${range.getOutputEndLine()}]\\n`;\n\t\t});\n\n\t\treturn buffer;\n\t}\n\n\t/**\n\t * Get all file locations.\n\t */\n\tpublic getAllFileIDRecords(): FileIDRecord[] {\n\t\tif (!this.fileTable || this.fileTable.size === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst fileIDRecords = new Set<FileIDRecord>();\n\n\t\tfor (let key of this.fileTable.keys()) {\n\t\t\tconst fileIDRecord = this.fileTable.get(key)!;\n\t\t\tfileIDRecords.add(fileIDRecord);\n\t\t}\n\n\t\treturn Array.from(fileIDRecords.values());\n\t}\n}\n\ninterface Stack<T> {\n\tpush(item: T): void;\n\tpop(): T | undefined;\n\tpeek(): T | undefined;\n\tisEmpty(): boolean;\n\tsize(): number;\n}\n\nclass ArrayStack<T> implements Stack<T> {\n\tprivate stack: T[] = [];\n\n\tpush(item: T): void {\n\t\tthis.stack.push(item);\n\t}\n\n\tpop(): T | undefined {\n\t\treturn this.stack.pop();\n\t}\n\n\tpeek(): T | undefined {\n\t\treturn this.stack[this.stack.length - 1];\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this.stack.length === 0;\n\t}\n\n\tsize(): number {\n\t\treturn this.stack.length;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from './record/IRecordT';\nimport { TimestampRecord } from './record/TimestampRecord';\nimport { ProcessorRecord } from './record/ProcessorRecord';\nimport { FileIDRecord } from './record/FileIDRecord';\nimport { IProcessor } from './IProcessor';\nimport { ISequentialFileReader } from './ISequentialFileReader';\nimport { IMarkerCreator } from './IMarkerCreator';\nimport { ErrorInformationRecord } from './record/ErrorInformationRecord';\nimport { FileEndRecord } from './record/FileEndRecord';\nimport { ExpansionRecord } from './record/ExpansionRecord';\nimport { ExpansionProcessor } from './ExpansionProcessor';\nimport normalize from 'path-normalize';\n\nclass SourceFile {\n constructor(private location: string, private browseMode: boolean) { }\n\n public getLocation(): string {\n return this.location;\n }\n\n public isReadOnly(): string {\n return this.browseMode.toString();\n }\n\n public setReadOnly(value: boolean) {\n // A member should be opened in browse mode\n this.browseMode = value;\n }\n}\n\nclass LookAheadReader implements ISequentialFileReader {\n private iSequentialFileReader: ISequentialFileReader;\n private peakLine: string | undefined;\n\n constructor(iSequentialFileReader: ISequentialFileReader) {\n this.iSequentialFileReader = iSequentialFileReader;\n }\n\n readNextLine(): string | undefined {\n if (this.peakLine) {\n const nextLine = this.peakLine;\n this.peakLine = undefined;\n\n return nextLine;\n } else {\n return this.iSequentialFileReader.readNextLine();\n }\n }\n\n peakNextRecordType() {\n this.peakLine = this.iSequentialFileReader.readNextLine();\n return this.peakLine?.split(/\\s+/).filter(token => token !== \"\")[0];\n }\n}\n\nexport class Parser {\n private _loggingEnabled: boolean = false;\n private exception: Error | undefined;\n private processor: IProcessor | undefined;\n private lastOutputFile: SourceFile | undefined;\n private currentOutputFile: SourceFile | undefined;\n\n // Map of File ID to SourceFile\n private sourceTable: Map<number, SourceFile>;\n\n constructor() {\n this.sourceTable = new Map<number, SourceFile>();\n }\n\n private getUntilTheEndOfTheLine(startIndex: number, st: string[]): string {\n let message = st[startIndex++];\n while (startIndex < st.length) {\n message = message.concat(' ');\n let curr_msg = st[startIndex++];\n message = message.concat(curr_msg);\n }\n return message;\n }\n\n /**\n * Enable or disable logging.\n *\n * @param {boolean} enable true to enable or false to disable logging\n */\n loggingEnabled(enable: boolean) {\n this._loggingEnabled = enable;\n }\n\n private log(content: string) {\n if (this._loggingEnabled) {\n console.log(content);\n }\n }\n\n /**\n * To parse an eventf generated by an IBM i compiler. \n * @param fileReader a generic reader implementing {@link ISequentialFileReader}. \n * @param markerCreator optionally passing in an object implementing {@link IMarkerCreator}\n * allows the parser to call this object back with each error. The original source\n * file name and error location and error message will be in the information provided\n * on the callback\n */\n parse(fileReader: ISequentialFileReader, markerCreator?: IMarkerCreator) {\n let word: string;\n let fileId: number;\n\n if (!this.processor) {\n this.processor = new ExpansionProcessor();\n }\n // Allows processor to initialize prior to parsing\n this.processor?.doPreProcessing();\n\n const reader = new LookAheadReader(fileReader);\n let lineText = reader.readNextLine();\n\n while (lineText) {\n let st = lineText.split(/\\s+/).filter(token => token !== \"\");\n let i = 0\n\n while (i < st.length) {\n word = st[i++];\n\n if (word === IRecordT.ERROR_INFORMATION) {\n const version = parseInt(st[i++]);\n fileId = parseInt(st[i++]);\n\n let fileProcessed = this.sourceTable.get(fileId);\n if (!fileProcessed) {\n // If file ID is '000' we can assume that it is the second file after the '999' output file\n if (fileId === 0) {\n let location001 = this.sourceTable.get(1);\n if (location001) {\n fileProcessed = location001;\n } else {\n fileProcessed = new SourceFile('', false);\n }\n } else {\n fileProcessed = new SourceFile('', false);\n }\n }\n\n const annotationClass = parseInt(st[i++]);\n const line = parseInt(st[i++]);\n const lineStart = parseInt(st[i++]);\n const charStart = parseInt(st[i++]);\n const lineEnd = parseInt(st[i++]);\n const charEnd = parseInt(st[i++]);\n const id = st[i++];\n const severityText = st[i++];\n const severity = parseInt(st[i++]);\n\n const totalMessageLen = parseInt(st[i++]);\n const message = this.getUntilTheEndOfTheLine(i, st);\n\n // Previous implementation used the location length to determine how many records to \n // read in. This requires NLS process to account for differences in character length \n // between the encoding in the original EVENTF and the current one being parsed.\n // To avoid this, we simply read all subsequent records that are of the continued type\n //\n // let msgToken = st.nextToken('\\n\\r\\f');\n // let msgTokenNl = new StringNL(msgToken, ccsid, true);\n\n // msgTokenNl = msgTokenNl.trim();\n // message = msgTokenNl.convertFromVisualToLogical(true);\n // let messageLenCorrect = true;\n // if (msgTokenNl.getByteLength() > totalMessageLen) {\n // message = msgTokenNl.substring(0, totalMessageLen).convertFromVisualToLogical(true);\n // } else {\n // while ((msgTokenNl.getByteLength() < totalMessageLen) && messageLenCorrect) {\n // lineText = reader.readNextLine();\n // if (lineText === null) {\n // let log = 'EventsFileParser: ' + MessageFormat.format(Messages.EventsFileParser_Incomplete_Msg, totalMessageLen, totalMessageLen, message);\n // this.LOGGER.info(log);\n // messageLenCorrect = false;\n // msgToken = '';\n // break;\n // }\n // let stcont = new StringTokenizer(lineText);\n // msgToken = stcont.nextToken('\\n\\r\\f');\n // msgTokenNl = new StringNL(msgToken, ccsid, true);\n // stcont = new StringTokenizer(msgToken);\n // let lineType = stcont.get(i++);\n // if (lineType === (RecordType.TIMESTAMP) || lineType === (RecordType.PROCESSOR) || lineType === (RecordType.FILE_ID) || lineType === (RecordType.FILE_CONT) || lineType === (RecordType.FILE_END) || lineType === (RecordType.ERROR_INFORMATION) || lineType === (RecordType.PROGRAM) || lineType === (RecordType.MAP_DEFINE) || lineType === (RecordType.MAP_END) || lineType === (RecordType.MAP_START) || lineType === (RecordType.FEEDBACK_CODE)) {\n // messageLenCorrect = false;\n // break;\n // }\n // readMsgLen += msgTokenNl.getByteLength();\n // message += ' ' + msgTokenNl.trim().convertFromVisualToLogical(true);\n // }\n // }\n\n const record = new ErrorInformationRecord(version, fileId, annotationClass, line, lineStart, charStart,\n lineEnd, charEnd, id, severityText, severity, totalMessageLen, message);\n record.setFileName(fileProcessed.getLocation());\n\n if (this.processor) {\n this.processor.processErrorRecord(record);\n }\n\n // if (!messageLenCorrect) {\n // st = new StringTokenizer(msgToken);\n // st = msgToken.split(\" \")\n // continue;\n // }\n\n break;\n } else if (word === (IRecordT.FILE_ID)) {\n let browseMode = false;\n const version = parseInt(st[i++]);\n fileId = parseInt(st[i++]);\n const lineNumber = parseInt(st[i++]);\n const locationLength = parseInt(st[i++]);\n let location = lineText.substring(28);\n\n this.log(`EventsFileParser: location from line 1 = ${location}`);\n let nextRecordType = reader.peakNextRecordType();\n while (nextRecordType === IRecordT.FILE_CONT) {\n lineText = reader.readNextLine();\n if (lineText) {\n st = lineText.split(' ');\n location += (lineText.substring(28));\n this.log(`EventsFileParser: location from line 1 = ${location}`);\n nextRecordType = reader.peakNextRecordType();\n } else {\n throw new Error('Events file has incorrect format. End of file encountered before location length satisfied.');\n }\n }\n\n // Attempt to parse the FILEID string backwards in order to find the timestamp and temp flag\n // Timestamp should only be made of digits if it was parsed correctly. Otherwise, just ignore it.\n let timestamp = location.substring(location.length - 16, location.length - 2);\n try {\n parseInt(timestamp);\n } catch (e: any) {\n timestamp = '';\n }\n const tempFlag = parseInt(location.charAt(location.length - 1));\n\n // Makes sure that the Temp Flag is the last character in the FILEID event and that it is preceded by a space\n const isSpaceBeforeTempFlag = location.charAt(location.length - 2) === ' ';\n if (tempFlag === 1 && isSpaceBeforeTempFlag) {\n browseMode = true;\n } else {\n browseMode = false;\n }\n\n location = location.substring(0, location.length - 17);\n location = this.resolveRelativePath(location);\n\n // If this file was the output file of the previous block, then it should be opened in Browse Mode\n const fileEntry = new SourceFile(location, browseMode);\n if ((this.lastOutputFile && location === (this.lastOutputFile.getLocation()))\n || this.currentOutputFile && location === (this.currentOutputFile.getLocation())) {\n fileEntry.setReadOnly(true);\n }\n\n // If the file ID is 999, then this is the new output file\n if (fileId === 999) {\n if (!this.lastOutputFile) {\n this.lastOutputFile = this.currentOutputFile = fileEntry;\n } else {\n this.lastOutputFile = this.currentOutputFile;\n this.currentOutputFile = fileEntry;\n }\n }\n\n this.sourceTable.set(fileId, fileEntry);\n\n if (this.processor) {\n // Pass FILEID information to processor\n const record = new FileIDRecord(version, fileId, lineNumber, locationLength, location, timestamp.toString(), tempFlag);\n try {\n this.processor.processFileIDRecord(record);\n } catch (e: any) {\n const errorMessage = e.message ? e.message : e;\n this.log(errorMessage);\n this.exception = new Error(errorMessage);\n }\n }\n\n break;\n } else if (word === (IRecordT.FILE_END)) {\n // Pass FILEEND information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const fileId = parseInt(st[i++]);\n const expansion = parseInt(st[i++]);\n const record = new FileEndRecord(version, fileId, expansion);\n\n try {\n this.processor?.processFileEndRecord(record);\n } catch (e: any) {\n const errorMessage = e.message ? e.message : e;\n this.log(errorMessage);\n this.exception = new Error(errorMessage);\n }\n }\n\n break;\n } else if (word === (IRecordT.EXPANSION)) {\n // Pass EXPANSION information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const inputFileID = parseInt(st[i++]);\n const inputLineStart = parseInt(st[i++]);\n const inputLineEnd = parseInt(st[i++]);\n const outputFileID = parseInt(st[i++]);\n const outputLineStart = parseInt(st[i++]);\n const outputLineEnd = parseInt(st[i++]);\n const record = new ExpansionRecord(version, inputFileID, inputLineStart, inputLineEnd, outputFileID, outputLineStart, outputLineEnd);\n this.processor?.processExpansionRecord(record);\n }\n\n break;\n } else if (word === (IRecordT.TIMESTAMP)) {\n // Pass TIMESTAMP information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const timestamp = st[i++];\n let record = new TimestampRecord(version, timestamp);\n this.processor?.processTimestampRecord(record);\n }\n\n break;\n } else if (word === (IRecordT.PROCESSOR)) {\n // Pass PROCESSOR information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const outputId = parseInt(st[i++]);\n const lineClass = parseInt(st[i++]);\n let record = new ProcessorRecord(version, outputId, lineClass);\n\n try {\n this.processor?.processProcessorRecord(record);\n } catch (e: any) {\n const errorMessage = e.message ? e.message : e;\n this.log(errorMessage);\n this.exception = new Error(errorMessage);\n }\n }\n\n break;\n } else {\n // The following Events are being ignored since they are not used.\n // If needed, we could parse those Events and pass them to an IISeriesEventsFileProcessor.\n if (word === (IRecordT.PROGRAM) || word === (IRecordT.MAP_DEFINE) || word === (IRecordT.MAP_END)\n || word === (IRecordT.MAP_START) || word === (IRecordT.FEEDBACK_CODE) || word.trim().length === 0) {\n break;\n } else {\n throw new Error(`Events file has incorrect format. Unexpected line type. LT=${lineText}`);\n }\n }\n }\n\n if (lineText) {\n lineText = reader.readNextLine();\n }\n }\n\n if (this.processor) {\n // Allows processor to consume the information after completion of parsing and writing of markers\n try {\n this.processor?.doPostProcessing();\n } catch (e: any) {\n this.exception = new Error(e.message ? e.message : e)\n }\n }\n\n if (markerCreator) {\n const errors = this.getAllErrors();\n errors.forEach(record => {\n const sourceFile = this.sourceTable.get(record.getFileId());\n\n if (sourceFile) {\n markerCreator.createMarker(record, record.getFileName(), sourceFile.isReadOnly());\n }\n });\n }\n }\n\n private resolveRelativePath(location: string) {\n // Normalize the location in case the location is a relative path\n location = normalize(location).toString();\n\n // After normalization, / will be change to \\ for windows path,\n // so have to change it back.\n location = location.replace(/\\\\/g, '/');\n return location;\n }\n\n public getException(): Error | undefined {\n return this.exception;\n }\n\n public setProcessor(processor: IProcessor) {\n this.processor = processor;\n }\n\n /**\n * After all records in the Events File are processed, this method is called to\n * return all the errors from all the processor blocks (ProcessorBlock) of the\n * Events File. Since each ProcessorBlock contains an array of errors, the result\n * will be flattened to an array.\n * \n * @return An array of all parsed errors from all processor blocks of the Events File.\n */\n public getAllErrors(): ErrorInformationRecord[] {\n if (this.processor) {\n const nestedErrors = this.processor?.getAllErrors();\n let allErrors: ErrorInformationRecord[] = [];\n allErrors = allErrors.concat(...nestedErrors);\n\n return allErrors;\n } else {\n return [];\n }\n }\n\n /**\n * Get all file ID records.\n * \n * @return An array of all file ID records.\n */\n public getAllFileIDRecords(): FileIDRecord[] {\n if (this.processor) {\n return this.processor.getAllFileIDRecords();\n } else {\n return [];\n }\n }\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nimport { FileEndRecord } from \"./record/FileEndRecord\";\nimport { FileIDRecord } from \"./record/FileIDRecord\";\nimport { MapTable } from \"./MapTable\";\nimport { ProcessorRecord } from \"./record/ProcessorRecord\";\n\nexport class ProcessorBlock {\n // Default File ID for the input file of the processor block\n readonly INPUT_FILE_ID: number = 1;\n\n // Queue of all errors in this processor block\n private errors: ErrorInformationRecord[];\n\n // Input to the processor block\n private inputFile: FileIDRecord | undefined;\n\n // Output of the processor block\n private outputFile: FileIDRecord | undefined;\n\n // The PROCESSOR record\n private currentProcessor: ProcessorRecord;\n\n // The mapping table that keeps track of all copybooks and EXPANSIONs\n private mappingTable: MapTable;\n\n // Link to the previous processor block in the events File\n private previousProcessorBlock: ProcessorBlock | undefined;\n\n // Flags if the current processor block contains any EXPANSION events or not\n private containsExpansionEvents: boolean = false;\n\n // Needed for events files that contain multiple events files that have been combined into one (as done in iProjects).\n // Should get set to true for each first PROCESSOR in each \"sub\" events file.\n // The scope of this variable is only the current \"sub\" events file.\n private isFirstInEventsFile: boolean = false;\n\n // Set to true if current events file requires and supports mappings.\n // See ExpansionProcessor.isMappingSupportedByAnyEventsFiles() for more details.\n private mappingSupported: boolean = false;\n\n // Keep track of the number of lines in the output file\n private totalNumberOfLinesInOutputFile: number = 0;\n\n // Keep track of the total number of lines in all the input files\n private totalNumberOfLinesInInputFiles: number = 0;\n\n constructor(record: ProcessorRecord) {\n this.currentProcessor = record;\n this.mappingTable = new MapTable();\n this.errors = [];\n }\n\n public getInputFile(): FileIDRecord | undefined {\n return this.inputFile;\n }\n\n /**\n * Get the input file of the first processor block of the current events file.\n * \n * @return the input file of the first processor block of the current events file.\n */\n getInitialInputFile(): FileIDRecord | undefined {\n if (this.previousProcessorBlock && !this.getIsFirstInEventsFile()) {\n return this.previousProcessorBlock.getInitialInputFile();\n }\n return this.getInputFile();\n }\n\n public setInputFile(file: FileIDRecord) {\n this.inputFile = file;\n }\n\n public addFile(file: FileIDRecord) {\n this.mappingTable.addFileInformation(file);\n }\n\n public closeFile(file: FileEndRecord) {\n if (this.outputFile) {\n // Keep track of the total number of lines in all the input files\n if (!(file.getFileId() === (this.outputFile.getSourceId()))) {\n this.increaseTotalNumberOfLinesInInputFiles(file.getExpansion());\n } else {\n // Keep track of the number of lines in the output file\n this.setTotalNumberOfLinesInOutputFile(file.getExpansion());\n return;\n }\n\n this.mappingTable.closeFile(file);\n }\n }\n\n public getOutputFile(): FileIDRecord | undefined {\n return this.outputFile;\n }\n\n public setOutputFile(file: FileIDRecord) {\n this.outputFile = file;\n }\n\n public getMappingTable(): MapTable {\n return this.mappingTable;\n }\n\n public isProcessorIDZero() {\n const procID = this.currentProcessor.getOutputId();\n return procID === 0;\n }\n\n public addErrorInformation(record: ErrorInformationRecord) {\n this.errors.push(record);\n }\n\n public processorEnded() {\n this.mappingTable.finalizeMap();\n }\n public setPreviousProcessor(previous: ProcessorBlock) {\n this.previousProcessorBlock = previous;\n }\n\n public setContainsExpansionEvents(containsExpansionEvents: boolean) {\n this.containsExpansionEvents = containsExpansionEvents;\n }\n\n public getContainsExpansionEvents(): boolean {\n return this.containsExpansionEvents;\n }\n\n public increaseTotalNumberOfLinesInInputFiles(numberOfLines: number) {\n this.totalNumberOfLinesInInputFiles += numberOfLines;\n }\n\n public getTotalNumberOfLinesInInputFiles(): number {\n return this.totalNumberOfLinesInInputFiles;\n }\n\n public setTotalNumberOfLinesInOutputFile(numberOfLines: number) {\n this.totalNumberOfLinesInOutputFile = numberOfLines;\n }\n\n public getTotalNumberOfLinesInOutputFile(): number {\n return this.totalNumberOfLinesInOutputFile;\n }\n\n public getPreviousProcessorBlock(): ProcessorBlock | undefined {\n return this.previousProcessorBlock;\n }\n\n public modifyErrorInformation(error: ErrorInformationRecord) {\n // Map the error lines and location to the input file of this current PROCESSOR\n this.mappingTable.modifyErrorInformation(error);\n\n // If another processor was invoked, map the errors back to its input file.\n // Only modify error information if there was a previous processor and the error \n // points to the current input file. The FileId of the error was changed in \n // modifyErrorInformation, so need to compare with location rather than ID.\n // Since this method is only called on a _previousProcessorBlock, this is not\n // the compiler processor block and getInputFile() should not return null.\n let inputFileLocation = '';\n let inputFileId = -1;\n\n const inputFile = this.getInputFile();\n if (inputFile) {\n inputFileLocation = inputFile.getFileName();\n inputFileId = inputFile.getSourceId();\n }\n\n if (this.previousProcessorBlock && !this.getIsFirstInEventsFile() && this.isMappingSupported()\n && (error.getFileId() === (inputFileId) || error.getFileName() === (inputFileLocation))) {\n this.previousProcessorBlock.modifyErrorInformation(error);\n }\n }\n\n /**\n * Sets whether the current processor block is the first one in the current \"sub\" events file\n * (needed for events file that contains multiple events files that have been combined into one).\n * \n * @param isFirstInEventsFile\n */\n public setFirstInEventsFile(isFirstInEventsFile: boolean) {\n this.isFirstInEventsFile = isFirstInEventsFile;\n }\n\n /**\n * Returns whether the current processor block is the first one in the current \"sub\" events file\n * (needed for events file that contains multiple events files that have been combined into one).\n * \n * @return True if the current processor block is the first one in the current \"sub\" events file, false otherwise.\n */\n public getIsFirstInEventsFile(): boolean {\n return this.isFirstInEventsFile;\n }\n\n public setMappingSupported(mappingSupported: boolean) {\n this.mappingSupported = mappingSupported;\n }\n\n public isMappingSupported(): boolean {\n return this.mappingSupported;\n }\n\n /**\n * Determines whether a file in the current processor block is read-only or not.\n * A file is considered read-only if it is a temporary file created by an SQL pre-compiler.\n * \n * @param fileRecord The FileIDRecord of the file to check.\n * @return True if the file is read-only, false otherwise.\n */\n public isFileReadOnly(fileIDRecord: FileIDRecord): boolean {\n // True if the temporary flag of the file is 1 (indicating temp member)\n // or the file is the same as the output file of the current or previous processor block\n return fileIDRecord.getFlag() === 1\n || ((this.previousProcessorBlock && !this.getIsFirstInEventsFile())\n && this.previousProcessorBlock.getOutputFile() !== undefined\n && fileIDRecord.getFileName() === (this.previousProcessorBlock.getOutputFile()!.getFileName()))\n || (this.getOutputFile() !== undefined && fileIDRecord.getFileName() === (this.getOutputFile()!.getFileName()));\n }\n\n /**\n * This method is used by the test for event file processing.\n * \n * This method returns all errors in this and all previous processor blocks. \n * Since each ProcessorBlock contains an array of errors, the result will be \n * returned as an array of those arrays.\n * \n * This method is called by ExpansionProcessor.getAllErrors().\n * \n * @return An array of arrays of all parsed errors from the current and all\n * previous processor blocks (one list for each processor block).\n */\n public getAllProcessorErrors(): ErrorInformationRecord[][] {\n let allPrevErrs: ErrorInformationRecord[][] = [];\n\n if (this.previousProcessorBlock) {\n allPrevErrs = this.previousProcessorBlock.getAllProcessorErrors();\n }\n\n allPrevErrs.push(this.errors);\n return allPrevErrs;\n }\n\n public resolveFileNamesForAllErrors() {\n if (this.previousProcessorBlock) {\n this.previousProcessorBlock.resolveFileNamesForAllErrors();\n }\n\n this.errors.forEach(error => {\n this.resolveFileNameAndDetermineIfReadOnly(error);\n });\n }\n\n /**\n * Maps the error back to the original input member and resolves the \n * file name of that member. If mappings are not supported, checks and \n * returns whether that member is read-only.\n * \n * @param error The ErrorInformationRecord to resolve.\n * @return True if mappings are not supported and the member that the\n * error points to is read-only, false otherwise.\n */\n public resolveFileNameAndDetermineIfReadOnly(error: ErrorInformationRecord): boolean {\n let readOnly = false;\n\n if (this.previousProcessorBlock && !this.getIsFirstInEventsFile() && this.isMappingSupported() && error.getFileId() === (this.INPUT_FILE_ID)) {\n this.previousProcessorBlock.modifyErrorInformation(error);\n } else {\n const fileLocation = this.mappingTable.getFileLocationForFileID(error.getFileId());\n\n if (fileLocation) {\n const fileIDRecord = this.mappingTable.getFileIDRecordForFileID(error.getFileId());\n readOnly = fileIDRecord ? this.isFileReadOnly(fileIDRecord) : false;\n error.setFileName(fileLocation);\n } else {\n const initialInputFile = this.getInitialInputFile();\n readOnly = initialInputFile ? this.isFileReadOnly(initialInputFile) : false;\n\n // If getFileLocationForFileID returns null, that means that the\n // file with fileId of the error is not in the fileTable, most\n // likely because it is an output file. Map this error to the\n // top of the input file of this processor.\n error.setFileName(initialInputFile?.getFileName() || '');\n error.setStmtLine(0);\n error.setStartErrLine(0);\n error.setTokenStart(0);\n error.setEndErrLine(0);\n error.setTokenEnd(0);\n }\n }\n\n return readOnly;\n }\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a Error Information record in an events file.\n */\nexport class ErrorInformationRecord implements IRecord {\n\t// Source file name corresponding to file id - is computed later\n\tprivate fileName: string = \"\";\n\n\tconstructor(private version: number, private fileId: number, private annotClass: number,\n\t\tprivate stmtLine: number, private startErrLine: number, private tokenStart: number,\n\t\tprivate endErrLine: number, private tokenEnd: number, private msgId: string,\n\t\tprivate sevChar: string, private sevNum: number, private length: number,\n\t\tprivate msg: string) { }\n\n\tgetRecordType(): IRecordT {\n\t\treturn IRecordT.ERROR_INFORMATION;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the file id.\n\t * \n\t * @return The file id.\n\t */\n\tpublic getFileId(): number {\n\t\treturn this.fileId;\n\t}\n\n\t/**\n\t * Set the file id.\n\t * \n\t * @param fileId The file id.\n\t */\n\tpublic setFileId(fileId: number) {\n\t\tthis.fileId = fileId;\n\t}\n\n\t/**\n\t * Get the file name.\n\t * \n\t * @return The file id.\n\t */\n\tpublic getFileName(): string {\n\t\treturn this.fileName;\n\t}\n\n\t/**\n\t * Set the file name.\n\t * \n\t * @param fileName The file id.\n\t */\n\tpublic setFileName(fileName: string) {\n\t\tthis.fileName = fileName;\n\t}\n\n\t/**\n\t * Get the annotation class.\n\t * \n\t * @return The annotation class.\n\t */\n\tpublic getAnnotClass(): number {\n\t\treturn this.annotClass;\n\t}\n\n\t/**\n\t * Get the statement line.\n\t * \n\t * @return The statement line.\n\t */\n\tpublic getStmtLine(): number {\n\t\treturn this.stmtLine;\n\t}\n\n\t/**\n\t * Set the statement line.\n\t * \n\t * @param stmtLine The statement line.\n\t */\n\tpublic setStmtLine(stmtLine: number) {\n\t\tthis.stmtLine = stmtLine;\n\t}\n\n\t/**\n\t * Get the starting error line.\n\t * \n\t * @return The starting error line.\n\t */\n\tpublic getStartErrLine(): number {\n\t\treturn this.startErrLine;\n\t}\n\n\t/**\n\t * Set the starting error line.\n\t * \n\t * @param startErrLine The starting error line.\n\t */\n\tpublic setStartErrLine(startErrLine: number) {\n\t\tthis.startErrLine = startErrLine;\n\t}\n\n\t/**\n\t * Get the starting error column.\n\t * \n\t * @return The starting error column.\n\t */\n\tpublic getTokenStart(): number {\n\t\treturn this.tokenStart;\n\t}\n\n\t/**\n\t * Set the starting error column.\n\t * \n\t * @param tokenStart The starting error column.\n\t */\n\tpublic setTokenStart(tokenStart: number) {\n\t\tthis.tokenStart = tokenStart;\n\t}\n\n\t/**\n\t * Get the ending error line.\n\t * \n\t * @return The ending error line.\n\t */\n\tpublic getEndErrLine(): number {\n\t\treturn this.endErrLine;\n\t}\n\n\t/**\n\t * Set the ending error line.\n\t * \n\t * @param endErrLine The ending error line.\n\t */\n\tpublic setEndErrLine(endErrLine: number) {\n\t\tthis.endErrLine = endErrLine;\n\t}\n\n\t/**\n\t * Get the ending error column.\n\t * \n\t * @return The ending error column.\n\t */\n\tpublic getTokenEnd(): number {\n\t\treturn this.tokenEnd;\n\t}\n\n\t/**\n\t * Set the ending error column.\n\t * \n\t * @param tokenEnd The ending error column.\n\t */\n\tpublic setTokenEnd(tokenEnd: number) {\n\t\tthis.tokenEnd = tokenEnd;\n\t}\n\n\t/**\n\t * Get the message id.\n\t * \n\t * @return The message id.\n\t */\n\tpublic getMsgId(): string {\n\t\treturn this.msgId;\n\t}\n\n\t/**\n\t * Get the severity code.\n\t * \n\t * @return The severity code.\n\t */\n\tpublic getSevChar(): string {\n\t\treturn this.sevChar;\n\t}\n\n\t/**\n\t * Get the severity level number.\n\t * \n\t * @return The severity level number.\n\t */\n\tpublic getSevNum(): number {\n\t\treturn this.sevNum;\n\t}\n\n\t/**\n\t * Get the length of the message.\n\t * \n\t * @return The length of the message.\n\t */\n\tpublic getLength(): number {\n\t\treturn this.length;\n\t}\n\n\t/**\n\t * Get the message.\n\t * \n\t * @return The message.\n\t */\n\tpublic getMsg(): string {\n\t\treturn this.msg;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.ERROR_INFORMATION}\\t`\n\t\t\t+ `${this.version} ${this.fileId} ${this.annotClass} ${this.stmtLine} ${this.startErrLine} `\n\t\t\t+ `${this.tokenStart} ${this.endErrLine} ${this.tokenEnd} ${this.msgId} ${this.sevChar} `\n\t\t\t+ `${this.sevNum} ${this.length} ${this.msg}`;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents an Expansion record in an Events File.\n */\nexport class ExpansionRecord implements IRecord {\n\tconstructor(private version: number, private inputFileID: number, private inputLineStart: number,\n\t\tprivate inputLineEnd: number, private outputFileID: number, private outputLineStart: number,\n\t\tprivate outputLineEnd: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.EXPANSION;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the input file ID.\n\t * \n\t * @return The input file ID.\n\t */\n\tpublic getInputFileID(): number {\n\t\treturn this.inputFileID;\n\t}\n\n\t/**\n\t * Get the input line start.\n\t * \n\t * @return The input line start.\n\t */\n\tpublic getInputLineStart(): number {\n\t\treturn this.inputLineStart;\n\t}\n\n\t/**\n\t * Get the input line end.\n\t * \n\t * @return The input line end.\n\t */\n\tpublic getInputLineEnd(): number {\n\t\treturn this.inputLineEnd;\n\t}\n\n\t/**\n\t * Get the output file ID.\n\t * \n\t * @return The output file ID.\n\t */\n\tpublic getOutputFileID(): number {\n\t\treturn this.outputFileID;\n\t}\n\n\t/**\n\t * Get the output line start.\n\t * \n\t * @return The output line start.\n\t */\n\tpublic getOutputLineStart(): number {\n\t\treturn this.outputLineStart;\n\t}\n\n\t/**\n\t * Get the output line end.\n\t * \n\t * @return The output line end.\n\t */\n\tpublic getOutputLineEnd(): number {\n\t\treturn this.outputLineEnd;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.EXPANSION}\\t`\n\t\t\t+ `${this.version} ${this.inputFileID} ${this.inputLineStart} ${this.inputLineEnd} ${this.outputFileID} `\n\t\t\t+ `${this.outputLineStart} ${this.outputLineEnd}`;\n\t}\n}\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a File End record in an events file.\n */\nexport class FileEndRecord implements IRecord {\n\tconstructor(private version: number, private fileId: number, private expansion: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.FILE_END;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the file id.\n\t * \n\t * @return The file id.\n\t */\n\tpublic getFileId(): number {\n\t\treturn this.fileId;\n\t}\n\n\t/**\n\t * Get the expansion.\n\t * \n\t * @return The expansion.\n\t */\n\tpublic getExpansion(): number {\n\t\treturn this.expansion;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.FILE_END}\\t`\n\t\t\t+ `${this.version} ${this.fileId} ${this.expansion}`;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a File ID record in an events file.\n */\nexport class FileIDRecord implements IRecord {\n\tconstructor(private version: number, private sourceId: number, private line: number,\n\t\tprivate length: number, private fileName: string, private timestamp: string,\n\t\tprivate flag: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.FILE_ID;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the source id.\n\t * \n\t * @return The source id.\n\t */\n\tpublic getSourceId(): number {\n\t\treturn this.sourceId;\n\t}\n\n\t/**\n\t * Get the line.\n\t * \n\t * @return The line.\n\t */\n\tpublic getLine(): number {\n\t\treturn this.line;\n\t}\n\n\t/**\n\t * Get the length.\n\t * \n\t * @return The length.\n\t */\n\tpublic getLength(): number {\n\t\treturn this.length;\n\t}\n\n\t/**\n\t * Get the file name.\n\t * \n\t * @return The file name.\n\t */\n\tpublic getFileName(): string {\n\t\treturn this.fileName;\n\t}\n\n\t/**\n\t * Get the timestamp.\n\t * \n\t * @return The timestamp.\n\t */\n\tpublic getTimestamp(): string {\n\t\treturn this.timestamp;\n\t}\n\n\t/**\n\t * Get the flag.\n\t * \n\t * @return The flag.\n\t */\n\tpublic getFlag(): number {\n\t\treturn this.flag;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.FILE_ID}\\t`\n\t\t\t+ `${this.version} ${this.sourceId} ${this.line} ${this.length} ${this.fileName} `\n\t\t\t+ `${this.timestamp} ${this.flag}`;\n\t}\n}\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\n/**\n * This interface should be implemented by all classes that represent\n * records in an events file.\n */\nexport enum IRecordT {\n TIMESTAMP = \"TIMESTAMP\",\n PROCESSOR = \"PROCESSOR\",\n FILE_ID = \"FILEID\",\n FILE_CONT = \"FILEIDCONT\",\n FILE_END = \"FILEEND\",\n ERROR_INFORMATION = \"ERROR\",\n PROGRAM = \"PROGRAM\",\n MAP_DEFINE = \"MAPDEFINE\",\n MAP_START = \"MAPSTART\",\n MAP_END = \"MAPEND\",\n FEEDBACK_CODE = \"FEEDBACK\",\n EXPANSION = \"EXPANSION\"\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a Processor record in an events file.\n */\nexport class ProcessorRecord implements IRecord {\n\tconstructor(private version: number, private outputId: number, private lineClass: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.PROCESSOR;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the output id.\n\t * \n\t * @return The output id.\n\t */\n\tpublic getOutputId(): number {\n\t\treturn this.outputId;\n\t}\n\n\t/**\n\t * Get the line class.\n\t * \n\t * @return The line class.\n\t */\n\tpublic getLineClass(): number {\n\t\treturn this.lineClass;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.PROCESSOR}\\t`\n\t\t\t+ `${this.version} ${this.outputId} ${this.lineClass}`;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from './IRecordT';\nimport { IRecord } from './IRecord';\n\n/**\n * This class represents a Timestamp record in an events file.\n */\nexport class TimestampRecord implements IRecord {\n\tconstructor(private version: number, private timestamp: string) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.TIMESTAMP;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the timestamp.\n\t * \n\t * @return The timestamp.\n\t */\n\tpublic getTimestamp(): string {\n\t\treturn this.timestamp;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.TIMESTAMP}\\t`\n\t\t\t+ `${this.version} ${this.timestamp}`;\n\t}\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nexport { Parser } from \"./Parser\";\nexport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nexport { ISequentialFileReader } from \"./ISequentialFileReader\";\nexport { IMarkerCreator } from \"./IMarkerCreator\";\nexport { IProcessor } from \"./IProcessor\";"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","Object","defineProperty","exports","value","p","path","t","TypeError","concat","assertPath","length","isAbsolute","charCodeAt","trailingSeparator","allowAboveRoot","code","res","lastSegmentLength","lastSlash","dots","i","lastSlashIndex","lastIndexOf","slice","posixNormalize","s","decodeURIComponent","_unused","decode","module","default","ProcessorBlock_1","__webpack_require__","ExpansionProcessor","this","PRE_COMPILE_PROCESSOR_ID","postProcessingNeeded","_noProcessorEventsYet","_containsPreCompileProcessorBlocks","processErrorRecord","record","currentProcessor","addErrorInformation","processExpansionRecord","setContainsExpansionEvents","getMappingTable","addExpansionRecord","processFeedbackCodeRecord","processFileEndRecord","closeFile","e","Error","message","processFileIDRecord","fileID","getSourceId","isProcessorIDZero","getInputFile","setInputFile","addFileToFileTable","getOutputFile","setOutputFile","addFile","processMapDefineRecord","processMapEndRecord","processMapStartRecord","processProcessorRecord","getOutputId","processorEnded","newProcessor","constructEventsFileProcessorBlock","setFirstInEventsFile","setPreviousProcessor","ProcessorBlock","processProgramRecord","processTimestampRecord","doPreProcessing","doPostProcessing","determineAndSetMappingSupport","resolveFileNamesForAllErrors","lastProcessorBlock","isMappingSupportedByAny","curProc","curSupport","isMappingSupportedByCurrentEventsFile","setMappingSupportForCurrentEventsFile","getIsFirstInEventsFile","getPreviousProcessorBlock","support","setMappingSupported","undefined","supported","getContainsExpansionEvents","getTotalNumberOfLinesInOutputFile","getTotalNumberOfLinesInInputFiles","previousProcessorBlock","getAllErrors","getAllProcessorErrors","getAllFileIDRecords","SourceLineRange","input","inputStartLine","inputEndLine","outputStartLine","outputEndLine","inputFileID","getInputStartLine","getInputEndLine","getInputFileID","getOutputStartLine","getOutputEndLine","setInputEndLine","endLine","setInputFileID","setInputStartLine","startLine","setOutputEndLine","setOutputStartLine","shiftOutputLines","amount","containsOutputLine","line","containsInputLine","ID","fixInputRangeBasedOnOutputRange","fixOutputRangeBasedOnInputRange","FileIDLinesPair","lines","getID","getLinesProcessed","increaseLinesProcessed","MapTable","map","queueExpansion","files","ArrayStack","lookupIndex","fileTable","Map","addFileInformation","range","createOpenEndedSourceLineRange","file","isEmpty","parentFile","peek","parentRange","pop","push","set","toString","getFileId","last","expansion","getExpansion","parent","getLine","getSourceLineRangeForOutputLine","optimizedSourceLineRangeLookup","getSourceLineRangeForInputLine","id","shiftRangesBy","atIndex","handleExpansion","expansionRange","createSourceLineRange","expandedSource","splitExpandedSourceLineRange","expanded","index","indexOf","isExpansionNegative","expansionSize","splice","Math","abs","extraRange","iStart","iEnd","oStart","oEnd","getInputLineStart","getInputLineEnd","getOutputLineStart","getOutputLineEnd","getFileIDRecordForFileID","get","getFileLocationForFileID","fileRecord","getFileName","modifyErrorInformation","statementLine","getStmtLine","setStmtLine","getLineFromSourceLineRange","setFileId","startLineNumber","getStartErrLine","setStartErrLine","endLineNumber","getEndErrLine","setEndErrLine","setFileName","initial","finalizeMap","JSON","stringify","forEach","header","unshift","buffer","size","fileIDRecords","Set","key","keys","fileIDRecord","add","Array","from","values","stack","item","IRecordT_1","TimestampRecord_1","ProcessorRecord_1","FileIDRecord_1","ErrorInformationRecord_1","FileEndRecord_1","ExpansionRecord_1","ExpansionProcessor_1","path_normalize_1","__importDefault","SourceFile","location","browseMode","getLocation","isReadOnly","setReadOnly","LookAheadReader","iSequentialFileReader","readNextLine","peakLine","nextLine","peakNextRecordType","split","filter","token","Parser","_loggingEnabled","sourceTable","getUntilTheEndOfTheLine","startIndex","st","curr_msg","loggingEnabled","enable","log","content","console","parse","fileReader","markerCreator","word","fileId","processor","reader","lineText","IRecordT","ERROR_INFORMATION","version","parseInt","fileProcessed","annotationClass","lineStart","charStart","lineEnd","charEnd","severityText","severity","totalMessageLen","ErrorInformationRecord","lineNumber","locationLength","substring","nextRecordType","FILE_CONT","timestamp","tempFlag","charAt","isSpaceBeforeTempFlag","resolveRelativePath","fileEntry","lastOutputFile","currentOutputFile","FileIDRecord","errorMessage","exception","FileEndRecord","inputLineStart","inputLineEnd","outputFileID","outputLineStart","outputLineEnd","ExpansionRecord","TimestampRecord","outputId","lineClass","ProcessorRecord","trim","sourceFile","createMarker","replace","getException","setProcessor","nestedErrors","allErrors","MapTable_1","INPUT_FILE_ID","containsExpansionEvents","isFirstInEventsFile","mappingSupported","totalNumberOfLinesInOutputFile","totalNumberOfLinesInInputFiles","mappingTable","errors","inputFile","getInitialInputFile","outputFile","setTotalNumberOfLinesInOutputFile","increaseTotalNumberOfLinesInInputFiles","previous","numberOfLines","error","inputFileLocation","inputFileId","isMappingSupported","isFileReadOnly","getFlag","allPrevErrs","resolveFileNameAndDetermineIfReadOnly","readOnly","fileLocation","initialInputFile","setTokenStart","setTokenEnd","annotClass","stmtLine","startErrLine","tokenStart","endErrLine","tokenEnd","msgId","sevChar","sevNum","msg","fileName","getRecordType","getVersion","getAnnotClass","getTokenStart","getTokenEnd","getMsgId","getSevChar","getSevNum","getLength","getMsg","EXPANSION","getOutputFileID","FILE_END","sourceId","flag","FILE_ID","getTimestamp","PROCESSOR","getLineClass","TIMESTAMP","__webpack_module_cache__","moduleId","cachedModule","__webpack_modules__","call","Parser_1","enumerable"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":"mCAEAA,OAAAC,eAAAC,EAAA,cAA+CC,OAAA,IAC/CD,EAAAE,eAAiB,EA4HjBF,EAAAE,UArBAC,IApGA,CAAAC,IACA,MAAAC,SAAAD,EACA,cAAAC,EACA,UAAAC,UAAA,4BAAwDD,MAkGxDE,CAAAJ,GACA,IAAAC,EAAAD,EACA,OAAAC,EAAAI,OACA,UAEA,MAAAC,EA5GA,KA4GAL,EAAAM,WAAA,GACAC,EA7GA,KA6GAP,EAAAM,WAAAN,EAAAI,OAAA,GASA,OARAJ,EAhBA,CAAAQ,IACA,IACA,OAAAC,mBAAAD,EACA,CACA,MACA,OAAAA,CACA,GAUAE,CAAAV,GACAA,EArGA,EAAAA,EAAAW,KACA,IAKAC,EALAC,EAAA,GACAC,EAAA,EACAC,GAAA,EACAC,EAAA,EAIA,QAAAC,EAAA,EAAoBA,GAAAjB,EAAAI,SAAkBa,EAAA,CACtC,GAAAA,EAAAjB,EAAAI,OACAQ,EAAAZ,EAAAM,WAAAW,OAEA,IAtBA,KAsBAL,EACA,MAGAA,EA1BA,EA2BA,CACA,GA5BA,KA4BAA,EAAA,CACA,GAAAG,IAAAE,EAAA,OAAAD,QAGA,GAAAD,IAAAE,EAAA,OAAAD,EAAA,CACA,GAAAH,EAAAT,OAAA,GACA,IAAAU,GAjCA,KAkCAD,EAAAP,WAAAO,EAAAT,OAAA,IAlCA,KAmCAS,EAAAP,WAAAO,EAAAT,OAAA,GACA,GAAAS,EAAAT,OAAA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AyB7O,KAAA8P,UAAAA,CAAqB,CAE3D,aAAAuE,GACN,OAAOxI,EAAA8C,SAAS6G,SACjB,CAEO,UAAAlB,GACN,OAAOtU,KAAK6O,OACb,CAOO,YAAAwG,GACN,OAAOrV,KAAK8P,SACb,CAEO,QAAA1I,GACN,MAAO,GAAGyE,EAAA8C,SAAS6G,cACbxV,KAAK6O,WAAW7O,KAAK8P,WAC5B,KChCD,MAAA2F,EAAA,GAGA,SAAA5V,EAAA6V,GAEA,MAAAC,EAAAF,EAAAC,GACA,QAAAlS,IAAAmS,EACA,OAAAA,EAAAzX,QAGA,MAAA0X,EAAAH,EAAAC,GAAA,CAGAxX,QAAA,IAOA,OAHA2X,EAAAH,GAAAI,KAAAF,EAAA1X,QAAA0X,EAAAA,EAAA1X,QAAA2B,GAGA+V,EAAA1X,OACA,kHClBA,IAAA6X,EAAAlW,EAAA,KAAS7B,OAAAC,eAAAC,EAAA,UAAA8X,YAAA,EAAAxM,IAAA,kBAAAuM,EAAAzI,MAAM,IACf,IAAArB,EAAApM,EAAA,KAAS7B,OAAAC,eAAAC,EAAA,0BAAA8X,YAAA,EAAAxM,IAAA,kBAAAyC,EAAAuD,sBAAsB","sources":["webpack://@ibm/ibmi-eventf-parser/./node_modules/path-normalize/lib/index.js","webpack://@ibm/ibmi-eventf-parser/./src/ExpansionProcessor.ts","webpack://@ibm/ibmi-eventf-parser/./src/MapTable.ts","webpack://@ibm/ibmi-eventf-parser/./src/Parser.ts","webpack://@ibm/ibmi-eventf-parser/./src/ProcessorBlock.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/ErrorInformationRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/ExpansionRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/FileEndRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/FileIDRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/IRecordT.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/ProcessorRecord.ts","webpack://@ibm/ibmi-eventf-parser/./src/record/TimestampRecord.ts","webpack://@ibm/ibmi-eventf-parser/webpack/bootstrap","webpack://@ibm/ibmi-eventf-parser/./src/index.ts"],"sourcesContent":["\"use strict\";\n/* eslint-disable @typescript-eslint/no-magic-numbers */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.normalize = void 0;\nconst SLASH = 47;\nconst DOT = 46;\nconst assertPath = (path) => {\n const t = typeof path;\n if (t !== 'string') {\n throw new TypeError(`Expected a string, got a ${t}`);\n }\n};\n// this function is directly from node source\n// eslint-disable-next-line complexity\nconst posixNormalize = (path, allowAboveRoot) => {\n let res = '';\n let lastSegmentLength = 0;\n let lastSlash = -1;\n let dots = 0;\n // eslint-disable-next-line @typescript-eslint/init-declarations\n let code;\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i <= path.length; ++i) {\n if (i < path.length) {\n code = path.charCodeAt(i);\n }\n else if (code === SLASH) {\n break;\n }\n else {\n code = SLASH;\n }\n if (code === SLASH) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n }\n else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 ||\n lastSegmentLength !== 2 ||\n res.charCodeAt(res.length - 1) !== DOT ||\n res.charCodeAt(res.length - 2) !== DOT) {\n if (res.length > 2) {\n const lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n // eslint-disable-next-line max-depth\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n }\n else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0) {\n res += '/..';\n }\n else {\n res = '..';\n }\n lastSegmentLength = 2;\n }\n }\n else {\n if (res.length > 0) {\n res += '/' + path.slice(lastSlash + 1, i);\n }\n else {\n res = path.slice(lastSlash + 1, i);\n }\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n }\n else if (code === DOT && dots !== -1) {\n // eslint-disable-next-line no-plusplus\n ++dots;\n }\n else {\n dots = -1;\n }\n }\n return res;\n};\nconst decode = (s) => {\n try {\n return decodeURIComponent(s);\n }\n catch {\n return s;\n }\n};\nconst normalize = (p) => {\n assertPath(p);\n let path = p;\n if (path.length === 0) {\n return '.';\n }\n const isAbsolute = path.charCodeAt(0) === SLASH;\n const trailingSeparator = path.charCodeAt(path.length - 1) === SLASH;\n path = decode(path);\n path = posixNormalize(path, !isAbsolute);\n if (path.length === 0 && !isAbsolute) {\n path = '.';\n }\n if (path.length > 0 && trailingSeparator) {\n path += '/';\n }\n if (isAbsolute) {\n return '/' + path;\n }\n return path;\n};\nexports.normalize = normalize;\nexports.default = exports.normalize;\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IProcessor } from \"./IProcessor\";\nimport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nimport { ExpansionRecord } from \"./record/ExpansionRecord\";\nimport { FeedbackCodeRecord } from \"./record/FeedbackCodeRecord\";\nimport { FileEndRecord } from \"./record/FileEndRecord\";\nimport { FileIDRecord } from \"./record/FileIDRecord\";\nimport { MapDefineRecord } from \"./record/MapDefineRecord\";\nimport { MapEndRecord } from \"./record/MapEndRecord\";\nimport { MapStartRecord } from \"./record/MapStartRecord\";\nimport { ProcessorBlock } from \"./ProcessorBlock\";\nimport { ProcessorRecord } from \"./record/ProcessorRecord\";\nimport { ProgramRecord } from \"./record/ProgramRecord\";\nimport { TimestampRecord } from \"./record/TimestampRecord\";\n\nexport class ExpansionProcessor implements IProcessor {\n\tprivate PRE_COMPILE_PROCESSOR_ID = 999;\n\n\tprotected currentProcessor: ProcessorBlock | undefined;\n\n\t// Flags any errors that occur during processing and disables the processor if needed\n\tprotected postProcessingNeeded: boolean = true;\n\n\t// Flags if the Events File contains any EXPANSION Events or not\n\t// private containsExpansionEvents: boolean = false;\n\n\t// Needed for events files that contain multiple events files that have been combined into one (as done in iProjects).\n\t// Gets set to true at the beginning of each new \"sub\" events file (marked by a new TIMESTAMP record),\n\t// and to false after each first PROCESSOR event in the \"sub\" events file.\n\t// The scope of this variable is only the current \"sub\" events file.\n\tprivate _noProcessorEventsYet: boolean = true;\n\n\t// Needed to decide whether to do mappings of errors to input members\n\t// If true, temporary output members are involved, and mappings may be needed (unless not supported by pre-compilers)\n\tprotected _containsPreCompileProcessorBlocks: boolean = false;\n\n\tconstructor() { }\n\n\tpublic processErrorRecord(record: ErrorInformationRecord) {\n\t\tthis.currentProcessor!.addErrorInformation(record);\n\t}\n\n\tpublic processExpansionRecord(record: ExpansionRecord) {\n\t\t// this.containsExpansionEvents = true;\n\t\tthis.currentProcessor!.setContainsExpansionEvents(true);\n\t\tthis.currentProcessor!.getMappingTable().addExpansionRecord(record);\n\t}\n\n\tpublic processFeedbackCodeRecord(record: FeedbackCodeRecord) { }\n\n\tpublic processFileEndRecord(record: FileEndRecord) {\n\t\ttry {\n\t\t\tthis.currentProcessor!.closeFile(record);\n\t\t} catch (e: any) {\n\t\t\tthis.postProcessingNeeded = false;\n\t\t\tthrow new Error(e.message ? e.message : e);\n\t\t}\n\t}\n\n\tpublic processFileIDRecord(record: FileIDRecord) {\n\t\t// The try-catch block is there to flag any problems, disable processing and allow regular Events File processing to continue\n\t\ttry {\n\t\t\tconst fileID = record.getSourceId();\n\n\t\t\tif (!this.currentProcessor!.isProcessorIDZero()) {\n\t\t\t\tif (fileID > 1) {\n\t\t\t\t\tif (!this.currentProcessor!.getOutputFile()) {\n\t\t\t\t\t\tthis.currentProcessor!.setOutputFile(record);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else if (fileID === 1 && !this.currentProcessor!.getInputFile()) {\n\t\t\t\t\tthis.currentProcessor!.setInputFile(record);\n\t\t\t\t}\n\n\t\t\t\tthis.currentProcessor!.addFile(record);\n\t\t\t} else {\n\t\t\t\t// We need to keep track of all files in the compiler processor block to be able to get the location for files\n\t\t\t\tif (fileID === 1 && !this.currentProcessor!.getInputFile()) {\n\t\t\t\t\tthis.currentProcessor!.setInputFile(record);\n\t\t\t\t}\n\n\t\t\t\tthis.currentProcessor!.getMappingTable().addFileToFileTable(record);\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\tthis.postProcessingNeeded = false;\n\t\t\tthrow new Error(e.message ? e.message : e);\n\t\t}\n\t}\n\n\tpublic processMapDefineRecord(record: MapDefineRecord) { }\n\n\tpublic processMapEndRecord(record: MapEndRecord) { }\n\n\tpublic processMapStartRecord(record: MapStartRecord) { }\n\n\tpublic processProcessorRecord(record: ProcessorRecord) {\n\t\tif (!this._containsPreCompileProcessorBlocks && record.getOutputId() === this.PRE_COMPILE_PROCESSOR_ID) {\n\t\t\tthis._containsPreCompileProcessorBlocks = true;\n\t\t}\n\n\t\ttry {\n\t\t\tif (this.currentProcessor!) {\n\t\t\t\tthis.currentProcessor!.processorEnded();\n\t\t\t}\n\t\t} catch (e: any) {\n\t\t\tthis.postProcessingNeeded = false;\n\t\t\tthrow new Error(e.message ? e.message : e);\n\t\t}\n\n\t\tconst newProcessor = this.constructEventsFileProcessorBlock(record);\n\n\t\t// Set this processor block as the first one in the current \"sub\" events file\n\t\t// (needed for events file that contains multiple events files that have been combined into one)\n\t\tif (this._noProcessorEventsYet) {\n\t\t\tnewProcessor.setFirstInEventsFile(true);\n\t\t\tthis._noProcessorEventsYet = false;\n\t\t}\n\n\t\tnewProcessor.setPreviousProcessor(this.currentProcessor!);\n\t\tthis.currentProcessor! = newProcessor;\n\t}\n\n\n\tprotected constructEventsFileProcessorBlock(record: ProcessorRecord): ProcessorBlock {\n\t\treturn new ProcessorBlock(record);\n\t}\n\n\tpublic processProgramRecord(record: ProgramRecord) { }\n\n\tpublic processTimestampRecord(record: TimestampRecord) {\n\t\tthis._noProcessorEventsYet = true;\n\t}\n\n\tpublic doPreProcessing(): boolean {\n\t\treturn false;\n\t}\n\n\tpublic doPostProcessing(): boolean {\n\t\tif (!this.postProcessingNeeded || !this._containsPreCompileProcessorBlocks || !this.determineAndSetMappingSupport(this.currentProcessor!)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.currentProcessor!.resolveFileNamesForAllErrors();\n\t\treturn false;\n\t}\n\n\t/** \n\t * Recursively determines whether the events file (or any of the \"sub\" events files\n\t * when multiple have been combined into one) supports mapping of errors from the \n\t * final temporary output member to the original input members.\n\t * Also sets a property of each processor block for whether it supports mappings.\n\t * Mapping is supported for an events file if all its processor blocks support error mapping.\n\t * IMPORTANT: When called at the top level, this method should only be called on the \n\t * very last processor block of the [combined] events file.\n\t * \n\t * @param lastProcessorBlock The first processor block to check. When called at the top\n\t * level, this should be the very last processor block of the [combined] events file.\n\t * @return True if any of the events files support mapping of errors, false otherwise.\n\t */\n\tprotected determineAndSetMappingSupport(lastProcessorBlock: ProcessorBlock): boolean {\n\t\tlet isMappingSupportedByAny = false;\n\t\tlet curProc: ProcessorBlock | undefined = lastProcessorBlock;\n\n\t\twhile (curProc) {\n\t\t\tconst curSupport = this.isMappingSupportedByCurrentEventsFile(curProc);\n\t\t\tthis.setMappingSupportForCurrentEventsFile(curProc, curSupport);\n\n\t\t\tif (!isMappingSupportedByAny && curSupport) {\n\t\t\t\tisMappingSupportedByAny = true;\n\t\t\t}\n\n\t\t\t// Iterate to the first processor block in the current \"sub\" events file,\n\t\t\twhile (curProc && !curProc.getIsFirstInEventsFile()) {\n\t\t\t\tcurProc = curProc.getPreviousProcessorBlock();\n\t\t\t}\n\n\t\t\t// Use it to get the previous \"sub\" events file's last processor block\t\t\t\n\t\t\tif (curProc) {\n\t\t\t\tcurProc = curProc.getPreviousProcessorBlock();\n\t\t\t}\n\t\t}\n\n\t\treturn isMappingSupportedByAny;\n\t}\n\n\t/**\n\t * Sets the supportsMappings property for each processor block in the current events file\n\t * to the value provided.\n\t * IMPORTANT: This method should only be called on the last processor block\n\t * of the current events file.\n\t * \n\t * @param lastProcessorBlock The last processor block of the current events file.\n\t * @param support Boolean value corresponding to whether the current events file requires \n\t * and supports mappings.\n\t */\n\tprivate setMappingSupportForCurrentEventsFile(lastProcessorBlock: ProcessorBlock, support: boolean) {\n\t\tlet curProc: ProcessorBlock | undefined = lastProcessorBlock;\n\n\t\twhile (curProc) {\n\t\t\tcurProc.setMappingSupported(support);\n\n\t\t\tif (curProc.getIsFirstInEventsFile()) {\n\t\t\t\tcurProc = undefined;\n\t\t\t} else {\n\t\t\t\tcurProc = curProc.getPreviousProcessorBlock();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Recursively determines whether the current events file (or \"sub\" events file in the case of\n\t * multiple events files combined into one) requires and supports mapping of errors\n\t * from its output file to its input files. An [\"sub\"] events file supports mapping of\n\t * errors if all of its processor blocks support error mappings.\n\t * For individual processor blocks in the events file:\n\t * For compile processor blocks, when they come after pre-compile processor blocks(s),\n\t * mapping is considered to be supported. If they do not come after pre-compile\n\t * block(s), there is no need to do mappings, so mapping is not considered supported.\n\t * For pre-compile processor blocks (which will have temporary output members),\n\t * mapping is supported if there are expansion events, or if there are no\n\t * expansion events but the total number of lines written to the output\n\t * file equals the total number of lines read from the input files, and is not zero.\n\t * IMPORTANT: When called at the top level, this method should only be called on \n\t * the last processor block of the current events file.\n\t * \n\t * @param lastProcessorBlock The last processor block of the current events file. \n\t * @return True if the current events file supports mapping of errors, false otherwise.\n\t */\n\tprivate isMappingSupportedByCurrentEventsFile(lastProcessorBlock: ProcessorBlock): boolean {\n\t\tlet supported: boolean;\n\n\t\tif (!lastProcessorBlock.getOutputFile()) {\n\t\t\t// Compile processor block case\n\t\t\tif (!lastProcessorBlock.getPreviousProcessorBlock() || lastProcessorBlock.getIsFirstInEventsFile()) {\n\t\t\t\tsupported = false;\n\t\t\t} else {\n\t\t\t\tsupported = true;\n\t\t\t}\n\t\t} else if (lastProcessorBlock.getContainsExpansionEvents()) {\n\t\t\tsupported = true;\n\t\t} else if (lastProcessorBlock.getTotalNumberOfLinesInOutputFile() === 0) {\n\t\t\tsupported = false;\n\t\t} else {\n\t\t\tsupported = lastProcessorBlock.getTotalNumberOfLinesInOutputFile() === lastProcessorBlock.getTotalNumberOfLinesInInputFiles();\n\t\t}\n\n\t\tconst previousProcessorBlock = lastProcessorBlock.getPreviousProcessorBlock();\n\t\tif (previousProcessorBlock && !lastProcessorBlock.getIsFirstInEventsFile()) {\n\t\t\tsupported = supported && this.isMappingSupportedByCurrentEventsFile(previousProcessorBlock);\n\t\t}\n\n\t\treturn supported;\n\t}\n\n\tpublic getAllErrors(): ErrorInformationRecord[][] {\n\t\tif (this.currentProcessor!) {\n\t\t\treturn this.currentProcessor!.getAllProcessorErrors();\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tpublic getAllFileIDRecords(): FileIDRecord[] {\n\t\tif (this.currentProcessor!) {\n\t\t\treturn this.currentProcessor!.getMappingTable().getAllFileIDRecords();\n\t\t} else {\n\t\t\treturn [];\n\t\t}\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nimport { ExpansionRecord } from \"./record/ExpansionRecord\";\nimport { FileEndRecord } from \"./record/FileEndRecord\";\nimport { FileIDRecord } from \"./record/FileIDRecord\";\n\n/**\n * Class used as a container of line numbers and file IDs for each range\n * of lines in the map.\n */\nclass SourceLineRange {\n\t// Input File Info\n\tprivate inputStartLine: number = 0;\n\tprivate inputEndLine: number = -1;\n\tprivate inputFileID: number;\n\n\t// Output File Info\n\tprivate outputStartLine: number = 0;\n\tprivate outputEndLine: number = -1;\n\n\tconstructor(input: number | SourceLineRange) {\n\t\tif (typeof input === 'number') {\n\t\t\t// Input is fileID\n\t\t\tthis.inputFileID = input;\n\t\t} else {\n\t\t\t// Input is other range to copy\n\t\t\tthis.inputStartLine = input.getInputStartLine();\n\t\t\tthis.inputEndLine = input.getInputEndLine();\n\t\t\tthis.inputFileID = input.getInputFileID();\n\t\t\tthis.outputStartLine = input.getOutputStartLine();\n\t\t\tthis.outputEndLine = input.getOutputEndLine();\n\t\t}\n\t}\n\n\tpublic getInputEndLine(): number {\n\t\treturn this.inputEndLine;\n\t}\n\n\tpublic setInputEndLine(endLine: number) {\n\t\tthis.inputEndLine = endLine;\n\t}\n\n\tpublic getInputFileID(): number {\n\t\treturn this.inputFileID;\n\t}\n\n\tpublic setInputFileID(fileID: number) {\n\t\tthis.inputFileID = fileID;\n\t}\n\n\tpublic getInputStartLine(): number {\n\t\treturn this.inputStartLine;\n\t}\n\n\tpublic setInputStartLine(startLine: number) {\n\t\tthis.inputStartLine = startLine;\n\t}\n\n\tpublic getOutputEndLine(): number {\n\t\treturn this.outputEndLine;\n\t}\n\n\tpublic setOutputEndLine(endLine: number) {\n\t\tthis.outputEndLine = endLine;\n\t}\n\n\tpublic getOutputStartLine(): number {\n\t\treturn this.outputStartLine;\n\t}\n\n\tpublic setOutputStartLine(startLine: number) {\n\t\tthis.outputStartLine = startLine;\n\t}\n\n\t/**\n\t * Shifts the output file start and end lines by a certain amount.\n\t * If the end line is -1, no need to change it.\n\t * \n\t * @param amount Amount by which the line numbers need to be shifted.\n\t */\n\tpublic shiftOutputLines(amount: number) {\n\t\tthis.outputStartLine += amount;\n\n\t\tif (this.outputEndLine > 0) {\n\t\t\tthis.outputEndLine += amount;\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the output file line number is present in this container.\n\t * \n\t * @param line The line number to be checked.\n\t * @return True if the line is present in the range or false otherwise.\n\t */\n\tpublic containsOutputLine(line: number): boolean {\n\t\tif (this.outputEndLine === -1) {\n\t\t\treturn line >= this.outputStartLine;\n\t\t}\n\n\t\treturn line >= this.outputStartLine && line <= this.outputEndLine;\n\t}\n\n\t/**\n\t * Checks if the input file line number is present in this container.\n\t * \n\t * @param line The line number to be checked.\n\t * @param ID ID of the input file that contains the line.\n\t * @return True if the line is present in the range or false otherwise.\n\t */\n\tpublic containsInputLine(line: number, ID: number): boolean {\n\t\tif (this.inputEndLine === -1) {\n\t\t\treturn line >= this.inputStartLine && ID === (this.inputFileID);\n\t\t}\n\n\t\treturn line >= this.inputStartLine && line <= this.inputEndLine && ID === (this.inputFileID);\n\t}\n\n\t/**\n\t * A helper method to compute the input file end line number based on the other line numbers.\n\t */\n\tpublic fixInputRangeBasedOnOutputRange() {\n\t\tthis.inputEndLine = this.outputEndLine - this.outputStartLine + this.inputStartLine;\n\t}\n\n\t/**\n\t * A helper method to compute the output file end line number based on the other line numbers.\n\t */\n\tpublic fixOutputRangeBasedOnInputRange() {\n\t\tthis.outputEndLine = this.inputEndLine - this.inputStartLine + this.outputStartLine;\n\t}\n}\n\n/**\n * Class used as a container of the file ID and the number of lines processed so far.\n */\nclass FileIDLinesPair {\n\tprivate lines: number;\n\n\tconstructor(private ID: number) {\n\t\tthis.lines = 0;\n\t}\n\n\tpublic getID(): number {\n\t\treturn this.ID;\n\t}\n\n\tpublic getLinesProcessed(): number {\n\t\treturn this.lines;\n\t}\n\n\tpublic increaseLinesProcessed(amount: number) {\n\t\tthis.lines += amount;\n\t}\n}\n\nexport class MapTable {\n\t// Map of SourceLineRanges\n\tprivate map: SourceLineRange[] = [];\n\n\t// Holds the EXPANSION records until processed\n\tprivate queueExpansion: ExpansionRecord[] = [];\n\n\t// Data needed to determine where copybook SourceLineRange should be inserted in the list\n\tprivate files: ArrayStack<FileIDLinesPair> = new ArrayStack<FileIDLinesPair>();\n\tprivate lookupIndex: number = 0;\n\n\t// Hashtable of File IDs and locations for fast lookup\n\tprivate fileTable: Map<number, FileIDRecord> = new Map<number, FileIDRecord>();\n\n\tconstructor() { }\n\n\t/**\n\t * Adds file information to the map.\n\t * \n\t * @param Tecord The File ID record.\n\t */\n\tpublic addFileInformation(record: FileIDRecord) {\n\t\tconst range = this.createOpenEndedSourceLineRange(record);\n\t\tconst file = new FileIDLinesPair(record.getSourceId());\n\n\t\t// This should mean that the new FILEID is a copy member\n\t\tif (!this.files.isEmpty()) {\n\t\t\tconst parentFile = this.files.peek();\n\n\t\t\tconst parentRange = this.map[this.map.length - 1];\n\t\t\tif (parentRange.getOutputStartLine() === range.getOutputStartLine()) {\n\t\t\t\tthis.map.pop();\n\t\t\t} else {\n\t\t\t\tparentRange.setOutputEndLine(range.getOutputStartLine() - 1);\n\t\t\t\tparentRange.setInputEndLine(parentRange.getOutputEndLine() - parentRange.getOutputStartLine() + parentRange.getInputStartLine());\n\n\t\t\t\t// Add 2 to account for the /copy statement that was commented out\n\t\t\t\tparentFile?.increaseLinesProcessed(parentRange.getInputEndLine() - parentRange.getInputStartLine() + 1);\n\t\t\t}\n\t\t}\n\n\t\tthis.map.push(range);\n\t\tthis.files.push(file);\n\t\tthis.fileTable.set(record.getSourceId(), record);\n\t}\n\n\t/**\n\t * Adds file information only to the file table. This is useful for processing the\n\t * compiler (000) processor block, since we don't need to keep track of line mappings\n\t * and FileIDLinesPair pairings.\n\t * \n\t * @param record The File ID record\n\t */\n\tpublic addFileToFileTable(record: FileIDRecord) {\n\t\tthis.fileTable.set(record.getSourceId(), record);\n\t}\n\n\t/**\n\t * Sets the correct bounds for the files in the map that were added using `AddFileInformation()`.\n\t * \n\t * @param record The File End record that contains the number of lines in the source.\n\t */\n\tpublic closeFile(record: FileEndRecord) {\n\t\t// Make sure that the stack is not empty\n\t\tif (this.files.isEmpty()) {\n\t\t\tthrow new Error(`A FILEEND event does not have a matching FILEID.\\n`\n\t\t\t\t+ `Faulty event: ${record.toString()}`);\n\t\t}\n\n\t\tconst file = this.files.pop();\n\n\t\t// Make sure that the FILEID matches the FILEEND on the stack\n\t\tif (file?.getID() !== (record.getFileId())) {\n\t\t\tthrow new Error(`The ID field of the FILEEND event does not match the ID field of the last FILEID event.\\n`\n\t\t\t\t+ `Mismatched IDs: \\t FILEID: ${file?.getID()}\\t FILEEND: ${record.toString()}`);\n\t\t}\n\n\t\tconst last = this.map[this.map.length - 1];\n\n\t\t// Make sure that last retrieved node matches the ID of the FILEEND\n\t\tif (last.getInputFileID() !== (record.getFileId())) {\n\t\t\tthrow new Error(`The ID field of the FILEEND event does not match the ID field of the last SourceLineRange.\\n`\n\t\t\t\t+ `Mismatched IDs: \\t FILEID: ${last.getInputFileID()}\\t FILEEND: ${record.toString()}`);\n\t\t}\n\n\t\tlet expansion = 0;\n\t\ttry {\n\t\t\texpansion = record.getExpansion();\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`Unable to parse the expansion field of the FILEEND record to an integer\\n`\n\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t}\n\n\t\t// If the expansion field of the FileEnd record is different than 0, use that information to set the bounds\n\t\tif (expansion !== 0) {\n\t\t\tlast.setInputEndLine(last.getInputStartLine() + expansion - file.getLinesProcessed() - 1);\n\t\t\tlast.setOutputEndLine(last.getOutputStartLine() + expansion - file.getLinesProcessed() - 1);\n\n\t\t\t// All files have been handled\n\t\t\tif (this.files.isEmpty()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst parent = this.files.peek()!;\n\t\t\tconst range = new SourceLineRange(parent.getID());\n\t\t\trange.setInputStartLine(parent.getLinesProcessed() + 1);\n\t\t\trange.setOutputStartLine(last.getOutputEndLine() + 1);\n\n\t\t\tthis.map.push(range);\n\t\t} else {\n\t\t\t// If the expansion field is 0, assume that the bounds go to the end of the file\n\t\t\t// defect 7526: according to Gina Whitney, the expansion field is only 0 if the copy file\n\t\t\t// is empty, or if we are working with 5.4 or 6.1 before the PTF that enabled expansion events\n\t\t\t// So we will handle this as if it were an empty include and that should work for both cases.\n\t\t\tlast.setInputEndLine(last.getInputStartLine());\n\t\t\tlast.setOutputStartLine(last.getOutputStartLine() - 1); // No output whatsoever, so point errors to commented out include\n\t\t\tlast.setOutputEndLine(last.getOutputStartLine());\n\n\t\t\t// All files have been handled -i.e. this was the end of the containing file\n\t\t\tif (this.files.isEmpty()) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise this was the end of an included file\n\t\t\t// Now add an entry for the remainder of the containing file\n\t\t\tconst parent = this.files.peek()!;\n\t\t\tconst range = new SourceLineRange(parent.getID());\n\t\t\trange.setInputStartLine(parent.getLinesProcessed() + 1);\n\t\t\trange.setOutputStartLine(last.getOutputStartLine() + 1);\n\t\t\tthis.map.push(range);\n\t\t}\n\t}\n\n\t/**\n\t * Create a `SourceLineRange` with open bounds. The bounds will be set once the FileEnd record is read.\n\t * \n\t * @param record The FileID record that contains information about where the `SourceLineRange` should start.\n\t */\n\tprivate createOpenEndedSourceLineRange(record: FileIDRecord): SourceLineRange {\n\t\tlet line = 1;\n\t\ttry {\n\t\t\tline = record.getLine();\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`Unable to parse the line field of the FILEID record to an integer\\n`\n\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t}\n\n\t\tconst range = new SourceLineRange(record.getSourceId());\n\t\trange.setInputStartLine(1);\n\n\n\t\t// We need to take into consideration lines that have already been mapped to the output file.\n\t\t// line - parentFile.getLinesProcessed() === lines between the new /copy and the old /copy\n\t\tif (!this.files.isEmpty()) {\n\t\t\tconst parentRange = this.map[this.map.length - 1];\n\t\t\tconst parentFile = this.files.peek();\n\n\t\t\tif (parentFile) {\n\t\t\t\trange.setOutputStartLine(parentRange.getOutputStartLine() + line - parentFile.getLinesProcessed());\n\t\t\t}\n\t\t} else {\n\t\t\trange.setOutputStartLine(1);\n\t\t}\n\n\t\treturn range;\n\t}\n\n\tpublic addExpansionRecord(record: ExpansionRecord) {\n\t\tthis.queueExpansion.push(record);\n\t}\n\n\tprivate getSourceLineRangeForOutputLine(line: number): SourceLineRange | undefined {\n\t\tfor (const range of this.map) {\n\t\t\tif (range.containsOutputLine(line)) {\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate optimizedSourceLineRangeLookup(line: number): SourceLineRange | undefined {\n\t\t// Start searching from last known position\n\t\tfor (let i = this.lookupIndex; i < this.map.length; i++) {\n\t\t\tconst range = this.map[i];\n\t\t\tif (range.containsOutputLine(line)) {\n\t\t\t\tthis.lookupIndex = i;\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\n\t\t// If not found, wrap around and search from beginning\n\t\tfor (let i = 0; i < this.lookupIndex && i < this.map.length; i++) {\n\t\t\tconst range = this.map[i];\n\t\t\tif (range.containsOutputLine(line)) {\n\t\t\t\tthis.lookupIndex = i;\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate getSourceLineRangeForInputLine(line: number, id: number): SourceLineRange | undefined {\n\t\tfor (const range of this.map) {\n\t\t\tif (range.containsInputLine(line, id)) {\n\t\t\t\treturn range;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate shiftRangesBy(amount: number, atIndex: number) {\n\t\tfor (let i = atIndex; i < this.map.length; i++) {\n\t\t\t(this.map[i]).shiftOutputLines(amount);\n\t\t}\n\t}\n\n\tprivate handleExpansion(record: ExpansionRecord) {\n\t\tconst expansionRange = this.createSourceLineRange(record);\n\t\tlet expandedSource: SourceLineRange | undefined;\n\n\t\t// Handle the case where the expansion comes at the end of file (right after the last range)\n\t\tif (expansionRange.getOutputStartLine() - (this.map[this.map.length - 1]).getOutputEndLine() === 1) {\n\t\t\tif (expansionRange.getInputStartLine() === expansionRange.getInputEndLine()) {\n\t\t\t\tthis.map.push(expansionRange);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\t// 05/25/09: There are currently no regular expansion events where the input start and input end lines are different,\n\t\t// so there is currently no implementation to handle such events, \n\t\t// and this code should only be reached by negative expansion events.\n\t\telse if (expansionRange.getInputStartLine() !== expansionRange.getInputEndLine() || (expansionRange.getOutputStartLine() === 0 && expansionRange.getOutputEndLine() === 0)) {\n\t\t\texpandedSource = this.getSourceLineRangeForInputLine(expansionRange.getInputStartLine(), expansionRange.getInputFileID());\n\t\t} else {\n\t\t\texpandedSource = this.getSourceLineRangeForOutputLine(expansionRange.getOutputStartLine());\n\t\t}\n\n\t\tthis.splitExpandedSourceLineRange(expansionRange, expandedSource!);\n\t}\n\n\tprivate splitExpandedSourceLineRange(expansion: SourceLineRange, expanded: SourceLineRange) {\n\t\tconst index = this.map.indexOf(expanded);\n\t\tconst isExpansionNegative = expansion.getOutputStartLine() === 0 && expansion.getOutputEndLine() === 0;\n\t\tconst expansionSize = (isExpansionNegative) ?\n\t\t\texpansion.getInputStartLine() - expansion.getInputEndLine() - 1 :\n\t\t\texpansion.getOutputEndLine() - expansion.getOutputStartLine() + 1;\n\n\n\t\t// Handle a negative expansion event\n\t\tif (isExpansionNegative) {\n\t\t\tif (expansion.getInputStartLine() === expanded.getInputStartLine() && expansion.getInputEndLine() === expanded.getInputEndLine()) {\n\t\t\t\t// Assume 1 to 1 mapping\n\t\t\t\tthis.map.splice(index, 1);\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index);\n\t\t\t} else if (expansion.getInputStartLine() === expanded.getInputStartLine()) {\n\t\t\t\texpanded.setInputStartLine(expansion.getInputEndLine() + 1);\n\t\t\t\texpanded.setOutputStartLine(expanded.getOutputStartLine() + Math.abs(expansionSize));\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index);\n\t\t\t} else if (expansion.getInputEndLine() === expanded.getInputEndLine()) {\n\t\t\t\t//Assume 1 to 1 mapping\n\t\t\t\texpanded.setInputEndLine(expansion.getInputStartLine() - 1);\n\t\t\t\texpanded.setOutputEndLine(expanded.getOutputEndLine() - Math.abs(expansionSize));\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index + 1);\n\t\t\t} else {\n\t\t\t\tconst extraRange = new SourceLineRange(expanded);\n\n\t\t\t\texpanded.setInputEndLine(expansion.getInputStartLine() - 1);\n\t\t\t\texpanded.fixOutputRangeBasedOnInputRange();\n\n\t\t\t\textraRange.setInputStartLine(expansion.getInputEndLine() + 1);\n\t\t\t\textraRange.setOutputStartLine(expanded.getOutputEndLine() + Math.abs(expansionSize) + 1);\n\n\t\t\t\tthis.map.splice(index + 1, 0, extraRange);\n\n\t\t\t\tthis.shiftRangesBy(expansionSize, index + 1);\n\t\t\t}\n\t\t} else if (expanded.getOutputStartLine() === expansion.getOutputStartLine()) {\n\t\t\t// Only supports expansions where expansion.getInputStartLine() === expansion.getInputEndLine()\n\n\t\t\t// Insert the expansion before the current range\n\t\t\t// (to keep the output ranges sorted), and then\n\t\t\t// shift the output ranges by amount of expansion.\n\t\t\tif (expansion.getInputStartLine() === expansion.getInputEndLine()) {\n\t\t\t\tthis.map.splice(index, 0, expansion);\n\t\t\t\tthis.shiftRangesBy(expansionSize, index + 1);\n\n\t\t\t}\n\t\t}\n\n\t\t// Not necessary - handled the same way as generic case:\n\t\t// else if(expanded.getOutputEndLine() === expansion.getOutputEndLine()){\n\t\t// }\n\n\t\t// Handle generic case\n\t\telse {\n\t\t\t// Only supports expansions where expansion.getInputStartLine() === expansion.getInputEndLine()\n\n\t\t\t// Split the current range in half at the point of expansion's output start,\n\t\t\t// insert the expansion between the two halves, and shift the outputs of the\n\t\t\t// remaining ranges (starting with the second half) by the mount of the expansion.\n\t\t\tconst extraRange = new SourceLineRange(expanded);\n\n\t\t\texpanded.setOutputEndLine(expansion.getOutputStartLine() - 1);\n\t\t\texpanded.fixInputRangeBasedOnOutputRange();\n\n\t\t\tthis.map.splice(index + 1, 0, expansion);\n\n\t\t\textraRange.setInputStartLine(expanded.getInputEndLine() + 1);\n\t\t\textraRange.setOutputStartLine(expanded.getOutputEndLine() + 1);\n\t\t\tthis.map.splice(index + 2, 0, extraRange);\n\n\t\t\tthis.shiftRangesBy(expansionSize, index + 2);\n\t\t}\n\t}\n\n\tprivate createSourceLineRange(record: ExpansionRecord): SourceLineRange {\n\t\tconst range = new SourceLineRange(record.getInputFileID());\n\n\t\tlet iStart = 0, iEnd = 0, oStart = 0, oEnd = 0;\n\t\ttry {\n\t\t\tiStart = record.getInputLineStart();\n\t\t\tiEnd = record.getInputLineEnd();\n\t\t\toStart = record.getOutputLineStart();\n\t\t\toEnd = record.getOutputLineEnd();\n\t\t} catch (e: any) {\n\t\t\tthrow new Error(`Unable to parse the fields of the EXPANSION record to integers\\n`\n\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t}\n\n\t\trange.setInputStartLine(iStart);\n\t\trange.setInputEndLine(iEnd);\n\t\trange.setOutputStartLine(oStart);\n\t\trange.setOutputEndLine(oEnd);\n\n\t\treturn range;\n\t}\n\n\t/**\n\t * Returns the QSYSEventsFileFileIDRecord corresponding to a file ID.\n\t * \n\t * @param ID The ID of the file to look for.\n\t * @return The FileIDRecord corresponding to the file ID if it exists in the table, `undefined` otherwise.\n\t */\n\tpublic getFileIDRecordForFileID(ID: number): FileIDRecord | undefined {\n\t\treturn this.fileTable.get(ID);\n\t}\n\n\tpublic getFileLocationForFileID(ID: number): string | undefined {\n\t\tconst fileRecord = this.getFileIDRecordForFileID(ID);\n\n\t\tif (fileRecord) {\n\t\t\treturn fileRecord.getFileName();\n\t\t}\n\t}\n\n\t/**\n\t * Modifies the information contained in the Error record based on the available map.\n\t * \n\t * @param record The Error record to be modified.\n\t */\n\tpublic modifyErrorInformation(record: ErrorInformationRecord) {\n\t\tconst statementLine = record.getStmtLine();\n\t\tconst range = this.optimizedSourceLineRangeLookup(statementLine);\n\n\t\tif (!range) {\n\t\t\tthrow new Error(`The line number on which ERROR occurs could not be found in the map.\\n`\n\t\t\t\t+ `Faulty event: ${record.toString()}`);\n\t\t} else {\n\t\t\ttry {\n\t\t\t\trecord.setStmtLine(this.getLineFromSourceLineRange(range, statementLine));\n\t\t\t\trecord.setFileId(range.getInputFileID());\n\n\t\t\t\tconst startLineNumber = record.getStartErrLine();\n\t\t\t\trecord.setStartErrLine(this.getLineFromSourceLineRange(range, startLineNumber));\n\n\t\t\t\tconst endLineNumber = record.getEndErrLine();\n\t\t\t\trecord.setEndErrLine(this.getLineFromSourceLineRange(range, endLineNumber));\n\n\t\t\t\trecord.setFileName((this.fileTable.get(range.getInputFileID())!).getFileName());\n\t\t\t} catch (e: any) {\n\t\t\t\tthrow new Error(`Unable to parse the line fields of the ERROR record to integers\\n`\n\t\t\t\t\t+ `Faulty record: ${record.toString()}`);\n\t\t\t}\n\n\t\t}\n\t}\n\n\t/**\n\t * Calculates the line number based on the initial number and how many lines where \n\t * shifted in the expansion process.\n\t * \n\t * @param range `SourceLineRange` that contains mapping information.\n\t * @param initial The line number.\n\t * @return The new line number.\n\t */\n\tprivate getLineFromSourceLineRange(range: SourceLineRange, initial: number): number {\n\t\tif (!range) {\n\t\t\treturn initial;\n\t\t}\n\n\t\tif (range.getInputEndLine() - range.getInputStartLine() === range.getOutputEndLine() - range.getOutputStartLine()) {\n\t\t\treturn initial - range.getOutputStartLine() + range.getInputStartLine();\n\t\t}\n\t\t// Temporary fix for the problem where all errors in the last range get mapped to getInputStartLine\n\t\t// when the last range has open bounds\n\t\telse if (range.getInputEndLine() === -1 && range.getOutputEndLine() === -1) {\n\t\t\treturn initial - range.getOutputStartLine() + range.getInputStartLine();\n\t\t} else {\n\t\t\treturn range.getInputStartLine();\n\t\t}\n\t}\n\n\tpublic finalizeMap() {\n\t\tif (!this.files.isEmpty()) {\n\t\t\tthrow new Error(\n\t\t\t\t`One or more FILEID records do not have matching FILEEND records\\n`\n\t\t\t\t+ `List of outstanding FILEID records: ${JSON.stringify(this.files)}`);\n\t\t}\n\n\t\tthis.queueExpansion.forEach(expansion => {\n\t\t\tthis.handleExpansion(expansion);\n\t\t});\n\n\t\t// This handles errors at line 0 of the main source file.\n\t\t// Those are usually sev 40 errors.\n\t\tconst header = new SourceLineRange(1);\n\t\theader.setInputStartLine(0);\n\t\theader.setInputEndLine(0);\n\t\theader.setOutputStartLine(0);\n\t\theader.setOutputEndLine(0);\n\n\t\tthis.map.unshift(header);\n\t}\n\n\t/**\n\t * Prints the map.\n\t */\n\tpublic toString(): string {\n\t\tlet buffer = '';\n\n\t\tthis.map.forEach(range => {\n\t\t\tbuffer += `${range.getInputFileID()}: [${range.getInputStartLine()},${range.getInputEndLine()}]`\n\t\t\t\t+ `-->[${range.getOutputStartLine()},${range.getOutputEndLine()}]\\n`;\n\t\t});\n\n\t\treturn buffer;\n\t}\n\n\t/**\n\t * Get all file locations.\n\t */\n\tpublic getAllFileIDRecords(): FileIDRecord[] {\n\t\tif (!this.fileTable || this.fileTable.size === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst fileIDRecords = new Set<FileIDRecord>();\n\n\t\tfor (let key of this.fileTable.keys()) {\n\t\t\tconst fileIDRecord = this.fileTable.get(key)!;\n\t\t\tfileIDRecords.add(fileIDRecord);\n\t\t}\n\n\t\treturn Array.from(fileIDRecords.values());\n\t}\n}\n\ninterface Stack<T> {\n\tpush(item: T): void;\n\tpop(): T | undefined;\n\tpeek(): T | undefined;\n\tisEmpty(): boolean;\n\tsize(): number;\n}\n\nclass ArrayStack<T> implements Stack<T> {\n\tprivate stack: T[] = [];\n\n\tpush(item: T): void {\n\t\tthis.stack.push(item);\n\t}\n\n\tpop(): T | undefined {\n\t\treturn this.stack.pop();\n\t}\n\n\tpeek(): T | undefined {\n\t\treturn this.stack[this.stack.length - 1];\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this.stack.length === 0;\n\t}\n\n\tsize(): number {\n\t\treturn this.stack.length;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from './record/IRecordT';\nimport { TimestampRecord } from './record/TimestampRecord';\nimport { ProcessorRecord } from './record/ProcessorRecord';\nimport { FileIDRecord } from './record/FileIDRecord';\nimport { IProcessor } from './IProcessor';\nimport { ISequentialFileReader } from './ISequentialFileReader';\nimport { IMarkerCreator } from './IMarkerCreator';\nimport { ErrorInformationRecord } from './record/ErrorInformationRecord';\nimport { FileEndRecord } from './record/FileEndRecord';\nimport { ExpansionRecord } from './record/ExpansionRecord';\nimport { ExpansionProcessor } from './ExpansionProcessor';\nimport normalize from 'path-normalize';\n\nclass SourceFile {\n constructor(private location: string, private browseMode: boolean) { }\n\n public getLocation(): string {\n return this.location;\n }\n\n public isReadOnly(): string {\n return this.browseMode.toString();\n }\n\n public setReadOnly(value: boolean) {\n // A member should be opened in browse mode\n this.browseMode = value;\n }\n}\n\nclass LookAheadReader implements ISequentialFileReader {\n private iSequentialFileReader: ISequentialFileReader;\n private peakLine: string | undefined;\n\n constructor(iSequentialFileReader: ISequentialFileReader) {\n this.iSequentialFileReader = iSequentialFileReader;\n }\n\n readNextLine(): string | undefined {\n if (this.peakLine) {\n const nextLine = this.peakLine;\n this.peakLine = undefined;\n\n return nextLine;\n } else {\n return this.iSequentialFileReader.readNextLine();\n }\n }\n\n peakNextRecordType() {\n this.peakLine = this.iSequentialFileReader.readNextLine();\n return this.peakLine?.split(/\\s+/).filter(token => token !== \"\")[0];\n }\n}\n\nexport class Parser {\n private _loggingEnabled: boolean = false;\n private exception: Error | undefined;\n private processor: IProcessor | undefined;\n private lastOutputFile: SourceFile | undefined;\n private currentOutputFile: SourceFile | undefined;\n\n // Map of File ID to SourceFile\n private sourceTable: Map<number, SourceFile>;\n\n constructor() {\n this.sourceTable = new Map<number, SourceFile>();\n }\n\n private getUntilTheEndOfTheLine(startIndex: number, st: string[]): string {\n let message = st[startIndex++];\n while (startIndex < st.length) {\n message = message.concat(' ');\n let curr_msg = st[startIndex++];\n message = message.concat(curr_msg);\n }\n return message;\n }\n\n /**\n * Enable or disable logging.\n *\n * @param {boolean} enable true to enable or false to disable logging\n */\n loggingEnabled(enable: boolean) {\n this._loggingEnabled = enable;\n }\n\n private log(content: string) {\n if (this._loggingEnabled) {\n console.log(content);\n }\n }\n\n /**\n * To parse an eventf generated by an IBM i compiler. \n * @param fileReader a generic reader implementing {@link ISequentialFileReader}. \n * @param markerCreator optionally passing in an object implementing {@link IMarkerCreator}\n * allows the parser to call this object back with each error. The original source\n * file name and error location and error message will be in the information provided\n * on the callback\n */\n parse(fileReader: ISequentialFileReader, markerCreator?: IMarkerCreator) {\n let word: string;\n let fileId: number;\n\n if (!this.processor) {\n this.processor = new ExpansionProcessor();\n }\n // Allows processor to initialize prior to parsing\n this.processor?.doPreProcessing();\n\n const reader = new LookAheadReader(fileReader);\n let lineText = reader.readNextLine();\n\n while (lineText) {\n let st = lineText.split(/\\s+/).filter(token => token !== \"\");\n let i = 0\n\n while (i < st.length) {\n word = st[i++];\n\n if (word === IRecordT.ERROR_INFORMATION) {\n const version = parseInt(st[i++]);\n fileId = parseInt(st[i++]);\n\n let fileProcessed = this.sourceTable.get(fileId);\n if (!fileProcessed) {\n // If file ID is '000' we can assume that it is the second file after the '999' output file\n if (fileId === 0) {\n let location001 = this.sourceTable.get(1);\n if (location001) {\n fileProcessed = location001;\n } else {\n fileProcessed = new SourceFile('', false);\n }\n } else {\n fileProcessed = new SourceFile('', false);\n }\n }\n\n const annotationClass = parseInt(st[i++]);\n const line = parseInt(st[i++]);\n const lineStart = parseInt(st[i++]);\n const charStart = parseInt(st[i++]);\n const lineEnd = parseInt(st[i++]);\n const charEnd = parseInt(st[i++]);\n const id = st[i++];\n const severityText = st[i++];\n const severity = parseInt(st[i++]);\n\n const totalMessageLen = parseInt(st[i++]);\n const message = this.getUntilTheEndOfTheLine(i, st);\n\n // Previous implementation used the location length to determine how many records to \n // read in. This requires NLS process to account for differences in character length \n // between the encoding in the original EVENTF and the current one being parsed.\n // To avoid this, we simply read all subsequent records that are of the continued type\n //\n // let msgToken = st.nextToken('\\n\\r\\f');\n // let msgTokenNl = new StringNL(msgToken, ccsid, true);\n\n // msgTokenNl = msgTokenNl.trim();\n // message = msgTokenNl.convertFromVisualToLogical(true);\n // let messageLenCorrect = true;\n // if (msgTokenNl.getByteLength() > totalMessageLen) {\n // message = msgTokenNl.substring(0, totalMessageLen).convertFromVisualToLogical(true);\n // } else {\n // while ((msgTokenNl.getByteLength() < totalMessageLen) && messageLenCorrect) {\n // lineText = reader.readNextLine();\n // if (lineText === null) {\n // let log = 'EventsFileParser: ' + MessageFormat.format(Messages.EventsFileParser_Incomplete_Msg, totalMessageLen, totalMessageLen, message);\n // this.LOGGER.info(log);\n // messageLenCorrect = false;\n // msgToken = '';\n // break;\n // }\n // let stcont = new StringTokenizer(lineText);\n // msgToken = stcont.nextToken('\\n\\r\\f');\n // msgTokenNl = new StringNL(msgToken, ccsid, true);\n // stcont = new StringTokenizer(msgToken);\n // let lineType = stcont.get(i++);\n // if (lineType === (RecordType.TIMESTAMP) || lineType === (RecordType.PROCESSOR) || lineType === (RecordType.FILE_ID) || lineType === (RecordType.FILE_CONT) || lineType === (RecordType.FILE_END) || lineType === (RecordType.ERROR_INFORMATION) || lineType === (RecordType.PROGRAM) || lineType === (RecordType.MAP_DEFINE) || lineType === (RecordType.MAP_END) || lineType === (RecordType.MAP_START) || lineType === (RecordType.FEEDBACK_CODE)) {\n // messageLenCorrect = false;\n // break;\n // }\n // readMsgLen += msgTokenNl.getByteLength();\n // message += ' ' + msgTokenNl.trim().convertFromVisualToLogical(true);\n // }\n // }\n\n const record = new ErrorInformationRecord(version, fileId, annotationClass, line, lineStart, charStart,\n lineEnd, charEnd, id, severityText, severity, totalMessageLen, message);\n record.setFileName(fileProcessed.getLocation());\n\n if (this.processor) {\n this.processor.processErrorRecord(record);\n }\n\n // if (!messageLenCorrect) {\n // st = new StringTokenizer(msgToken);\n // st = msgToken.split(\" \")\n // continue;\n // }\n\n break;\n } else if (word === (IRecordT.FILE_ID)) {\n let browseMode = false;\n const version = parseInt(st[i++]);\n fileId = parseInt(st[i++]);\n const lineNumber = parseInt(st[i++]);\n const locationLength = parseInt(st[i++]);\n let location = lineText.substring(28);\n\n this.log(`EventsFileParser: location from line 1 = ${location}`);\n let nextRecordType = reader.peakNextRecordType();\n while (nextRecordType === IRecordT.FILE_CONT) {\n lineText = reader.readNextLine();\n if (lineText) {\n st = lineText.split(' ');\n location += (lineText.substring(28));\n this.log(`EventsFileParser: location from line 1 = ${location}`);\n nextRecordType = reader.peakNextRecordType();\n } else {\n throw new Error('Events file has incorrect format. End of file encountered before location length satisfied.');\n }\n }\n\n // Attempt to parse the FILEID string backwards in order to find the timestamp and temp flag\n // Timestamp should only be made of digits if it was parsed correctly. Otherwise, just ignore it.\n let timestamp = location.substring(location.length - 16, location.length - 2);\n try {\n parseInt(timestamp);\n } catch (e: any) {\n timestamp = '';\n }\n const tempFlag = parseInt(location.charAt(location.length - 1));\n\n // Makes sure that the Temp Flag is the last character in the FILEID event and that it is preceded by a space\n const isSpaceBeforeTempFlag = location.charAt(location.length - 2) === ' ';\n if (tempFlag === 1 && isSpaceBeforeTempFlag) {\n browseMode = true;\n } else {\n browseMode = false;\n }\n\n location = location.substring(0, location.length - 17);\n location = this.resolveRelativePath(location);\n\n // If this file was the output file of the previous block, then it should be opened in Browse Mode\n const fileEntry = new SourceFile(location, browseMode);\n if ((this.lastOutputFile && location === (this.lastOutputFile.getLocation()))\n || this.currentOutputFile && location === (this.currentOutputFile.getLocation())) {\n fileEntry.setReadOnly(true);\n }\n\n // If the file ID is 999, then this is the new output file\n if (fileId === 999) {\n if (!this.lastOutputFile) {\n this.lastOutputFile = this.currentOutputFile = fileEntry;\n } else {\n this.lastOutputFile = this.currentOutputFile;\n this.currentOutputFile = fileEntry;\n }\n }\n\n this.sourceTable.set(fileId, fileEntry);\n\n if (this.processor) {\n // Pass FILEID information to processor\n const record = new FileIDRecord(version, fileId, lineNumber, locationLength, location, timestamp.toString(), tempFlag);\n try {\n this.processor.processFileIDRecord(record);\n } catch (e: any) {\n const errorMessage = e.message ? e.message : e;\n this.log(errorMessage);\n this.exception = new Error(errorMessage);\n }\n }\n\n break;\n } else if (word === (IRecordT.FILE_END)) {\n // Pass FILEEND information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const fileId = parseInt(st[i++]);\n const expansion = parseInt(st[i++]);\n const record = new FileEndRecord(version, fileId, expansion);\n\n try {\n this.processor?.processFileEndRecord(record);\n } catch (e: any) {\n const errorMessage = e.message ? e.message : e;\n this.log(errorMessage);\n this.exception = new Error(errorMessage);\n }\n }\n\n break;\n } else if (word === (IRecordT.EXPANSION)) {\n // Pass EXPANSION information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const inputFileID = parseInt(st[i++]);\n const inputLineStart = parseInt(st[i++]);\n const inputLineEnd = parseInt(st[i++]);\n const outputFileID = parseInt(st[i++]);\n const outputLineStart = parseInt(st[i++]);\n const outputLineEnd = parseInt(st[i++]);\n const record = new ExpansionRecord(version, inputFileID, inputLineStart, inputLineEnd, outputFileID, outputLineStart, outputLineEnd);\n this.processor?.processExpansionRecord(record);\n }\n\n break;\n } else if (word === (IRecordT.TIMESTAMP)) {\n // Pass TIMESTAMP information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const timestamp = st[i++];\n let record = new TimestampRecord(version, timestamp);\n this.processor?.processTimestampRecord(record);\n }\n\n break;\n } else if (word === (IRecordT.PROCESSOR)) {\n // Pass PROCESSOR information to processor\n if (this.processor) {\n const version = parseInt(st[i++]);\n const outputId = parseInt(st[i++]);\n const lineClass = parseInt(st[i++]);\n let record = new ProcessorRecord(version, outputId, lineClass);\n\n try {\n this.processor?.processProcessorRecord(record);\n } catch (e: any) {\n const errorMessage = e.message ? e.message : e;\n this.log(errorMessage);\n this.exception = new Error(errorMessage);\n }\n }\n\n break;\n } else {\n // The following Events are being ignored since they are not used.\n // If needed, we could parse those Events and pass them to an IISeriesEventsFileProcessor.\n if (word === (IRecordT.PROGRAM) || word === (IRecordT.MAP_DEFINE) || word === (IRecordT.MAP_END)\n || word === (IRecordT.MAP_START) || word === (IRecordT.FEEDBACK_CODE) || word.trim().length === 0) {\n break;\n } else {\n throw new Error(`Events file has incorrect format. Unexpected line type. LT=${lineText}`);\n }\n }\n }\n\n if (lineText) {\n lineText = reader.readNextLine();\n }\n }\n\n if (this.processor) {\n // Allows processor to consume the information after completion of parsing and writing of markers\n try {\n this.processor?.doPostProcessing();\n } catch (e: any) {\n this.exception = new Error(e.message ? e.message : e)\n }\n }\n\n if (markerCreator) {\n const errors = this.getAllErrors();\n errors.forEach(record => {\n const sourceFile = this.sourceTable.get(record.getFileId());\n\n if (sourceFile) {\n markerCreator.createMarker(record, record.getFileName(), sourceFile.isReadOnly());\n }\n });\n }\n }\n\n private resolveRelativePath(location: string) {\n // Normalize the location in case the location is a relative path\n location = normalize(location).toString();\n\n // After normalization, / will be change to \\ for windows path,\n // so have to change it back.\n location = location.replace(/\\\\/g, '/');\n return location;\n }\n\n public getException(): Error | undefined {\n return this.exception;\n }\n\n public setProcessor(processor: IProcessor) {\n this.processor = processor;\n }\n\n /**\n * After all records in the Events File are processed, this method is called to\n * return all the errors from all the processor blocks (ProcessorBlock) of the\n * Events File. Since each ProcessorBlock contains an array of errors, the result\n * will be flattened to an array.\n * \n * @return An array of all parsed errors from all processor blocks of the Events File.\n */\n public getAllErrors(): ErrorInformationRecord[] {\n if (this.processor) {\n const nestedErrors = this.processor?.getAllErrors();\n let allErrors: ErrorInformationRecord[] = [];\n allErrors = allErrors.concat(...nestedErrors);\n\n return allErrors;\n } else {\n return [];\n }\n }\n\n /**\n * Get all file ID records.\n * \n * @return An array of all file ID records.\n */\n public getAllFileIDRecords(): FileIDRecord[] {\n if (this.processor) {\n return this.processor.getAllFileIDRecords();\n } else {\n return [];\n }\n }\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nimport { FileEndRecord } from \"./record/FileEndRecord\";\nimport { FileIDRecord } from \"./record/FileIDRecord\";\nimport { MapTable } from \"./MapTable\";\nimport { ProcessorRecord } from \"./record/ProcessorRecord\";\n\nexport class ProcessorBlock {\n // Default File ID for the input file of the processor block\n readonly INPUT_FILE_ID: number = 1;\n\n // Queue of all errors in this processor block\n private errors: ErrorInformationRecord[];\n\n // Input to the processor block\n private inputFile: FileIDRecord | undefined;\n\n // Output of the processor block\n private outputFile: FileIDRecord | undefined;\n\n // The PROCESSOR record\n private currentProcessor: ProcessorRecord;\n\n // The mapping table that keeps track of all copybooks and EXPANSIONs\n private mappingTable: MapTable;\n\n // Link to the previous processor block in the events File\n private previousProcessorBlock: ProcessorBlock | undefined;\n\n // Flags if the current processor block contains any EXPANSION events or not\n private containsExpansionEvents: boolean = false;\n\n // Needed for events files that contain multiple events files that have been combined into one (as done in iProjects).\n // Should get set to true for each first PROCESSOR in each \"sub\" events file.\n // The scope of this variable is only the current \"sub\" events file.\n private isFirstInEventsFile: boolean = false;\n\n // Set to true if current events file requires and supports mappings.\n // See ExpansionProcessor.isMappingSupportedByAnyEventsFiles() for more details.\n private mappingSupported: boolean = false;\n\n // Keep track of the number of lines in the output file\n private totalNumberOfLinesInOutputFile: number = 0;\n\n // Keep track of the total number of lines in all the input files\n private totalNumberOfLinesInInputFiles: number = 0;\n\n constructor(record: ProcessorRecord) {\n this.currentProcessor = record;\n this.mappingTable = new MapTable();\n this.errors = [];\n }\n\n public getInputFile(): FileIDRecord | undefined {\n return this.inputFile;\n }\n\n /**\n * Get the input file of the first processor block of the current events file.\n * \n * @return the input file of the first processor block of the current events file.\n */\n getInitialInputFile(): FileIDRecord | undefined {\n if (this.previousProcessorBlock && !this.getIsFirstInEventsFile()) {\n return this.previousProcessorBlock.getInitialInputFile();\n }\n return this.getInputFile();\n }\n\n public setInputFile(file: FileIDRecord) {\n this.inputFile = file;\n }\n\n public addFile(file: FileIDRecord) {\n this.mappingTable.addFileInformation(file);\n }\n\n public closeFile(file: FileEndRecord) {\n if (this.outputFile) {\n // Keep track of the total number of lines in all the input files\n if (!(file.getFileId() === (this.outputFile.getSourceId()))) {\n this.increaseTotalNumberOfLinesInInputFiles(file.getExpansion());\n } else {\n // Keep track of the number of lines in the output file\n this.setTotalNumberOfLinesInOutputFile(file.getExpansion());\n return;\n }\n\n this.mappingTable.closeFile(file);\n }\n }\n\n public getOutputFile(): FileIDRecord | undefined {\n return this.outputFile;\n }\n\n public setOutputFile(file: FileIDRecord) {\n this.outputFile = file;\n }\n\n public getMappingTable(): MapTable {\n return this.mappingTable;\n }\n\n public isProcessorIDZero() {\n const procID = this.currentProcessor.getOutputId();\n return procID === 0;\n }\n\n public addErrorInformation(record: ErrorInformationRecord) {\n this.errors.push(record);\n }\n\n public processorEnded() {\n this.mappingTable.finalizeMap();\n }\n public setPreviousProcessor(previous: ProcessorBlock) {\n this.previousProcessorBlock = previous;\n }\n\n public setContainsExpansionEvents(containsExpansionEvents: boolean) {\n this.containsExpansionEvents = containsExpansionEvents;\n }\n\n public getContainsExpansionEvents(): boolean {\n return this.containsExpansionEvents;\n }\n\n public increaseTotalNumberOfLinesInInputFiles(numberOfLines: number) {\n this.totalNumberOfLinesInInputFiles += numberOfLines;\n }\n\n public getTotalNumberOfLinesInInputFiles(): number {\n return this.totalNumberOfLinesInInputFiles;\n }\n\n public setTotalNumberOfLinesInOutputFile(numberOfLines: number) {\n this.totalNumberOfLinesInOutputFile = numberOfLines;\n }\n\n public getTotalNumberOfLinesInOutputFile(): number {\n return this.totalNumberOfLinesInOutputFile;\n }\n\n public getPreviousProcessorBlock(): ProcessorBlock | undefined {\n return this.previousProcessorBlock;\n }\n\n public modifyErrorInformation(error: ErrorInformationRecord) {\n // Map the error lines and location to the input file of this current PROCESSOR\n this.mappingTable.modifyErrorInformation(error);\n\n // If another processor was invoked, map the errors back to its input file.\n // Only modify error information if there was a previous processor and the error \n // points to the current input file. The FileId of the error was changed in \n // modifyErrorInformation, so need to compare with location rather than ID.\n // Since this method is only called on a _previousProcessorBlock, this is not\n // the compiler processor block and getInputFile() should not return null.\n let inputFileLocation = '';\n let inputFileId = -1;\n\n const inputFile = this.getInputFile();\n if (inputFile) {\n inputFileLocation = inputFile.getFileName();\n inputFileId = inputFile.getSourceId();\n }\n\n if (this.previousProcessorBlock && !this.getIsFirstInEventsFile() && this.isMappingSupported()\n && (error.getFileId() === (inputFileId) || error.getFileName() === (inputFileLocation))) {\n this.previousProcessorBlock.modifyErrorInformation(error);\n }\n }\n\n /**\n * Sets whether the current processor block is the first one in the current \"sub\" events file\n * (needed for events file that contains multiple events files that have been combined into one).\n * \n * @param isFirstInEventsFile\n */\n public setFirstInEventsFile(isFirstInEventsFile: boolean) {\n this.isFirstInEventsFile = isFirstInEventsFile;\n }\n\n /**\n * Returns whether the current processor block is the first one in the current \"sub\" events file\n * (needed for events file that contains multiple events files that have been combined into one).\n * \n * @return True if the current processor block is the first one in the current \"sub\" events file, false otherwise.\n */\n public getIsFirstInEventsFile(): boolean {\n return this.isFirstInEventsFile;\n }\n\n public setMappingSupported(mappingSupported: boolean) {\n this.mappingSupported = mappingSupported;\n }\n\n public isMappingSupported(): boolean {\n return this.mappingSupported;\n }\n\n /**\n * Determines whether a file in the current processor block is read-only or not.\n * A file is considered read-only if it is a temporary file created by an SQL pre-compiler.\n * \n * @param fileRecord The FileIDRecord of the file to check.\n * @return True if the file is read-only, false otherwise.\n */\n public isFileReadOnly(fileIDRecord: FileIDRecord): boolean {\n // True if the temporary flag of the file is 1 (indicating temp member)\n // or the file is the same as the output file of the current or previous processor block\n return fileIDRecord.getFlag() === 1\n || ((this.previousProcessorBlock && !this.getIsFirstInEventsFile())\n && this.previousProcessorBlock.getOutputFile() !== undefined\n && fileIDRecord.getFileName() === (this.previousProcessorBlock.getOutputFile()!.getFileName()))\n || (this.getOutputFile() !== undefined && fileIDRecord.getFileName() === (this.getOutputFile()!.getFileName()));\n }\n\n /**\n * This method is used by the test for event file processing.\n * \n * This method returns all errors in this and all previous processor blocks. \n * Since each ProcessorBlock contains an array of errors, the result will be \n * returned as an array of those arrays.\n * \n * This method is called by ExpansionProcessor.getAllErrors().\n * \n * @return An array of arrays of all parsed errors from the current and all\n * previous processor blocks (one list for each processor block).\n */\n public getAllProcessorErrors(): ErrorInformationRecord[][] {\n let allPrevErrs: ErrorInformationRecord[][] = [];\n\n if (this.previousProcessorBlock) {\n allPrevErrs = this.previousProcessorBlock.getAllProcessorErrors();\n }\n\n allPrevErrs.push(this.errors);\n return allPrevErrs;\n }\n\n public resolveFileNamesForAllErrors() {\n if (this.previousProcessorBlock) {\n this.previousProcessorBlock.resolveFileNamesForAllErrors();\n }\n\n this.errors.forEach(error => {\n this.resolveFileNameAndDetermineIfReadOnly(error);\n });\n }\n\n /**\n * Maps the error back to the original input member and resolves the \n * file name of that member. If mappings are not supported, checks and \n * returns whether that member is read-only.\n * \n * @param error The ErrorInformationRecord to resolve.\n * @return True if mappings are not supported and the member that the\n * error points to is read-only, false otherwise.\n */\n public resolveFileNameAndDetermineIfReadOnly(error: ErrorInformationRecord): boolean {\n let readOnly = false;\n\n if (this.previousProcessorBlock && !this.getIsFirstInEventsFile() && this.isMappingSupported() && error.getFileId() === (this.INPUT_FILE_ID)) {\n this.previousProcessorBlock.modifyErrorInformation(error);\n } else {\n const fileLocation = this.mappingTable.getFileLocationForFileID(error.getFileId());\n\n if (fileLocation) {\n const fileIDRecord = this.mappingTable.getFileIDRecordForFileID(error.getFileId());\n readOnly = fileIDRecord ? this.isFileReadOnly(fileIDRecord) : false;\n error.setFileName(fileLocation);\n } else {\n const initialInputFile = this.getInitialInputFile();\n readOnly = initialInputFile ? this.isFileReadOnly(initialInputFile) : false;\n\n // If getFileLocationForFileID returns null, that means that the\n // file with fileId of the error is not in the fileTable, most\n // likely because it is an output file. Map this error to the\n // top of the input file of this processor.\n error.setFileName(initialInputFile?.getFileName() || '');\n error.setStmtLine(0);\n error.setStartErrLine(0);\n error.setTokenStart(0);\n error.setEndErrLine(0);\n error.setTokenEnd(0);\n }\n }\n\n return readOnly;\n }\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a Error Information record in an events file.\n */\nexport class ErrorInformationRecord implements IRecord {\n\t// Source file name corresponding to file id - is computed later\n\tprivate fileName: string = \"\";\n\n\tconstructor(private version: number, private fileId: number, private annotClass: number,\n\t\tprivate stmtLine: number, private startErrLine: number, private tokenStart: number,\n\t\tprivate endErrLine: number, private tokenEnd: number, private msgId: string,\n\t\tprivate sevChar: string, private sevNum: number, private length: number,\n\t\tprivate msg: string) { }\n\n\tgetRecordType(): IRecordT {\n\t\treturn IRecordT.ERROR_INFORMATION;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the file id.\n\t * \n\t * @return The file id.\n\t */\n\tpublic getFileId(): number {\n\t\treturn this.fileId;\n\t}\n\n\t/**\n\t * Set the file id.\n\t * \n\t * @param fileId The file id.\n\t */\n\tpublic setFileId(fileId: number) {\n\t\tthis.fileId = fileId;\n\t}\n\n\t/**\n\t * Get the file name.\n\t * \n\t * @return The file id.\n\t */\n\tpublic getFileName(): string {\n\t\treturn this.fileName;\n\t}\n\n\t/**\n\t * Set the file name.\n\t * \n\t * @param fileName The file id.\n\t */\n\tpublic setFileName(fileName: string) {\n\t\tthis.fileName = fileName;\n\t}\n\n\t/**\n\t * Get the annotation class.\n\t * \n\t * @return The annotation class.\n\t */\n\tpublic getAnnotClass(): number {\n\t\treturn this.annotClass;\n\t}\n\n\t/**\n\t * Get the statement line.\n\t * \n\t * @return The statement line.\n\t */\n\tpublic getStmtLine(): number {\n\t\treturn this.stmtLine;\n\t}\n\n\t/**\n\t * Set the statement line.\n\t * \n\t * @param stmtLine The statement line.\n\t */\n\tpublic setStmtLine(stmtLine: number) {\n\t\tthis.stmtLine = stmtLine;\n\t}\n\n\t/**\n\t * Get the starting error line.\n\t * \n\t * @return The starting error line.\n\t */\n\tpublic getStartErrLine(): number {\n\t\treturn this.startErrLine;\n\t}\n\n\t/**\n\t * Set the starting error line.\n\t * \n\t * @param startErrLine The starting error line.\n\t */\n\tpublic setStartErrLine(startErrLine: number) {\n\t\tthis.startErrLine = startErrLine;\n\t}\n\n\t/**\n\t * Get the starting error column.\n\t * \n\t * @return The starting error column.\n\t */\n\tpublic getTokenStart(): number {\n\t\treturn this.tokenStart;\n\t}\n\n\t/**\n\t * Set the starting error column.\n\t * \n\t * @param tokenStart The starting error column.\n\t */\n\tpublic setTokenStart(tokenStart: number) {\n\t\tthis.tokenStart = tokenStart;\n\t}\n\n\t/**\n\t * Get the ending error line.\n\t * \n\t * @return The ending error line.\n\t */\n\tpublic getEndErrLine(): number {\n\t\treturn this.endErrLine;\n\t}\n\n\t/**\n\t * Set the ending error line.\n\t * \n\t * @param endErrLine The ending error line.\n\t */\n\tpublic setEndErrLine(endErrLine: number) {\n\t\tthis.endErrLine = endErrLine;\n\t}\n\n\t/**\n\t * Get the ending error column.\n\t * \n\t * @return The ending error column.\n\t */\n\tpublic getTokenEnd(): number {\n\t\treturn this.tokenEnd;\n\t}\n\n\t/**\n\t * Set the ending error column.\n\t * \n\t * @param tokenEnd The ending error column.\n\t */\n\tpublic setTokenEnd(tokenEnd: number) {\n\t\tthis.tokenEnd = tokenEnd;\n\t}\n\n\t/**\n\t * Get the message id.\n\t * \n\t * @return The message id.\n\t */\n\tpublic getMsgId(): string {\n\t\treturn this.msgId;\n\t}\n\n\t/**\n\t * Get the severity code.\n\t * \n\t * @return The severity code.\n\t */\n\tpublic getSevChar(): string {\n\t\treturn this.sevChar;\n\t}\n\n\t/**\n\t * Get the severity level number.\n\t * \n\t * @return The severity level number.\n\t */\n\tpublic getSevNum(): number {\n\t\treturn this.sevNum;\n\t}\n\n\t/**\n\t * Get the length of the message.\n\t * \n\t * @return The length of the message.\n\t */\n\tpublic getLength(): number {\n\t\treturn this.length;\n\t}\n\n\t/**\n\t * Get the message.\n\t * \n\t * @return The message.\n\t */\n\tpublic getMsg(): string {\n\t\treturn this.msg;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.ERROR_INFORMATION}\\t`\n\t\t\t+ `${this.version} ${this.fileId} ${this.annotClass} ${this.stmtLine} ${this.startErrLine} `\n\t\t\t+ `${this.tokenStart} ${this.endErrLine} ${this.tokenEnd} ${this.msgId} ${this.sevChar} `\n\t\t\t+ `${this.sevNum} ${this.length} ${this.msg}`;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents an Expansion record in an Events File.\n */\nexport class ExpansionRecord implements IRecord {\n\tconstructor(private version: number, private inputFileID: number, private inputLineStart: number,\n\t\tprivate inputLineEnd: number, private outputFileID: number, private outputLineStart: number,\n\t\tprivate outputLineEnd: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.EXPANSION;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the input file ID.\n\t * \n\t * @return The input file ID.\n\t */\n\tpublic getInputFileID(): number {\n\t\treturn this.inputFileID;\n\t}\n\n\t/**\n\t * Get the input line start.\n\t * \n\t * @return The input line start.\n\t */\n\tpublic getInputLineStart(): number {\n\t\treturn this.inputLineStart;\n\t}\n\n\t/**\n\t * Get the input line end.\n\t * \n\t * @return The input line end.\n\t */\n\tpublic getInputLineEnd(): number {\n\t\treturn this.inputLineEnd;\n\t}\n\n\t/**\n\t * Get the output file ID.\n\t * \n\t * @return The output file ID.\n\t */\n\tpublic getOutputFileID(): number {\n\t\treturn this.outputFileID;\n\t}\n\n\t/**\n\t * Get the output line start.\n\t * \n\t * @return The output line start.\n\t */\n\tpublic getOutputLineStart(): number {\n\t\treturn this.outputLineStart;\n\t}\n\n\t/**\n\t * Get the output line end.\n\t * \n\t * @return The output line end.\n\t */\n\tpublic getOutputLineEnd(): number {\n\t\treturn this.outputLineEnd;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.EXPANSION}\\t`\n\t\t\t+ `${this.version} ${this.inputFileID} ${this.inputLineStart} ${this.inputLineEnd} ${this.outputFileID} `\n\t\t\t+ `${this.outputLineStart} ${this.outputLineEnd}`;\n\t}\n}\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a File End record in an events file.\n */\nexport class FileEndRecord implements IRecord {\n\tconstructor(private version: number, private fileId: number, private expansion: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.FILE_END;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the file id.\n\t * \n\t * @return The file id.\n\t */\n\tpublic getFileId(): number {\n\t\treturn this.fileId;\n\t}\n\n\t/**\n\t * Get the expansion.\n\t * \n\t * @return The expansion.\n\t */\n\tpublic getExpansion(): number {\n\t\treturn this.expansion;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.FILE_END}\\t`\n\t\t\t+ `${this.version} ${this.fileId} ${this.expansion}`;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a File ID record in an events file.\n */\nexport class FileIDRecord implements IRecord {\n\tconstructor(private version: number, private sourceId: number, private line: number,\n\t\tprivate length: number, private fileName: string, private timestamp: string,\n\t\tprivate flag: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.FILE_ID;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the source id.\n\t * \n\t * @return The source id.\n\t */\n\tpublic getSourceId(): number {\n\t\treturn this.sourceId;\n\t}\n\n\t/**\n\t * Get the line.\n\t * \n\t * @return The line.\n\t */\n\tpublic getLine(): number {\n\t\treturn this.line;\n\t}\n\n\t/**\n\t * Get the length.\n\t * \n\t * @return The length.\n\t */\n\tpublic getLength(): number {\n\t\treturn this.length;\n\t}\n\n\t/**\n\t * Get the file name.\n\t * \n\t * @return The file name.\n\t */\n\tpublic getFileName(): string {\n\t\treturn this.fileName;\n\t}\n\n\t/**\n\t * Get the timestamp.\n\t * \n\t * @return The timestamp.\n\t */\n\tpublic getTimestamp(): string {\n\t\treturn this.timestamp;\n\t}\n\n\t/**\n\t * Get the flag.\n\t * \n\t * @return The flag.\n\t */\n\tpublic getFlag(): number {\n\t\treturn this.flag;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.FILE_ID}\\t`\n\t\t\t+ `${this.version} ${this.sourceId} ${this.line} ${this.length} ${this.fileName} `\n\t\t\t+ `${this.timestamp} ${this.flag}`;\n\t}\n}\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\n/**\n * This interface should be implemented by all classes that represent\n * records in an events file.\n */\nexport enum IRecordT {\n TIMESTAMP = \"TIMESTAMP\",\n PROCESSOR = \"PROCESSOR\",\n FILE_ID = \"FILEID\",\n FILE_CONT = \"FILEIDCONT\",\n FILE_END = \"FILEEND\",\n ERROR_INFORMATION = \"ERROR\",\n PROGRAM = \"PROGRAM\",\n MAP_DEFINE = \"MAPDEFINE\",\n MAP_START = \"MAPSTART\",\n MAP_END = \"MAPEND\",\n FEEDBACK_CODE = \"FEEDBACK\",\n EXPANSION = \"EXPANSION\"\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from \"./IRecordT\";\nimport { IRecord } from \"./IRecord\";\n\n/**\n * This class represents a Processor record in an events file.\n */\nexport class ProcessorRecord implements IRecord {\n\tconstructor(private version: number, private outputId: number, private lineClass: number) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.PROCESSOR;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the output id.\n\t * \n\t * @return The output id.\n\t */\n\tpublic getOutputId(): number {\n\t\treturn this.outputId;\n\t}\n\n\t/**\n\t * Get the line class.\n\t * \n\t * @return The line class.\n\t */\n\tpublic getLineClass(): number {\n\t\treturn this.lineClass;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.PROCESSOR}\\t`\n\t\t\t+ `${this.version} ${this.outputId} ${this.lineClass}`;\n\t}\n}","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nimport { IRecordT } from './IRecordT';\nimport { IRecord } from './IRecord';\n\n/**\n * This class represents a Timestamp record in an events file.\n */\nexport class TimestampRecord implements IRecord {\n\tconstructor(private version: number, private timestamp: string) { }\n\n\tpublic getRecordType(): IRecordT {\n\t\treturn IRecordT.TIMESTAMP;\n\t}\n\n\tpublic getVersion(): number {\n\t\treturn this.version;\n\t}\n\n\t/**\n\t * Get the timestamp.\n\t * \n\t * @return The timestamp.\n\t */\n\tpublic getTimestamp(): string {\n\t\treturn this.timestamp;\n\t}\n\n\tpublic toString(): string {\n\t\treturn `${IRecordT.TIMESTAMP}\\t`\n\t\t\t+ `${this.version} ${this.timestamp}`;\n\t}\n}","// The module cache\nconst __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tconst cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tconst module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/*\n * (c) Copyright IBM Corp. 2023\n */\n\nexport { Parser } from \"./Parser\";\nexport { ErrorInformationRecord } from \"./record/ErrorInformationRecord\";\nexport { ISequentialFileReader } from \"./ISequentialFileReader\";\nexport { IMarkerCreator } from \"./IMarkerCreator\";\nexport { IProcessor } from \"./IProcessor\";"],"names":["Object","defineProperty","exports","value","normalize","p","path","t","TypeError","assertPath","length","isAbsolute","charCodeAt","trailingSeparator","s","decodeURIComponent","decode","allowAboveRoot","code","res","lastSegmentLength","lastSlash","dots","i","lastSlashIndex","lastIndexOf","slice","posixNormalize","ProcessorBlock_1","__webpack_require__","ExpansionProcessor","constructor","this","PRE_COMPILE_PROCESSOR_ID","postProcessingNeeded","_noProcessorEventsYet","_containsPreCompileProcessorBlocks","processErrorRecord","record","currentProcessor","addErrorInformation","processExpansionRecord","setContainsExpansionEvents","getMappingTable","addExpansionRecord","processFeedbackCodeRecord","processFileEndRecord","closeFile","e","Error","message","processFileIDRecord","fileID","getSourceId","isProcessorIDZero","getInputFile","setInputFile","addFileToFileTable","getOutputFile","setOutputFile","addFile","processMapDefineRecord","processMapEndRecord","processMapStartRecord","processProcessorRecord","getOutputId","processorEnded","newProcessor","constructEventsFileProcessorBlock","setFirstInEventsFile","setPreviousProcessor","ProcessorBlock","processProgramRecord","processTimestampRecord","doPreProcessing","doPostProcessing","determineAndSetMappingSupport","resolveFileNamesForAllErrors","lastProcessorBlock","isMappingSupportedByAny","curProc","curSupport","isMappingSupportedByCurrentEventsFile","setMappingSupportForCurrentEventsFile","getIsFirstInEventsFile","getPreviousProcessorBlock","support","setMappingSupported","undefined","supported","getContainsExpansionEvents","getTotalNumberOfLinesInOutputFile","getTotalNumberOfLinesInInputFiles","previousProcessorBlock","getAllErrors","getAllProcessorErrors","getAllFileIDRecords","SourceLineRange","input","inputStartLine","inputEndLine","outputStartLine","outputEndLine","inputFileID","getInputStartLine","getInputEndLine","getInputFileID","getOutputStartLine","getOutputEndLine","setInputEndLine","endLine","setInputFileID","setInputStartLine","startLine","setOutputEndLine","setOutputStartLine","shiftOutputLines","amount","containsOutputLine","line","containsInputLine","ID","fixInputRangeBasedOnOutputRange","fixOutputRangeBasedOnInputRange","FileIDLinesPair","lines","getID","getLinesProcessed","increaseLinesProcessed","MapTable","map","queueExpansion","files","ArrayStack","lookupIndex","fileTable","Map","addFileInformation","range","createOpenEndedSourceLineRange","file","isEmpty","parentFile","peek","parentRange","pop","push","set","toString","getFileId","last","expansion","getExpansion","parent","getLine","getSourceLineRangeForOutputLine","optimizedSourceLineRangeLookup","getSourceLineRangeForInputLine","id","shiftRangesBy","atIndex","handleExpansion","expansionRange","createSourceLineRange","expandedSource","splitExpandedSourceLineRange","expanded","index","indexOf","isExpansionNegative","expansionSize","splice","Math","abs","extraRange","iStart","iEnd","oStart","oEnd","getInputLineStart","getInputLineEnd","getOutputLineStart","getOutputLineEnd","getFileIDRecordForFileID","get","getFileLocationForFileID","fileRecord","getFileName","modifyErrorInformation","statementLine","getStmtLine","setStmtLine","getLineFromSourceLineRange","setFileId","startLineNumber","getStartErrLine","setStartErrLine","endLineNumber","getEndErrLine","setEndErrLine","setFileName","initial","finalizeMap","JSON","stringify","forEach","header","unshift","buffer","size","fileIDRecords","Set","key","keys","fileIDRecord","add","Array","from","values","stack","item","IRecordT_1","TimestampRecord_1","ProcessorRecord_1","FileIDRecord_1","ErrorInformationRecord_1","FileEndRecord_1","ExpansionRecord_1","ExpansionProcessor_1","path_normalize_1","__importDefault","SourceFile","location","browseMode","getLocation","isReadOnly","setReadOnly","LookAheadReader","iSequentialFileReader","readNextLine","peakLine","nextLine","peakNextRecordType","split","filter","token","Parser","_loggingEnabled","sourceTable","getUntilTheEndOfTheLine","startIndex","st","concat","curr_msg","loggingEnabled","enable","log","content","console","parse","fileReader","markerCreator","word","fileId","processor","reader","lineText","IRecordT","ERROR_INFORMATION","version","parseInt","fileProcessed","annotationClass","lineStart","charStart","lineEnd","charEnd","severityText","severity","totalMessageLen","ErrorInformationRecord","lineNumber","locationLength","substring","nextRecordType","FILE_CONT","timestamp","tempFlag","charAt","isSpaceBeforeTempFlag","resolveRelativePath","fileEntry","lastOutputFile","currentOutputFile","FileIDRecord","errorMessage","exception","FileEndRecord","inputLineStart","inputLineEnd","outputFileID","outputLineStart","outputLineEnd","ExpansionRecord","TimestampRecord","outputId","lineClass","ProcessorRecord","trim","sourceFile","createMarker","default","replace","getException","setProcessor","nestedErrors","allErrors","MapTable_1","INPUT_FILE_ID","containsExpansionEvents","isFirstInEventsFile","mappingSupported","totalNumberOfLinesInOutputFile","totalNumberOfLinesInInputFiles","mappingTable","errors","inputFile","getInitialInputFile","outputFile","setTotalNumberOfLinesInOutputFile","increaseTotalNumberOfLinesInInputFiles","previous","numberOfLines","error","inputFileLocation","inputFileId","isMappingSupported","isFileReadOnly","getFlag","allPrevErrs","resolveFileNameAndDetermineIfReadOnly","readOnly","fileLocation","initialInputFile","setTokenStart","setTokenEnd","annotClass","stmtLine","startErrLine","tokenStart","endErrLine","tokenEnd","msgId","sevChar","sevNum","msg","fileName","getRecordType","getVersion","getAnnotClass","getTokenStart","getTokenEnd","getMsgId","getSevChar","getSevNum","getLength","getMsg","EXPANSION","getOutputFileID","FILE_END","sourceId","flag","FILE_ID","getTimestamp","PROCESSOR","getLineClass","TIMESTAMP","__webpack_module_cache__","moduleId","cachedModule","module","__webpack_modules__","call","Parser_1","enumerable"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ibm/ibmi-eventf-parser",
3
3
  "description": "Parse event files that are generated by IBM i compilers",
4
- "version": "2.0.2",
4
+ "version": "2.0.3",
5
5
  "publisher": "IBM",
6
6
  "author": "IBM",
7
7
  "license": "Apache-2.0",
@@ -28,13 +28,13 @@
28
28
  "coverage": "npx vitest run --coverage"
29
29
  },
30
30
  "dependencies": {
31
- "path-normalize": "^6.0.13"
31
+ "path-normalize": "^8.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@vitest/coverage-v8": "^4.1.6",
35
35
  "ts-loader": "^9.4.4",
36
36
  "vitest": "^4.1.6",
37
37
  "webpack": "^5.88.2",
38
- "webpack-cli": "^5.1.4"
38
+ "webpack-cli": "^7.0.2"
39
39
  }
40
- }
40
+ }