| 1 | /* |
| 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 | */ |
| 7 | |
| 8 | #ifndef SKSL_POSITION |
| 9 | #define SKSL_POSITION |
| 10 | |
| 11 | #include "src/sksl/SkSLString.h" |
| 12 | #include "src/sksl/SkSLUtil.h" |
| 13 | |
| 14 | namespace SkSL { |
| 15 | |
| 16 | /** |
| 17 | * Represents a position in the source code. Both line and column are one-based. Column is currently |
| 18 | * ignored. |
| 19 | */ |
| 20 | struct Position { |
| 21 | Position() |
| 22 | : fLine(-1) |
| 23 | , fColumn(-1) {} |
| 24 | |
| 25 | Position(int line, int column) |
| 26 | : fLine(line) |
| 27 | , fColumn(column) {} |
| 28 | |
| 29 | String description() const { |
| 30 | return to_string(fLine); |
| 31 | } |
| 32 | |
| 33 | int fLine; |
| 34 | int fColumn; |
| 35 | }; |
| 36 | |
| 37 | } // namespace SkSL |
| 38 | |
| 39 | #endif |
| 40 | |