import type {Token} from 'sentry/views/starfish/utils/sqlish/types';
export function simpleMarkup(tokens: Token[]): React.ReactElement[] {
const accumulator: React.ReactElement[] = [];
function contentize(content: Token): void {
if (Array.isArray(content.content)) {
content.content.forEach(contentize);
return;
}
if (typeof content.content === 'string') {
if (content.type === 'Keyword') {
accumulator.push({content.content.toUpperCase()});
} else if (content.type === 'Whitespace') {
accumulator.push( );
} else {
accumulator.push({content.content});
}
}
return;
}
tokens.forEach(contentize);
return accumulator;
}