Fix various interrogate issues with parsing PhysX headers

This commit is contained in:
rdb 2015-03-23 19:27:29 +01:00
parent de0b0dd879
commit 38d02fadf9
4 changed files with 33 additions and 13 deletions

View File

@ -495,17 +495,21 @@ declaration:
CPPDeclaration *getter = $5->find_symbol(current_scope, global_scope, current_lexer);
if (getter == (CPPDeclaration *)NULL || getter->get_subtype() != CPPDeclaration::ST_function_group) {
yyerror("Reference to non-existent or invalid getter: " + $5->get_fully_scoped_name(), @1);
}
CPPDeclaration *setter = $7->find_symbol(current_scope, global_scope, current_lexer);
if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) {
yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @1);
}
} else {
CPPDeclaration *setter = $7->find_symbol(current_scope, global_scope, current_lexer);
CPPFunctionGroup *setter_func = NULL;
CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(),
setter->as_function_group(),
current_scope, @1.file);
current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
if (setter == (CPPDeclaration *)NULL || setter->get_subtype() != CPPDeclaration::ST_function_group) {
yyerror("Reference to non-existent or invalid setter: " + $7->get_fully_scoped_name(), @1);
} else {
setter_func = setter->as_function_group();
}
CPPMakeProperty *make_property = new CPPMakeProperty($3, getter->as_function_group(),
setter_func, current_scope, @1.file);
current_scope->add_declaration(make_property, global_scope, current_lexer, @1);
}
}
| KW_MAKE_SEQ '(' name ',' name ',' name ')' ';'
{
@ -1662,6 +1666,24 @@ type_decl:
}
| enum_keyword name ':' enum_element_type
{
CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
if (type != NULL) {
$$ = type;
} else {
CPPExtensionType *et =
CPPType::new_type(new CPPExtensionType($1, $2, current_scope, @1.file))
->as_extension_type();
CPPScope *scope = $2->get_scope(current_scope, global_scope);
if (scope != NULL) {
scope->define_extension_type(et);
}
$$ = et;
}
}
| enum_keyword name
{
yywarning(string("C++ does not permit forward declaration of untyped enum ") + $2->get_fully_scoped_name(), @1);
CPPType *type = $2->find_type(current_scope, global_scope, false, current_lexer);
if (type != NULL) {
$$ = type;

View File

@ -200,7 +200,7 @@ CPPPreprocessor() {
_warning_count = 0;
_error_count = 0;
_error_abort = true;
_error_abort = false;
#ifdef CPP_VERBOSE_LEX
_token_index = 0;
#endif

View File

@ -50,6 +50,7 @@
// PhysX headers
#include "Nxp.h"
#include "NxPhysics.h"
#include "NxExtended.h"
#include "NxStream.h"

View File

@ -46,9 +46,6 @@ PUBLISHED:
static int size() { return 3; }
gray operator [](int i) const { nassertr(i >= 0 && i < 3, 0); return *(&r + i); }
gray &operator [](int i) { nassertr(i >= 0 && i < 3, r); return *(&r + i); }
#ifdef HAVE_PYTHON
void __setitem__(int i, gray v) { operator[](i) = v; }
#endif
pixel operator + (const pixel &other) const
{ return pixel(r + other.r, g + other.g, b + other.b); }
pixel operator - (const pixel &other) const