anthem/include/anthem/Location.h

51 lines
1.2 KiB
C
Raw Normal View History

2016-11-29 03:32:50 +01:00
#ifndef __ANTHEM__INPUT__LOCATION_H
#define __ANTHEM__INPUT__LOCATION_H
#include <cstdlib>
2017-05-31 18:03:19 +02:00
#include <clingo.hh>
namespace anthem
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Location
//
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Location
{
2017-05-31 18:03:19 +02:00
Location() = default;
Location(const Clingo::Location &clingoLocation)
: sectionStart{clingoLocation.begin_file()},
sectionEnd{clingoLocation.end_file()},
rowStart{clingoLocation.begin_line()},
rowEnd{clingoLocation.end_line()},
columnStart{clingoLocation.begin_column()},
columnEnd{clingoLocation.end_column()}
{
}
Location(const Location &other) = default;
Location &operator=(const Location &other) = default;
Location(Location &&other) = default;
Location &operator=(Location &&other) = default;
const char *sectionStart = nullptr;
const char *sectionEnd = nullptr;
std::size_t rowStart = -1;
std::size_t rowEnd = -1;
std::size_t columnStart = -1;
std::size_t columnEnd = -1;
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif