diff options
author | Karl Berry <karl@freefriends.org> | 2022-01-08 18:39:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-01-08 18:39:01 +0000 |
commit | bedc9a5694f7c40a2645919601638d2dbef4145b (patch) | |
tree | 22548fd073b3f2f5a287c2487d69bfc656125ef6 /Build/source/utils/asymptote/errormsg.h | |
parent | c2c4540ab1d27a23c085ce5081f6366cfabb31f6 (diff) |
asy 2.75 sources
git-svn-id: svn://tug.org/texlive/trunk@61532 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/errormsg.h')
-rw-r--r-- | Build/source/utils/asymptote/errormsg.h | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/Build/source/utils/asymptote/errormsg.h b/Build/source/utils/asymptote/errormsg.h index 180c2309f7d..eb03faa5cb2 100644 --- a/Build/source/utils/asymptote/errormsg.h +++ b/Build/source/utils/asymptote/errormsg.h @@ -9,15 +9,17 @@ #define ERRORMSG_H #include <iostream> +#include <exception> #include "common.h" #include "settings.h" +#include "symbolmaps.h" using std::ostream; -struct handled_error {}; // Exception to process next file. -struct interrupted {}; // Exception to interrupt execution. -struct quit {}; // Exception to quit current operation. -struct eof {}; // Exception to exit interactive mode. +struct handled_error : std::exception {}; // Exception to process next file. +struct interrupted : std::exception {}; // Exception to interrupt execution. +struct quit : std::exception {}; // Exception to quit current operation. +struct eof : std::exception {}; // Exception to exit interactive mode. class fileinfo : public gc { string filename; @@ -81,21 +83,24 @@ public: } } - string filename() const - { + string filename() const { return file ? file->name() : ""; } - size_t Line() const - { + size_t Line() const { return line; } - size_t Column() const - { + size_t Column() const { return column; } + position shift(unsigned int offset) const { + position P=*this; + P.line -= offset; + return P; + } + std::pair<size_t,size_t>LineColumn() const { return std::pair<size_t,size_t>(line,column); } @@ -119,6 +124,21 @@ public: friend ostream& operator << (ostream& out, const position& pos); + typedef std::pair<size_t, size_t> posInFile; + typedef std::pair<std::string, posInFile> filePos; + + explicit operator AsymptoteLsp::filePos() + { + return std::make_pair((std::string) file->name().c_str(),LineColumn()); + } + + void print(ostream& out) const + { + if (file) { + out << file->name() << ":" << line << "." << column; + } + } + // Write out just the module name and line number. void printTerse(ostream& out) const { |