blob: 172e4888d8b183599f4d6d8a24393ac3034e3020 [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 Nicholas9e1138d2016-11-21 10:39:35 -050022 void error(Position position, const char* msg) {
Ethan Nicholas0df1b042017-03-31 13:56:23 -040023 this->error(position, String(msg));
Ethan Nicholas9e1138d2016-11-21 10:39:35 -050024 }
25
Ethan Nicholas0df1b042017-03-31 13:56:23 -040026 virtual void error(Position position, 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