Partial support for fixed sized arrays

This commit is contained in:
Doyle 2019-02-23 14:38:41 +11:00
parent 13ed8b71c9
commit 5297511118
2 changed files with 15 additions and 2 deletions

View File

@ -347,6 +347,8 @@ b32 StrCmp(StringLiteral a, StringLiteral b)
X(EndOfStream, "End Of Stream") \
X(LeftBrace, "{") \
X(RightBrace, "}") \
X(LeftSqBracket, "[") \
X(RightSqBracket, "]") \
X(OpenParen, "(") \
X(CloseParen, ")") \
X(Comma, ",") \
@ -857,7 +859,16 @@ void ParseCPPStruct(CPPTokeniser *tokeniser)
link->value.array_dimensions = total_asterisks_count;
CPPTokeniser_NextToken(tokeniser);
peek_token = CPPTokeniser_PeekToken(tokeniser);
for (peek_token = CPPTokeniser_PeekToken(tokeniser);
peek_token.type == CPPTokenType::LeftSqBracket && peek_token.type != CPPTokenType::EndOfStream;
peek_token = CPPTokeniser_NextToken(tokeniser))
{
// TODO(doyle): Parsing array size is difficult if it's an expression, so maybe don't do it at all
++link->value.array_dimensions;
while (token.type != CPPTokenType::RightSqBracket && token.type != CPPTokenType::EndOfStream)
token = CPPTokeniser_NextToken(tokeniser);
}
if (IsIdentifierToken(peek_token, STR_LITERAL("DQN_INSPECT_META")))
{
link->metadata_array = ParseCPPInspectMeta(tokeniser);
@ -1099,6 +1110,8 @@ int main(int argc, char *argv[])
{
case '{': { token->type = CPPTokenType::LeftBrace; started_lexing_scope = true; indent_level++; } break;
case '}': { token->type = CPPTokenType::RightBrace; indent_level--; } break;
case '[': { token->type = CPPTokenType::LeftSqBracket; } break;
case ']': { token->type = CPPTokenType::RightSqBracket; } break;
case '(': { token->type = CPPTokenType::OpenParen; } break;
case ')': { token->type = CPPTokenType::CloseParen; } break;
case ',': { token->type = CPPTokenType::Comma; } break;

View File

@ -28,9 +28,9 @@ DQN_INSPECT struct OpenGLState
{
// #if 0
// #endif
u32 shaders[(int)OpenGLShader::Count];
void *win32_handle;
int ebo DQN_INSPECT_META(DisplayName = "Element Buffer Object"), vbo, vao DQN_INSPECT_META(DisplayName = "Vertex Array Object", OpenGLVersion = "330");
// u32 shaders[(int)OpenGLShader::Count];
V4 draw_color DQN_INSPECT_META(DisplayName = "HelloWorld");
V3 lighting_ambient_coeff;
char **bitmaps;