glsl: Extend ast location structure to hande end token position.

Reviewed-by: Carl Worth <cworth@cworth.org>
This commit is contained in:
Sir Anthony
2014-02-05 21:18:09 +06:00
committed by Kenneth Graunke
parent 6984aa4350
commit 433d562ac6
2 changed files with 17 additions and 11 deletions

View File

@@ -75,10 +75,10 @@ public:
struct YYLTYPE locp; struct YYLTYPE locp;
locp.source = this->location.source; locp.source = this->location.source;
locp.first_line = this->location.line; locp.first_line = this->location.first_line;
locp.first_column = this->location.column; locp.first_column = this->location.first_column;
locp.last_line = locp.first_line; locp.last_line = this->location.last_line;
locp.last_column = locp.first_column; locp.last_column = this->location.last_column;
return locp; return locp;
} }
@@ -91,8 +91,10 @@ public:
void set_location(const struct YYLTYPE &locp) void set_location(const struct YYLTYPE &locp)
{ {
this->location.source = locp.source; this->location.source = locp.source;
this->location.line = locp.first_line; this->location.first_line = locp.first_line;
this->location.column = locp.first_column; this->location.first_column = locp.first_column;
this->location.last_line = locp.last_line;
this->location.last_column = locp.last_column;
} }
/** /**
@@ -100,8 +102,10 @@ public:
*/ */
struct { struct {
unsigned source; /**< GLSL source number. */ unsigned source; /**< GLSL source number. */
unsigned line; /**< Line number within the source string. */ unsigned first_line; /**< Line number within the source string. */
unsigned column; /**< Column in the line. */ unsigned first_column; /**< Column in the line. */
unsigned last_line; /**< Line number within the source string. */
unsigned last_column; /**< Column in the line. */
} location; } location;
exec_node link; exec_node link;

View File

@@ -807,8 +807,10 @@ ast_node::print(void) const
ast_node::ast_node(void) ast_node::ast_node(void)
{ {
this->location.source = 0; this->location.source = 0;
this->location.line = 0; this->location.first_line = 0;
this->location.column = 0; this->location.first_column = 0;
this->location.last_line = 0;
this->location.last_column = 0;
} }