I am developing an application that reads and visualizes the entered codes.
#[account]
pub struct Tweet {
pub author: Pubkey,
pub timestamp: i64,
pub topic: String,
pub content: String,
}
I'm trying to get the struct name and the structures in it
const stringCode = `
#[account]
pub struct Tweet {
pub author: Pubkey,
pub timestamp: i64,
pub topic: String,
pub content: String,
}
`;
const functionRegexp =
/(pub struct\s+)(?<name>[$_\p{ID_Start}][$\u200c\u200c\p{ID_Continue}]*)/u;
const parseCode = () => {
const match = functionRegexp.exec(stringCode);
return parseCode;
};
I can see Tweet name in match.groups.name, but
pub author: Pubkey,
pub timestamp: i64,
pub topic: String,
pub content: String,
if i want to get this data? thanks!