Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4
#ifndef QSSG_GLSLLEXER_H
5
#define QSSG_GLSLLEXER_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#include <QtQuick3DGlslParser/private/glsl_p.h>
19
#include <QtCore/qstring.h>
20
#include <
qstringlist.h
>
21
22
QT_BEGIN_NAMESPACE
23
24
namespace
GLSL
{
25
26
class
Q_QUICK3DGLSLPARSER_EXPORT
Token
27
{
28
public
:
29
int
kind
;
30
int
position
;
31
int
length
;
32
int
line
;
// ### remove
33
34
union
{
35
int
matchingBrace
;
36
int
i
;
// integer value
37
const
QString
*
string
;
// string value
38
void
*
ptr
;
39
};
40
41
Token
()
42
: kind(0),
position
(0),
length
(0),
line
(0),
ptr
(
nullptr
) {}
43
44
bool
is
(
int
k)
const
{
return
k == kind; }
45
bool
isNot
(
int
k)
const
{
return
k != kind; }
46
47
int
begin
()
const
{
return
position
; }
48
int
end
()
const
{
return
position
+
length
; }
49
};
50
51
class
Q_QUICK3DGLSLPARSER_EXPORT
Lexer
52
{
53
public
:
54
Lexer
(
Engine
*
engine
,
const
char
*
source
,
unsigned
size
);
55
~Lexer
();
56
57
enum
Variant
{
58
// Extra flag bits added to tokens by Lexer::classify() that
59
// indicate which variant of GLSL the keyword belongs to.
60
Variant_GLSL_120 = 0x00010000,
// 1.20 and higher
61
Variant_GLSL_150 = 0x00020000,
// 1.50 and higher
62
Variant_GLSL_400 = 0x00040000,
// 4.00 and higher
63
Variant_GLSL_ES_100 = 0x00080000,
// ES 1.00 and higher
64
Variant_VertexShader = 0x00200000,
65
Variant_FragmentShader = 0x00400000,
66
Variant_Reserved = 0x80000000,
67
Variant_Mask = 0xFFFF0000,
68
Variant_All = 0xFFFF0000
69
};
70
71
union
Value
{
72
int
i
;
73
const
QString
*
string
;
74
void
*
ptr
;
75
};
76
77
Engine
*
engine
()
const
{
return
_engine; }
78
79
int
state
()
const
{
return
_state; }
80
void
setState
(
int
state
) { _state =
state
; }
81
82
int
variant
()
const
{
return
_variant; }
83
void
setVariant
(
int
flags
) { _variant =
flags
; }
84
85
bool
scanKeywords
()
const
{
return
_scanKeywords; }
86
void
setScanKeywords
(
bool
scanKeywords) { _scanKeywords = scanKeywords; }
87
88
bool
scanComments
()
const
{
return
_scanComments; }
89
void
setScanComments
(
bool
scanComments) { _scanComments = scanComments; }
90
91
int
yylex(
Token
*tk);
92
int
findKeyword(
const
char
*word,
int
length
)
const
;
93
94
void
*
yyval
()
const
{
return
_yyval.ptr; }
95
96
static
QStringList
keywords
(
int
variant
);
97
98
private
:
99
static
int
classify(
const
char
*
s
,
int
len
);
100
101
void
yyinp();
102
int
yylex_helper(
const
char
**
position
,
int
*
line
);
103
104
void
warning
(
int
line
,
const
QString
&
message
);
105
void
error
(
int
line
,
const
QString
&
message
);
106
107
private
:
108
Engine
*_engine;
109
const
char
*_source;
110
const
char
*_it;
111
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC
(
"-Wattributes"
)
112
[[maybe_unused]]
int
_size;
113
QT_WARNING_POP
114
int
_yychar;
115
int
_lineno;
116
int
_state;
117
int
_variant;
118
unsigned
_scanKeywords: 1;
119
unsigned
_scanComments: 1;
120
Value _yyval;
121
};
122
123
}
// namespace GLSL
124
125
QT_END_NAMESPACE
126
127
#endif
// QSSG_GLSLLEXER_H
GLSL::Engine
Definition
glslengine_p.h:80
GLSL::Lexer
Definition
glsllexer_p.h:52
GLSL::Lexer::Variant
Variant
Definition
glsllexer_p.h:57
GLSL::Lexer::setScanKeywords
void setScanKeywords(bool scanKeywords)
Definition
glsllexer_p.h:86
GLSL::Lexer::setScanComments
void setScanComments(bool scanComments)
Definition
glsllexer_p.h:89
GLSL::Lexer::state
int state() const
Definition
glsllexer_p.h:79
GLSL::Lexer::variant
int variant() const
Definition
glsllexer_p.h:82
GLSL::Lexer::engine
Engine * engine() const
Definition
glsllexer_p.h:77
GLSL::Lexer::scanKeywords
bool scanKeywords() const
Definition
glsllexer_p.h:85
GLSL::Lexer::scanComments
bool scanComments() const
Definition
glsllexer_p.h:88
GLSL::Lexer::setVariant
void setVariant(int flags)
Definition
glsllexer_p.h:83
GLSL::Lexer::setState
void setState(int state)
Definition
glsllexer_p.h:80
GLSL::Lexer::yyval
void * yyval() const
Definition
glsllexer_p.h:94
GLSL::Token
Definition
glsllexer_p.h:27
GLSL::Token::matchingBrace
int matchingBrace
Definition
glsllexer_p.h:35
GLSL::Token::position
int position
Definition
glsllexer_p.h:30
GLSL::Token::isNot
bool isNot(int k) const
Definition
glsllexer_p.h:45
GLSL::Token::ptr
void * ptr
Definition
glsllexer_p.h:38
GLSL::Token::string
const QString * string
Definition
glsllexer_p.h:37
GLSL::Token::is
bool is(int k) const
Definition
glsllexer_p.h:44
GLSL::Token::end
int end() const
Definition
glsllexer_p.h:48
GLSL::Token::Token
Token()
Definition
glsllexer_p.h:41
GLSL::Token::line
int line
Definition
glsllexer_p.h:32
GLSL::Token::length
int length
Definition
glsllexer_p.h:31
GLSL::Token::kind
int kind
Definition
glsllexer_p.h:29
GLSL::Token::i
int i
Definition
glsllexer_p.h:36
GLSL::Token::begin
int begin() const
Definition
glsllexer_p.h:47
QStringList
\inmodule QtCore
QString
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition
qstring.h:129
state
else opt state
[0]
Definition
doc_src_styles.cpp:11
keywords
static const struct @480 keywords[]
GLSL
Definition
glsl_p.h:22
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
QT_WARNING_POP
#define QT_WARNING_POP
Definition
qcompilerdetection.h:1169
QT_WARNING_DISABLE_GCC
#define QT_WARNING_DISABLE_GCC(text)
Definition
qcompilerdetection.h:1167
QT_WARNING_PUSH
#define QT_WARNING_PUSH
Definition
qcompilerdetection.h:1168
error
DBusConnection const char DBusError * error
Definition
qdbus_symbols_p.h:165
ptr
static ControlElement< T > * ptr(QWidget *widget)
Definition
qmdisubwindow.cpp:223
size
GLenum GLuint GLintptr GLsizeiptr size
[1]
Definition
qopengles2ext.h:660
length
GLenum GLuint GLenum GLsizei length
Definition
qopengles2ext.h:151
flags
GLbitfield flags
Definition
qopengles2ext.h:1026
message
GLuint GLsizei const GLchar * message
Definition
qopengles2ext.h:154
source
GLsizei GLsizei GLchar * source
Definition
qopengles2ext.h:952
s
GLdouble s
[6]
Definition
qopenglext.h:235
len
GLenum GLsizei len
Definition
qopenglext.h:3292
warning
QDebug warning(QAnyStringView fileName, int lineNumber)
Definition
qqmltyperegistrarutils.cpp:39
position
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
Definition
qquickanchors.cpp:66
qstringlist.h
line
QString line
Definition
src_corelib_io_qtextstream.cpp:16
nullptr
QObject::connect nullptr
Definition
src_corelib_kernel_qobject.cpp:255
variant
QVariant variant
[1]
Definition
src_corelib_kernel_qvariant.cpp:32
engine
QJSEngine engine
[0]
Definition
src_script_qjsvalue.cpp:14
GLSL::Lexer::Value
Definition
glsllexer_p.h:71
GLSL::Lexer::Value::ptr
void * ptr
Definition
glsllexer_p.h:74
GLSL::Lexer::Value::string
const QString * string
Definition
glsllexer_p.h:73
GLSL::Lexer::Value::i
int i
Definition
glsllexer_p.h:72
qtquick3d
src
glslparser
glsllexer_p.h
Generated by
1.10.0