/**
 * Defines classes and types for PEG.js.
 *
 * Users don't have to import this module directly.
 *
 */ /** */ import { TimeKeeper } from './timeout' ; /**
 * The location of a node.
 */ export type Location = { start : { /**
         * The zero-based offset value.
         */ offset : number ; /**
         * The one-based line value.
         */ line : number ; /**
         * The one-based column value.
         */ column : number ; } ; end : { /**
         * The zero-based offset value.
         */ offset : number ; /**
         * The one-based line value.
         */ line : number ; /**
         * The one-based column value.
         */ column : number ; } ; } ; export function isLocation ( x ) { const ret = x ?. start ?. offset !== undefined && x ?. start ?. line !== undefined && x ?. start ?. column !== undefined && x ?. end ?. offset !== undefined && x ?. end ?. line !== undefined && x ?. end ?. column !== undefined ; return ret ; } export class SyntaxErrorBase extends Error { message : string ; expected : string | null ; found : string | null ; location : Location ; name : 'SyntaxError' ; } export class SyntaxError extends SyntaxErrorBase { } export function isSyntaxError ( x ) { const ret = x ?. message !== undefined && isLocation ( x ?. location ) && x ?. name === 'SyntaxError' && x instanceof Error ; return ret ; } export interface ParserOptions { startRule ? : string ; tracer ? : Tracer ; timeout ? : number | TimeKeeper ; } export type TraceArg = { type : 'rule.enter' | 'rule.match' | 'rule.fail' ; rule : string ; result : any ; location : Location ; } ; export type Tracer = { trace : ( e : TraceArg ) => any ; } ;