export class ParseError extends Error { name : string = 'ParseError' ; constructor ( public row , public column , public unexpected , public expected ? ) { super ( ) ; const str = ( { name , rep } ) => name + ( rep ? ` ${ rep }` : '' ) ; let message = `Unexpected ${ str ( unexpected ) } at ${ row }:${ column }` ; if ( expected ) { message += `, expected ${ str ( expected ) }` ; } this . message = message ; } }