1
0
mirror of synced 2024-11-12 10:10:53 +01:00

pattern: Allow variable placements inside of structs

Fixes #364
This commit is contained in:
WerWolv 2022-02-05 23:34:52 +01:00
parent cff8bab3d3
commit b8026398e0

View File

@ -825,7 +825,9 @@ namespace hex::pl {
variableCleanup.release();
return create(new ASTNodeMultiVariableDecl(variables));
} else
} else if (MATCHES(sequence(OPERATOR_AT)))
return create(new ASTNodeVariableDecl(getValue<Token::Identifier>(-2).get(), type, parseMathematicalExpression()));
else
return create(new ASTNodeVariableDecl(getValue<Token::Identifier>(-1).get(), type));
}
@ -848,7 +850,10 @@ namespace hex::pl {
sizeCleanup.release();
return create(new ASTNodeArrayVariableDecl(name, type, size));
if (MATCHES(sequence(OPERATOR_AT)))
return create(new ASTNodeArrayVariableDecl(name, type, size, parseMathematicalExpression()));
else
return create(new ASTNodeArrayVariableDecl(name, type, size));
}
// (parseType) *Identifier : (parseType)
@ -864,7 +869,10 @@ namespace hex::pl {
throwParserError("invalid type used for pointer size", -1);
}
return create(new ASTNodePointerVariableDecl(name, type, sizeType));
if (MATCHES(sequence(OPERATOR_AT)))
return create(new ASTNodePointerVariableDecl(name, type, sizeType, parseMathematicalExpression()));
else
return create(new ASTNodePointerVariableDecl(name, type, sizeType));
}
// [(parsePadding)|(parseMemberVariable)|(parseMemberArrayVariable)|(parseMemberPointerVariable)]