SkSLPosition.h 676 B

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