blob: 303a0e14e5bb8d74005331f6b45bfd6dc091e8be [file] [log] [blame]
ethannicholasb3058bd2016-07-01 08:22:01 -07001/*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
Ethan Nicholas0df1b042017-03-31 13:56:23 -04007
ethannicholasb3058bd2016-07-01 08:22:01 -07008#ifndef SKSL_ERRORREPORTER
9#define SKSL_ERRORREPORTER
10
11#include "SkSLPosition.h"
12
13namespace SkSL {
14
15/**
16 * Interface for the compiler to report errors.
17 */
18class ErrorReporter {
19public:
20 virtual ~ErrorReporter() {}
21
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070022 void error(int offset, const char* msg) {
23 this->error(offset, String(msg));
Ethan Nicholas9e1138d2016-11-21 10:39:35 -050024 }
25
Ethan Nicholas5b5f0962017-09-11 13:50:14 -070026 virtual void error(int offset, String msg) = 0;
Ethan Nicholas941e7e22016-12-12 15:33:30 -050027
28 virtual int errorCount() = 0;
ethannicholasb3058bd2016-07-01 08:22:01 -070029};
30
31} // namespace
32
33#endif