MCPcopy Create free account
hub / github.com/boostorg/parser / find_line_position

Function find_line_position

include/boost/parser/error_handling.hpp:36–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 beginning of the input `first`. */
35 template<typename Iter>
36 line_position<Iter> find_line_position(Iter first, Iter it)
37 {
38 bool prev_cr = false;
39 auto retval = line_position<Iter>{first, 0, 0};
40 for (Iter pos = first; pos != it; ++pos) {
41 auto const c = *pos;
42 bool const found =
43 (c & detail::eol_cp_mask) == c &&
44 std::find(detail::eol_cps.begin(), detail::eol_cps.end(), c) !=
45 detail::eol_cps.end();
46 if (found) {
47 retval.line_start = std::next(pos);
48 retval.column_number = 0;
49 } else {
50 ++retval.column_number;
51 }
52 if (found && (!prev_cr || c != 0x000a))
53 ++retval.line_number;
54 prev_cr = c == 0x000d;
55 }
56 return retval;
57 }
58
59 /** Returns the iterator to the end of the line in which `it` is
60 found. */

Callers 1

error_handling.hppFile · 0.85

Calls 4

findFunction · 0.85
nextFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected