MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / advanceLine

Function advanceLine

source/text_handler.cpp:40–57  ·  view source on GitHub ↗

Advances |text| to the start of the next line and writes the new position to |position|.

Source from the content-addressed store, hash-verified

38// Advances |text| to the start of the next line and writes the new position to
39// |position|.
40spv_result_t advanceLine(spv_text text, spv_position position) {
41 while (true) {
42 if (position->index >= text->length) return SPV_END_OF_STREAM;
43 switch (text->str[position->index]) {
44 case '\0':
45 return SPV_END_OF_STREAM;
46 case '\n':
47 position->column = 0;
48 position->line++;
49 position->index++;
50 return SPV_SUCCESS;
51 default:
52 position->column++;
53 position->index++;
54 break;
55 }
56 }
57}
58
59// Advances |text| to first non white space character and writes the new
60// position to |position|.

Callers 1

advanceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected