Moving towards a "custom" parser for NextReg 0xF0

This commit is contained in:
2025-10-10 17:17:35 +01:00
parent 20764d74d3
commit 7031088bcd
7 changed files with 184 additions and 125 deletions

View File

@@ -12,13 +12,14 @@ interface RegisterBrowserProps {
/**
* Renders the access details for a register, including its description, operations, and notes.
* @param access The register access data to render.
* @param extraNotes Non access footnotes to include in the tooltip.
* @returns A React component that displays the register access details.
*/
export function renderAccess(access: RegisterAccess) {
export function renderAccess(access: RegisterAccess, extraNotes: Note[] = []) {
const renderTooltip = (notes: Note[]) => (
<Tooltip id="tooltip">
{notes.map((note, index) => (
<div key={index}>{note.text}</div>
<div key={index}><code>{note.ref}</code> {note.text}</div>
))}
</Tooltip>
);
@@ -36,7 +37,11 @@ export function renderAccess(access: RegisterAccess) {
</thead>
<tbody>
{access.operations.map((op, index) => {
const notes = access.notes.filter(note => note.ref === op.footnoteRef);
const access_notes = access.notes.filter(note => note.ref === op.footnoteRef);
const extra_notes = extraNotes.filter(note => note.ref === op.footnoteRef);
const notes = [...access_notes, ...extra_notes].filter(note => note.text.length > 0);
return (
<tr key={index}>
<td>{op.bits}</td>
@@ -44,7 +49,7 @@ export function renderAccess(access: RegisterAccess) {
{op.description}
{op.footnoteRef && notes.length > 0 && (
<OverlayTrigger placement="top" overlay={renderTooltip(notes)}>
<span className="footnote-ref">{op.footnoteRef}</span>
<span className="footnote-ref">{op.footnoteRef}</span>
</OverlayTrigger>
)}
</td>