Skip to content

Class: ParseError

Defined in: parser/index.ts:28

Thrown for syntax errors or edge-direction violations.

Implements the structured GvError contract: location is primary; line/column are convenience getters that delegate to it.

Extends

  • Error

Implements

Constructors

Constructor

ts
new ParseError(
   message: string, 
   code: GvErrorCode, 
   location: {
  column: number;
  line: number;
  offset?: number;
}, 
   expected?: Expectation[]): ParseError;

Defined in: parser/index.ts:35

Parameters

message

string

code

GvErrorCode

location
column

number

line

number

offset?

number

expected?

Expectation[]

Returns

ParseError

Overrides

ts
Error.constructor

Properties

code

ts
readonly code: GvErrorCode;

Defined in: parser/index.ts:30

Stable i18n key.

Implementation of

GvError.code


expected?

ts
readonly optional expected?: Expectation[];

Defined in: parser/index.ts:33

Peggy's discriminated union, passed through unmapped; SYNTAX_* only.

Implementation of

GvError.expected


friendlyMessage

ts
readonly friendlyMessage: string;

Defined in: parser/index.ts:31

Approachable, non-localized English (delivery).

Implementation of

GvError.friendlyMessage


location

ts
readonly location: {
  column: number;
  line: number;
  offset?: number;
};

Defined in: parser/index.ts:32

Real error position; the highest-value field.

column

ts
column: number;

line

ts
line: number;

offset?

ts
optional offset?: number;

Implementation of

GvError.location


type

ts
readonly type: "syntax" = 'syntax';

Defined in: parser/index.ts:29

Implementation of

GvError.type

Accessors

column

Get Signature

ts
get column(): number;

Defined in: parser/index.ts:53

Returns

number


line

Get Signature

ts
get line(): number;

Defined in: parser/index.ts:49

Returns

number