1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

Fix shader tokenizer/compiler reporting wrong error location

Raname shader tokenizer methods for clarity
This commit is contained in:
Pedro J. Estébanez
2016-10-10 11:51:28 +02:00
parent 85a7105345
commit a130520a7c
2 changed files with 74 additions and 66 deletions

View File

@@ -332,14 +332,14 @@ private:
void get_error(String *r_error, int *r_line, int *r_column) {
*r_error=error;
*r_line=get_token(pos).line;
*r_column=get_token(pos).col;
*r_line=get_next_token(0).line;
*r_column=get_next_token(0).col;
}
Token get_token(int ofs=0) const { int idx=pos+ofs; if (idx<0 || idx>=tokens.size()) return Token(TK_ERROR); return tokens[idx]; }
TokenType get_token_type(int ofs=0) const { int idx=pos+ofs; if (idx<0 || idx>=tokens.size()) return TK_ERROR; return tokens[idx].type; }
Token get_next_token(int ofs=0) const { int idx=pos+ofs; if (idx<0 || idx>=tokens.size()) return Token(TK_ERROR); return tokens[idx]; }
TokenType get_next_token_type(int ofs=0) const { int idx=pos+ofs; if (idx<0 || idx>=tokens.size()) return TK_ERROR; return tokens[idx].type; }
void advance(int p_amount=1) { pos+=p_amount; }
bool is_at_end() const { return pos>=tokens.size(); }