Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
glsllexer_p.h
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
6
#
ifndef
QSSG_GLSLLEXER_H
7
#
define
QSSG_GLSLLEXER_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
QtQuick3DGlslParser
/
private
/
glsl_p
.
h
>
21
#
include
<
QtCore
/
qstring
.
h
>
22
#
include
<
qstringlist
.
h
>
23
24
QT_BEGIN_NAMESPACE
25
26
namespace
GLSL
{
27
28
class
Q_QUICK3DGLSLPARSER_EXPORT
Token
29
{
30
public
:
31
int
kind
;
32
int
position
;
33
int
length
;
34
int
line
;
// ### remove
35
36
union
{
37
int
matchingBrace
;
38
int
i
;
// integer value
39
const
QString
*
string
;
// string value
40
void
*
ptr
;
41
};
42
43
Token
()
44
:
kind
(0),
position
(0),
length
(0),
line
(0),
ptr
(
nullptr
) {}
45
46
bool
is
(
int
k
)
const
{
return
k
==
kind
; }
47
bool
isNot
(
int
k
)
const
{
return
k
!=
kind
; }
48
49
int
begin
()
const
{
return
position
; }
50
int
end
()
const
{
return
position
+
length
; }
51
};
52
53
class
Q_QUICK3DGLSLPARSER_EXPORT
Lexer
54
{
55
public
:
56
Lexer
(
Engine
*
engine
,
const
char
*
source
,
unsigned
size
);
57
~
Lexer
();
58
59
enum
Variant
{
60
// Extra flag bits added to tokens by Lexer::classify() that
61
// indicate which variant of GLSL the keyword belongs to.
62
Variant_GLSL_120
= 0x00010000,
// 1.20 and higher
63
Variant_GLSL_150
= 0x00020000,
// 1.50 and higher
64
Variant_GLSL_400
= 0x00040000,
// 4.00 and higher
65
Variant_GLSL_ES_100
= 0x00080000,
// ES 1.00 and higher
66
Variant_VertexShader
= 0x00200000,
67
Variant_FragmentShader
= 0x00400000,
68
Variant_Reserved
= 0x80000000,
69
Variant_Mask
= 0xFFFF0000,
70
Variant_All
= 0xFFFF0000
71
};
72
73
union
Value
{
74
int
i
;
75
const
QString
*
string
;
76
void
*
ptr
;
77
};
78
79
Engine
*
engine
()
const
{
return
_engine
; }
80
81
int
state
()
const
{
return
_state
; }
82
void
setState
(
int
state
) {
_state
=
state
; }
83
84
int
variant
()
const
{
return
_variant
; }
85
void
setVariant
(
int
flags
) {
_variant
=
flags
; }
86
87
bool
scanKeywords
()
const
{
return
_scanKeywords
; }
88
void
setScanKeywords
(
bool
scanKeywords
) {
_scanKeywords
=
scanKeywords
; }
89
90
bool
scanComments
()
const
{
return
_scanComments
; }
91
void
setScanComments
(
bool
scanComments
) {
_scanComments
=
scanComments
; }
92
93
int
yylex
(
Token
*
tk
);
94
int
findKeyword
(
const
char
*
word
,
int
length
)
const
;
95
96
void
*
yyval
()
const
{
return
_yyval
.
ptr
; }
97
98
static
QStringList
keywords
(
int
variant
);
99
100
private
:
101
static
int
classify
(
const
char
*
s
,
int
len
);
102
103
void
yyinp
();
104
int
yylex_helper
(
const
char
**
position
,
int
*
line
);
105
106
void
warning
(
int
line
,
const
QString
&
message
);
107
void
error
(
int
line
,
const
QString
&
message
);
108
109
private
:
110
Engine
*
_engine
;
111
const
char
*
_source
;
112
const
char
*
_it
;
113
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC
(
"-Wattributes"
)
114
[[
maybe_unused
]]
int
_size
;
115
QT_WARNING_POP
116
int
_yychar
;
117
int
_lineno
;
118
int
_state
;
119
int
_variant
;
120
unsigned
_scanKeywords
: 1;
121
unsigned
_scanComments
: 1;
122
Value
_yyval
;
123
};
124
125
}
// namespace GLSL
126
127
QT_END_NAMESPACE
128
129
#
endif
// QSSG_GLSLLEXER_H
GLSL::Lexer
Definition
glsllexer_p.h:54
GLSL::Token
Definition
glsllexer_p.h:29
classify15
static int classify15(const char *s)
Definition
glslkeywords.cpp:1108
classify2
static int classify2(const char *s)
Definition
glslkeywords.cpp:13
classify4
static int classify4(const char *s)
Definition
glslkeywords.cpp:55
classify17
static int classify17(const char *s)
Definition
glslkeywords.cpp:1308
classify14
static int classify14(const char *s)
Definition
glslkeywords.cpp:976
classify16
static int classify16(const char *s)
Definition
glslkeywords.cpp:1252
classify19
static int classify19(const char *s)
Definition
glslkeywords.cpp:1455
classify9
static int classify9(const char *s)
Definition
glslkeywords.cpp:620
classify22
static int classify22(const char *s)
Definition
glslkeywords.cpp:1570
classify5
static int classify5(const char *s)
Definition
glslkeywords.cpp:159
classify3
static int classify3(const char *s)
Definition
glslkeywords.cpp:30
classify13
static int classify13(const char *s)
Definition
glslkeywords.cpp:905
classify20
static int classify20(const char *s)
Definition
glslkeywords.cpp:1498
classify8
static int classify8(const char *s)
Definition
glslkeywords.cpp:584
classify12
static int classify12(const char *s)
Definition
glslkeywords.cpp:833
classify7
static int classify7(const char *s)
Definition
glslkeywords.cpp:462
classify10
static int classify10(const char *s)
Definition
glslkeywords.cpp:710
classify6
static int classify6(const char *s)
Definition
glslkeywords.cpp:328
classify11
static int classify11(const char *s)
Definition
glslkeywords.cpp:797
GLSL
Definition
glslast_p.h:26
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtquick3d
src
glslparser
glsllexer_p.h
Generated on
for Qt by
1.18.0