GLSL: Fix #822: Improve information given for syntax errors.

Also, fixed one test file that didn't have its syntax error as the last line.
This commit is contained in:
John Kessenich 2017-04-20 12:21:53 -06:00
parent 0c6f9360f5
commit ba5cc2fafa
15 changed files with 2788 additions and 3072 deletions

View File

@ -184,10 +184,8 @@ void qlod()
lod = textureQueryLod(sampRect, pf2); // ERROR
}
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member
uniform uint uu;
out int iout;
out uint iout;
void bitwiseConv()
{
@ -195,3 +193,5 @@ void bitwiseConv()
iout += uu ^ i;
iout += i | uu;
}
struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member

View File

@ -84,7 +84,7 @@ ERROR: 0:194: '.' : cannot apply to an array: method
ERROR: 0:194: 'a' : can't use function syntax on variable
ERROR: 0:214: 'non-constant global initializer (needs GL_EXT_shader_non_constant_global_initializers)' : not supported for this version or the enabled extensions
ERROR: 0:3000: '#error' : line of this error should be 3000
ERROR: 0:3002: '' : syntax error
ERROR: 0:3002: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 77 compilation errors. No code generated.

View File

@ -52,7 +52,7 @@ ERROR: 0:209: 'assign' : cannot convert from ' const float' to ' temp 4-compone
ERROR: 0:212: 'sampler2DRect' : Reserved word.
ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' global void' and a right operand of type ' const int' (or there is no acceptable conversion)
ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' const int' and a right operand of type ' global void' (or there is no acceptable conversion)
ERROR: 0:248: '' : syntax error
ERROR: 0:248: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 54 compilation errors. No code generated.

View File

@ -43,7 +43,7 @@ ERROR: 0:156: 'invariant' : can only apply to an output
ERROR: 0:157: 'invariant' : can only apply to an output
ERROR: 0:158: 'invariant' : can only apply to an output
ERROR: 0:160: 'imageBuffer' : Reserved word.
ERROR: 0:160: '' : syntax error
ERROR: 0:160: '' : syntax error, unexpected IMAGEBUFFER, expecting COMMA or SEMICOLON
ERROR: 45 compilation errors. No code generated.

View File

@ -34,7 +34,7 @@ ERROR: 0:183: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:183: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:184: 'textureQueryLod' : no matching overloaded function found
ERROR: 0:184: 'assign' : cannot convert from ' const float' to ' temp 2-component vector of float'
ERROR: 0:187: '' : syntax error
ERROR: 0:197: '' : syntax error, unexpected PRECISE, expecting IDENTIFIER
ERROR: 35 compilation errors. No code generated.
@ -469,6 +469,27 @@ ERROR: node is still EOpNull!
0:181 'pf3' ( temp 3-component vector of float)
0:183 'lod' ( temp 2-component vector of float)
0:184 'lod' ( temp 2-component vector of float)
0:190 Function Definition: bitwiseConv( ( global void)
0:190 Function Parameters:
0:192 Sequence
0:192 move second child to first child ( temp uint)
0:192 'iout' ( out uint)
0:192 bitwise and ( temp uint)
0:192 'uu' ( uniform uint)
0:192 Convert int to uint ( temp uint)
0:192 'i' ( flat in int)
0:193 add second child into first child ( temp uint)
0:193 'iout' ( out uint)
0:193 exclusive-or ( temp uint)
0:193 'uu' ( uniform uint)
0:193 Convert int to uint ( temp uint)
0:193 'i' ( flat in int)
0:194 add second child into first child ( temp uint)
0:194 'iout' ( out uint)
0:194 inclusive-or ( temp uint)
0:194 Convert int to uint ( temp uint)
0:194 'i' ( flat in int)
0:194 'uu' ( uniform uint)
0:? Linker Objects
0:? 'c2D' ( smooth in 2-component vector of float)
0:? 'i' ( flat in int)
@ -512,6 +533,8 @@ ERROR: node is still EOpNull!
0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect)
0:? 'uu' ( uniform uint)
0:? 'iout' ( out uint)
Linked fragment stage:
@ -685,4 +708,6 @@ ERROR: node is still EOpNull!
0:? 'sampCubeAs' ( uniform samplerCubeArrayShadow)
0:? 'sampBuf' ( uniform samplerBuffer)
0:? 'sampRect' ( uniform sampler2DRect)
0:? 'uu' ( uniform uint)
0:? 'iout' ( out uint)

View File

@ -6,7 +6,7 @@ ERROR: 0:4: 'preprocessor evaluation' : bad expression
ERROR: 0:4: '#if' : unexpected tokens following directive
ERROR: 0:6: '€' : unexpected token
ERROR: 0:7: 'string' : End of line in string
ERROR: 0:7: '' : syntax error
ERROR: 0:7: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated.

View File

@ -4,7 +4,7 @@ ERROR: 0:2: '#if' : unexpected tokens following directive
ERROR: 0:5: 'string' : End of line in string
ERROR: 0:5: 'macro expansion' : expected '(' following n
ERROR: 0:5: '""' : string literals not supported
ERROR: 0:5: '' : syntax error
ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 6 compilation errors. No code generated.

View File

@ -1,6 +1,6 @@
cppIndent.vert
ERROR: 0:61: 'macro expansion' : Too few args in Macro FUNC
ERROR: 0:61: '' : syntax error
ERROR: 0:61: '' : syntax error, unexpected COMMA
ERROR: 2 compilation errors. No code generated.

View File

@ -2,7 +2,7 @@ glspv.frag
ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error )
ERROR: 0:6: '#error' : GL_SPIR is 100
ERROR: 0:14: 'input_attachment_index' : only allowed when using GLSL for Vulkan
ERROR: 0:14: '' : syntax error
ERROR: 0:14: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 4 compilation errors. No code generated.

View File

@ -7,7 +7,7 @@ ERROR: 0:9: 'packed' : not allowed when generating SPIR-V
ERROR: 0:13: 'gl_VertexIndex' : undeclared identifier
ERROR: 0:14: 'gl_InstanceIndex' : undeclared identifier
ERROR: 0:17: 'gl_DepthRangeParameters' : undeclared identifier
ERROR: 0:20: '' : syntax error
ERROR: 0:20: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
ERROR: 8 compilation errors. No code generated.

View File

@ -19,7 +19,7 @@ ERROR: 0:112: '#if' : unexpected tokens following directive
ERROR: 0:117: 'macro expansion' : End of line in macro substitution: FOOM
ERROR: 0:118: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:118: '#if' : unexpected tokens following directive
ERROR: 0:150: '' : syntax error
ERROR: 0:150: '' : syntax error, unexpected EQUAL
ERROR: 19 compilation errors. No code generated.

View File

@ -1,6 +1,6 @@
syntaxError.frag
ERROR: 0:9: 'vec5' : undeclared identifier
ERROR: 0:9: '' : syntax error
ERROR: 0:9: '' : syntax error, unexpected IDENTIFIER, expecting COMMA or SEMICOLON
ERROR: 2 compilation errors. No code generated.

View File

@ -63,6 +63,8 @@ using namespace glslang;
%}
%define parse.error verbose
%union {
struct {
glslang::TSourceLoc loc;

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/* A Bison parser, made by GNU Bison 2.7. */
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation, Inc.
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,9 +30,9 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
# define YY_YY_GLSLANG_TAB_CPP_H_INCLUDED
/* Enabling traces. */
#ifndef YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
# define YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
#endif
@ -40,12 +40,11 @@
extern int yydebug;
#endif
/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
enum yytokentype
{
ATTRIBUTE = 258,
VARYING = 259,
CONST = 260,
@ -334,12 +333,12 @@ extern int yydebug;
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
union YYSTYPE
{
/* Line 2058 of yacc.c */
#line 66 "glslang.y"
#line 68 "MachineIndependent/glslang.y" /* yacc.c:1909 */
struct {
glslang::TSourceLoc loc;
@ -373,28 +372,16 @@ typedef union YYSTYPE
};
} interm;
#line 376 "MachineIndependent/glslang_tab.cpp.h" /* yacc.c:1909 */
};
/* Line 2058 of yacc.c */
#line 379 "glslang_tab.cpp.h"
} YYSTYPE;
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (glslang::TParseContext* pParseContext);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
#endif /* !YY_YY_GLSLANG_TAB_CPP_H_INCLUDED */
int yyparse (glslang::TParseContext* pParseContext);
#endif /* !YY_YY_MACHINEINDEPENDENT_GLSLANG_TAB_CPP_H_INCLUDED */