Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
dc76953e
Commit
dc76953e
authored
Nov 25, 2010
by
Roberto Raggi
Browse files
Dump the AST.
parent
af8f7c43
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libs/glsl/tests/main.cpp
View file @
dc76953e
...
...
@@ -2,10 +2,15 @@
#include <glslengine.h>
#include <glslparser.h>
#include <glsllexer.h>
#include <glslastdump.h>
#include <QtCore/QTextStream>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cassert>
#include <cstdio>
using
namespace
GLSL
;
...
...
@@ -16,6 +21,10 @@ using namespace GLSL;
#define EXIT_SUCCESS 0
#endif
namespace
{
QTextStream
qout
(
stdout
,
QIODevice
::
WriteOnly
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
variant
=
0
;
...
...
@@ -69,16 +78,8 @@ int main(int argc, char *argv[])
TranslationUnit
*
ast
=
parser
.
parse
();
std
::
cout
<<
argv
[
1
]
<<
(
ast
?
" OK "
:
" KO "
)
<<
std
::
endl
;
if
(
ast
)
{
assert
(
ast
->
asTranslationUnit
()
!=
0
);
int
n
=
0
;
for
(
List
<
Declaration
*>
*
it
=
ast
->
declarations
;
it
;
it
=
it
->
next
,
++
n
)
{
Declaration
*
decl
=
it
->
value
;
// ### do something with decl
(
void
)
decl
;
}
std
::
cout
<<
"found "
<<
n
<<
" level declarations"
<<
std
::
endl
;
}
ASTDump
dump
(
qout
);
dump
(
ast
);
delete
source
;
delete
ast
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment