summaryrefslogtreecommitdiff
path: root/src/core/common/CharReader.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-23 15:26:40 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-01-23 15:26:40 +0100
commitd4457c98def55d694abc51e008d3fe5663768aab (patch)
tree95ff09822cef994154a7d3dfef3fcdb81d0814fa /src/core/common/CharReader.hpp
parentb0ab6e4cb077af892046e1fa1504d08e5b66deaf (diff)
Improved and fixed CharReader
Diffstat (limited to 'src/core/common/CharReader.hpp')
-rw-r--r--src/core/common/CharReader.hpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/core/common/CharReader.hpp b/src/core/common/CharReader.hpp
index 0957e97..5a4d906 100644
--- a/src/core/common/CharReader.hpp
+++ b/src/core/common/CharReader.hpp
@@ -367,7 +367,7 @@ private:
* @param c a reference to the character that should be written.
* @return true if another character needs to be read.
*/
- bool substituteLinebreaks(Cursor &cursor, char &c);
+ bool substituteLinebreaks(Buffer::CursorId &cursor, char &c);
/**
* Reads a single character from the given cursor.
@@ -534,7 +534,14 @@ public:
*
* @return the offset of the read cursor in bytes.
*/
- size_t getOffset() const;
+ SourceOffset getOffset() const;
+
+ /**
+ * Returns the offset of the read cursor in bytes.
+ *
+ * @return the offset of the read cursor in bytes.
+ */
+ SourcePosition getPosition() const;
/**
* Returns a SourceLocation object describing the exact position (including
@@ -544,6 +551,24 @@ public:
* cursor.
*/
SourceLocation getLocation() const;
+
+ /**
+ * Returns a SourceLocation object starting at the given start position and
+ * ending at the exact position (including the source file) of the read
+ * cursor.
+ *
+ * @return a SourceLocation object at the position of the current read
+ * cursor.
+ */
+ SourceLocation getLocation(SourcePosition start) const;
+
+ /**
+ * Returns the current SourceId which describes the Resource on which the
+ * CharReader is currently working.
+ *
+ * @return the current SourceId.
+ */
+ SourceId getSourceId() const;
};
/**
@@ -577,9 +602,9 @@ private:
* coherently.
*/
CharReaderFork(std::shared_ptr<Buffer> buffer,
- Buffer::CursorId &parentReadCursor,
- Buffer::CursorId &parentPeekCursor,
- SourceContextCallback sourceId, size_t offs, bool coherent);
+ Buffer::CursorId parentReadCursor,
+ Buffer::CursorId parentPeekCursor, SourceId sourceId,
+ size_t offs, bool coherent);
public:
/**