| 940 | } |
| 941 | |
| 942 | void Reader::getLocationLineAndColumn(Location location, |
| 943 | int &line, |
| 944 | int &column) const { |
| 945 | Location current = begin_; |
| 946 | Location lastLineStart = current; |
| 947 | line = 0; |
| 948 | while (current < location && current != end_) { |
| 949 | Char c = *current++; |
| 950 | if (c == '\r') { |
| 951 | if (*current == '\n') |
| 952 | ++current; |
| 953 | lastLineStart = current; |
| 954 | ++line; |
| 955 | } else if (c == '\n') { |
| 956 | lastLineStart = current; |
| 957 | ++line; |
| 958 | } |
| 959 | } |
| 960 | // column & line start at 1 |
| 961 | column = int(location - lastLineStart) + 1; |
| 962 | ++line; |
| 963 | } |
| 964 | |
| 965 | std::string Reader::getLocationLineAndColumn(Location location) const { |
| 966 | int line, column; |
nothing calls this directly
no outgoing calls
no test coverage detected