parseUtil.d.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. export declare class ParseLocation {
  2. file: ParseSourceFile;
  3. offset: number;
  4. line: number;
  5. col: number;
  6. constructor(file: ParseSourceFile, offset: number, line: number, col: number);
  7. toString(): string;
  8. moveBy(delta: number): ParseLocation;
  9. getContext(maxChars: number, maxLines: number): {
  10. before: string;
  11. after: string;
  12. } | null;
  13. }
  14. export declare class ParseSourceFile {
  15. content: string;
  16. url: string;
  17. constructor(content: string, url: string);
  18. }
  19. export declare class ParseSourceSpan {
  20. start: ParseLocation;
  21. end: ParseLocation;
  22. details: string | null;
  23. constructor(start: ParseLocation, end: ParseLocation, details?: string | null);
  24. toString(): string;
  25. }
  26. export declare enum ParseErrorLevel {
  27. WARNING = 0,
  28. ERROR = 1
  29. }
  30. export declare class ParseError {
  31. span: ParseSourceSpan;
  32. msg: string;
  33. level: ParseErrorLevel;
  34. constructor(span: ParseSourceSpan, msg: string, level?: ParseErrorLevel);
  35. contextualMessage(): string;
  36. toString(): string;
  37. }