[Mesa-dev] [PATCH] glsl-compiler: ast: Precise locations positions.

Sir Anthony anthony at adsorbtion.org
Mon Feb 3 18:44:53 CET 2014


I'm using mesa glsl-compiler as backend for glsl-debugger interface with heavy use of locations for graphical representation. Locations proposed by original parser is wrong in most cases, because it uses yylloc for all bison rules. This patch includes:
1. Change locations setup in glsl_parser.yy from yylloc to appropriate token locations.
2. Addition of two fields in ast_node location to hold end position of token.
3. Addition of ast_node method to setup range locations (for aggregate tokens).
4. Fix for glcpp-lex.l. It handled spaces wrong and convert two adjacent spaces into one, which added location offset for shaders with indentation.

---
 src/glsl/ast.h                  |  36 +++++--
 src/glsl/glcpp/glcpp-lex.l      |   5 +-
 src/glsl/glsl_lexer.ll          |   3 +-
 src/glsl/glsl_parser.yy         | 215 +++++++++++++++++++++-------------------
 src/glsl/glsl_parser_extras.cpp |   6 +-
 5 files changed, 150 insertions(+), 115 deletions(-)

-- 
1.8.3.2



More information about the mesa-dev mailing list