Lines Matching refs:position
38 spv_result_t advanceLine(spv_text text, spv_position position) { in advanceLine() argument
40 if (position->index >= text->length) return SPV_END_OF_STREAM; in advanceLine()
41 switch (text->str[position->index]) { in advanceLine()
45 position->column = 0; in advanceLine()
46 position->line++; in advanceLine()
47 position->index++; in advanceLine()
50 position->column++; in advanceLine()
51 position->index++; in advanceLine()
62 spv_result_t advance(spv_text text, spv_position position) { in advance() argument
64 if (position->index >= text->length) return SPV_END_OF_STREAM; in advance()
65 switch (text->str[position->index]) { in advance()
69 if (spv_result_t error = advanceLine(text, position)) return error; in advance()
70 return advance(text, position); in advance()
74 position->column++; in advance()
75 position->index++; in advance()
76 return advance(text, position); in advance()
78 position->column = 0; in advance()
79 position->line++; in advance()
80 position->index++; in advance()
81 return advance(text, position); in advance()
94 spv_result_t getWord(spv_text text, spv_position position, std::string* word) { in getWord() argument
96 if (!position) return SPV_ERROR_INVALID_POINTER; in getWord()
98 const size_t start_index = position->index; in getWord()
105 if (position->index >= text->length) { in getWord()
106 word->assign(text->str + start_index, text->str + position->index); in getWord()
109 const char ch = text->str[position->index]; in getWord()
125 word->assign(text->str + start_index, text->str + position->index); in getWord()
134 position->column++; in getWord()
135 position->index++; in getWord()
141 bool startsWithOp(spv_text text, spv_position position) { in startsWithOp() argument
142 if (text->length < position->index + 3) return false; in startsWithOp()
143 char ch0 = text->str[position->index]; in startsWithOp()
144 char ch1 = text->str[position->index + 1]; in startsWithOp()
145 char ch2 = text->str[position->index + 2]; in startsWithOp()