in src/adapter/daffodilRuntime.ts [369:440]
private fireEventsForLine(ln: number, stepEvent?: string): boolean {
if (this._noDebug) {
return false
}
const line = this._sourceLines[ln].trim()
// if 'log(...)' found in source -> send argument to debug console
const matches = /log\((.*)\)/.exec(line)
if (matches && matches.length === 2) {
this.sendEvent('output', matches[1], this._sourceFile, ln, matches.index)
}
// if a word in a line matches a data breakpoint, fire a 'dataBreakpoint' event
const words = line.split(' ')
for (const word of words) {
if (this._breakAddresses.has(word)) {
this.sendEvent('stopOnDataBreakpoint')
return true
}
}
// if pattern 'exception(...)' found in source -> throw named exception
const matches2 = /exception\((.*)\)/.exec(line)
if (matches2 && matches2.length === 2) {
const exception = matches2[1].trim()
if (this._namedException === exception) {
this.sendEvent('stopOnException', exception)
return true
} else {
if (this._otherExceptions) {
this.sendEvent('stopOnException', undefined)
return true
}
}
} else {
// if word 'exception' found in source -> throw exception
if (line.indexOf('exception') >= 0) {
if (this._otherExceptions) {
this.sendEvent('stopOnException', undefined)
return true
}
}
}
// is there a breakpoint?
const breakpoints = this._breakPoints.get(this._sourceFile)
if (breakpoints) {
const bps = breakpoints.filter((bp) => bp.line === ln)
if (bps.length > 0) {
// send 'stopped' event
this.sendEvent('stopOnBreakpoint')
// the following shows the use of 'breakpoint' events to update properties of a breakpoint in the UI
// if breakpoint is not yet verified, verify it now and send a 'breakpoint' update event
if (!bps[0].verified) {
bps[0].verified = true
this.sendEvent('breakpointValidated', bps[0])
}
return true
}
}
// non-empty line
if (stepEvent && line.length > 0) {
this.sendEvent(stepEvent)
return true
}
// nothing interesting found -> continue
return false
}