Baseline: tree as shared
This commit is contained in:
1679 files changed
+1024562
No files matched your search
@@ -0,0 +1,7 @@
|
||||
title: Programming+
|
||||
author: Alex Maldonado
|
||||
version: 2.0.0
|
||||
quarto-required: ">=1.5.0"
|
||||
contributes:
|
||||
shortcodes:
|
||||
- pplus.lua
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,302 @@
|
||||
/* ============================================================================
|
||||
widgets/kit.css -- what the two teaching-widget families have in common.
|
||||
|
||||
Two families of interactive widgets are built by static/js:
|
||||
.a86 the x86-64 assembly widgets (js/asm86, css/widgets/asm86.css)
|
||||
.pl the pseudocode lab (js/pseudo, css/widgets/pseudo-lab.css)
|
||||
They were written as twins and shared a design system by copy and paste.
|
||||
This file holds the shared half, written once, so a change to a color
|
||||
role or a button reaches both. The two family stylesheets keep only what
|
||||
is specific to them and must be loaded AFTER this one.
|
||||
|
||||
Color roles carry meaning, so they are worth learning once:
|
||||
amber the step about to run, and anything the last step changed
|
||||
blue a value that was read
|
||||
purple a value that was written
|
||||
green a match, a pass, a proof
|
||||
red a mismatch, an error, a claim a run broke
|
||||
The roles are stated once per theme below. Everything neutral is mixed
|
||||
from the page colors (--bs-body-bg / --bs-body-color), so a widget sits
|
||||
on whatever background the page gives it.
|
||||
|
||||
Dark mode keys off `body.quarto-dark`, which is what Quarto actually sets.
|
||||
`[data-bs-theme="dark"]` is grouped in only as a fallback. Reading the OS
|
||||
preference (prefers-color-scheme) on a Quarto page is the bug that once
|
||||
made a light page render a dark widget, so nothing here does.
|
||||
|
||||
Tokens (--w-*)
|
||||
--w-page --w-ink --w-dim --w-rule --w-surface --w-surface-2
|
||||
--w-change --w-read --w-write --w-match --w-miss and their -bg washes
|
||||
--w-mono --w-sans --w-fs
|
||||
--w-fs is the one size that drives every piece of text in a widget. Each
|
||||
rule states its size as a multiple of it, so fullscreen raises them all at
|
||||
once. At 0.95rem a widget reads a step below the page's body text.
|
||||
==========================================================================*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------ tokens */
|
||||
|
||||
:is(.a86, .pl) {
|
||||
--w-page: var(--bs-body-bg, #ffffff);
|
||||
--w-ink: var(--bs-body-color, #1b1f24);
|
||||
|
||||
/* 70%, matching the muted gray in base/site.css and bio.css: at 60% the
|
||||
result fails WCAG AA for normal-size text on a white background. */
|
||||
--w-dim: color-mix(in srgb, var(--w-ink) 70%, transparent);
|
||||
--w-rule: color-mix(in srgb, var(--w-ink) 20%, transparent);
|
||||
--w-surface: var(--w-page);
|
||||
--w-surface-2: color-mix(in srgb, var(--w-ink) 6%, var(--w-page));
|
||||
|
||||
--w-change: #8a5c05;
|
||||
--w-read: #17618f;
|
||||
--w-write: #6a4299;
|
||||
--w-match: #266a41;
|
||||
--w-miss: #93291f;
|
||||
|
||||
--w-change-bg: color-mix(in srgb, var(--w-change) 13%, var(--w-page));
|
||||
--w-read-bg: color-mix(in srgb, var(--w-read) 13%, var(--w-page));
|
||||
--w-write-bg: color-mix(in srgb, var(--w-write) 13%, var(--w-page));
|
||||
--w-match-bg: color-mix(in srgb, var(--w-match) 15%, var(--w-page));
|
||||
--w-miss-bg: color-mix(in srgb, var(--w-miss) 13%, var(--w-page));
|
||||
|
||||
--w-mono: var(--bs-font-monospace, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
|
||||
--w-sans: var(--bs-font-sans-serif, system-ui, sans-serif);
|
||||
--w-fs: 0.95rem;
|
||||
|
||||
color: var(--w-ink);
|
||||
font-size: var(--w-fs);
|
||||
line-height: 1.45;
|
||||
margin: 1.4rem 0;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* A tinted panel needs a stronger wash to read against a dark page, and the
|
||||
accents have to lighten to stay legible on it. */
|
||||
body.quarto-dark :is(.a86, .pl),
|
||||
[data-bs-theme="dark"] :is(.a86, .pl) {
|
||||
--w-change: #e0a93a;
|
||||
--w-read: #6fb4e3;
|
||||
--w-write: #c0a0e0;
|
||||
--w-match: #74c391;
|
||||
--w-miss: #e08a80;
|
||||
|
||||
--w-rule: color-mix(in srgb, var(--w-ink) 28%, transparent);
|
||||
--w-surface-2: color-mix(in srgb, var(--w-ink) 9%, var(--w-page));
|
||||
|
||||
--w-change-bg: color-mix(in srgb, var(--w-change) 22%, var(--w-page));
|
||||
--w-read-bg: color-mix(in srgb, var(--w-read) 22%, var(--w-page));
|
||||
--w-write-bg: color-mix(in srgb, var(--w-write) 22%, var(--w-page));
|
||||
--w-match-bg: color-mix(in srgb, var(--w-match) 22%, var(--w-page));
|
||||
--w-miss-bg: color-mix(in srgb, var(--w-miss) 22%, var(--w-page));
|
||||
}
|
||||
|
||||
/* Fallback for browsers without color-mix(). */
|
||||
@supports not (background: color-mix(in srgb, white 50%, black)) {
|
||||
:is(.a86, .pl) {
|
||||
--w-dim: #666f78;
|
||||
--w-rule: #d5dae0;
|
||||
--w-surface-2: #f4f6f8;
|
||||
--w-change-bg: #fdf1d8;
|
||||
--w-read-bg: #e1eef9;
|
||||
--w-write-bg: #efe6f7;
|
||||
--w-match-bg: #dcefe2;
|
||||
--w-miss-bg: #f8e3e1;
|
||||
}
|
||||
|
||||
body.quarto-dark :is(.a86, .pl) {
|
||||
--w-dim: #98a2ab;
|
||||
--w-rule: #3a424b;
|
||||
--w-surface-2: #21262c;
|
||||
--w-change-bg: #453518;
|
||||
--w-read-bg: #1b3348;
|
||||
--w-write-bg: #33254a;
|
||||
--w-match-bg: #1d3a28;
|
||||
--w-miss-bg: #3f2320;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------- shared rules
|
||||
Each rule below was identical in both stylesheets. Rules that differ
|
||||
between the families (panels, code rows, cells, legends...) stay in the
|
||||
family file that owns them. */
|
||||
|
||||
/* --- Widget shell ------------------------------------------------------ */
|
||||
|
||||
.a86:focus-visible,
|
||||
.pl:focus-visible {
|
||||
box-shadow: 0 0 0 3px var(--w-change-bg);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.a86 code,
|
||||
.a86 code:not(.sourceCode),
|
||||
.pl code,
|
||||
.pl code:not(.sourceCode) {
|
||||
background: none;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
font-family: var(--w-mono);
|
||||
}
|
||||
|
||||
/* --- Text -------------------------------------------------------------- */
|
||||
|
||||
.a86-title,
|
||||
.pl-title {
|
||||
font-size: calc(var(--w-fs) * 1.13);
|
||||
margin: 0 0 0.2rem;
|
||||
}
|
||||
|
||||
.a86-blurb,
|
||||
.pl-blurb {
|
||||
color: var(--w-dim);
|
||||
margin: 0 0 0.7rem;
|
||||
max-width: 62ch;
|
||||
}
|
||||
|
||||
.a86-muted,
|
||||
.pl-muted {
|
||||
color: var(--w-dim);
|
||||
}
|
||||
|
||||
.a86-error,
|
||||
.pl-error {
|
||||
color: var(--w-miss);
|
||||
background: var(--w-miss-bg);
|
||||
border-left: 3px solid var(--w-miss);
|
||||
padding: 0.4rem 0.6rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
/* --- Controls ---------------------------------------------------------- */
|
||||
|
||||
.a86-controls,
|
||||
.pl-controls {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
padding: 0.4rem 0.5rem;
|
||||
margin-bottom: 0.7rem;
|
||||
background: var(--w-surface-2);
|
||||
border: 1px solid var(--w-rule);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.a86-btn,
|
||||
.pl-btn {
|
||||
font: inherit;
|
||||
font-size: calc(var(--w-fs) * 0.96);
|
||||
padding: 0.22rem 0.62rem;
|
||||
color: var(--w-ink);
|
||||
background: var(--w-surface-2);
|
||||
border: 1px solid var(--w-rule);
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.a86-btn:hover,
|
||||
.pl-btn:hover {
|
||||
border-color: var(--w-change);
|
||||
}
|
||||
|
||||
.a86-btn-primary,
|
||||
.pl-btn-primary {
|
||||
border-color: var(--w-change);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.a86-slider,
|
||||
.pl-slider {
|
||||
flex: 1 1 140px;
|
||||
min-width: 110px;
|
||||
accent-color: var(--w-change);
|
||||
}
|
||||
|
||||
.a86-readout,
|
||||
.pl-readout {
|
||||
font-family: var(--w-mono);
|
||||
font-size: calc(var(--w-fs) * 0.93);
|
||||
color: var(--w-dim);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.a86-btn-full,
|
||||
.pl-btn-full {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* --- Layout ------------------------------------------------------------ */
|
||||
|
||||
.a86-grid,
|
||||
.pl-grid {
|
||||
display: grid;
|
||||
gap: 0.7rem;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.a86-panel-title,
|
||||
.pl-panel-title {
|
||||
font-family: var(--w-sans);
|
||||
font-size: calc(var(--w-fs) * 0.89);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--w-dim);
|
||||
margin: 0 0 0.45rem;
|
||||
}
|
||||
|
||||
/* --- Fullscreen -------------------------------------------------------- */
|
||||
|
||||
.a86.is-fullscreen,
|
||||
.pl.is-fullscreen {
|
||||
--w-fs: clamp(1rem, 0.35rem + 0.62vw, 1.3rem);
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1090;
|
||||
margin: 0;
|
||||
padding: 0.9rem 1.1rem 2rem;
|
||||
background: var(--w-page);
|
||||
overflow: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.a86.is-fullscreen .a86-controls,
|
||||
.pl.is-fullscreen .pl-controls {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.a86.is-fullscreen .a86-grid,
|
||||
.pl.is-fullscreen .pl-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.a86.is-fullscreen .a86-trace-wrap,
|
||||
.pl.is-fullscreen .pl-trace-wrap {
|
||||
max-height: 28rem;
|
||||
}
|
||||
|
||||
/* --- Code listing ------------------------------------------------------ */
|
||||
|
||||
.a86-code-marker,
|
||||
.pl-code-marker {
|
||||
color: var(--w-change);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.a86-code-row.is-last,
|
||||
.pl-code-row.is-last {
|
||||
background: var(--w-surface-2);
|
||||
}
|
||||
|
||||
.a86-code-row.is-error,
|
||||
.pl-code-row.is-error {
|
||||
background: var(--w-miss-bg);
|
||||
border-left-color: var(--w-miss);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/* ============================================================================
|
||||
base/tokens.css -- design tokens shared by the course kit
|
||||
(blocks, algorithms, worked examples, page furniture, figures and the
|
||||
viz.js chart helpers). Custom properties only: loading this file changes
|
||||
nothing on a page that does not use them.
|
||||
|
||||
Everything is derived from --bs-body-color / --bs-body-bg, which Quarto
|
||||
sets for each theme and swaps on the light/dark toggle, so a token that
|
||||
mixes them needs no dark-mode rule of its own. Hue tokens (role colors,
|
||||
the categorical palette) do have a dark value, set on body.quarto-dark.
|
||||
==========================================================================*/
|
||||
|
||||
:root {
|
||||
/* ---- surfaces and text ---- */
|
||||
--course-ink: var(--bs-body-color, #212529);
|
||||
--course-paper: var(--bs-body-bg, #fff);
|
||||
--course-muted: color-mix(in srgb, var(--course-ink) 68%, transparent);
|
||||
--course-rule: color-mix(in srgb, var(--course-ink) 18%, transparent);
|
||||
--course-wash: color-mix(in srgb, var(--course-ink) 4%, var(--course-paper));
|
||||
--course-radius: 6px;
|
||||
|
||||
/* ---- role colors: which kind of block a reader is looking at ---- */
|
||||
--course-key: #2563eb;
|
||||
/* key idea, definition, theorem */
|
||||
--course-intuition: #7c3aed;
|
||||
/* intuition, why it matters */
|
||||
--course-caution: #b45309;
|
||||
/* pitfall, misconception */
|
||||
--course-practice: #047857;
|
||||
/* in practice, worked example, checkpoint */
|
||||
--course-algorithm: #0f766e;
|
||||
/* algorithm cards */
|
||||
--course-history: #78716c;
|
||||
/* history, going deeper */
|
||||
--course-draft: #c026d3;
|
||||
/* author notes, never shown to students */
|
||||
|
||||
/* ---- categorical palette (Okabe & Ito), safe for color-vision deficiency.
|
||||
viz.js and any hand-written figure take colors from here, in order. ---- */
|
||||
--viz-1: #0072b2;
|
||||
/* blue */
|
||||
--viz-2: #d55e00;
|
||||
/* vermillion */
|
||||
--viz-3: #009e73;
|
||||
/* bluish green */
|
||||
--viz-4: #cc79a7;
|
||||
/* reddish purple */
|
||||
--viz-5: #e69f00;
|
||||
/* orange */
|
||||
--viz-6: #56b4e9;
|
||||
/* sky blue */
|
||||
--viz-7: #f0e442;
|
||||
/* yellow */
|
||||
--viz-8: #000000;
|
||||
/* black */
|
||||
|
||||
/* diverging (negative .. positive) and the single-hue ramp for magnitudes */
|
||||
--viz-neg: #0072b2;
|
||||
--viz-pos: #d55e00;
|
||||
--viz-ramp: #0072b2;
|
||||
|
||||
/* axes, gridlines, labels inside a chart */
|
||||
--viz-ink: var(--course-ink);
|
||||
--viz-muted: var(--course-muted);
|
||||
--viz-grid: color-mix(in srgb, var(--course-ink) 12%, transparent);
|
||||
--viz-bg: var(--course-paper);
|
||||
}
|
||||
|
||||
body.quarto-dark {
|
||||
--course-key: #7aa2ff;
|
||||
--course-intuition: #b79cff;
|
||||
--course-caution: #f0a04b;
|
||||
--course-practice: #4cc9a0;
|
||||
--course-algorithm: #4fd1c5;
|
||||
--course-history: #b4aca5;
|
||||
--course-draft: #e879f9;
|
||||
|
||||
--viz-1: #56b4e9;
|
||||
--viz-2: #f28e4b;
|
||||
--viz-3: #2fc99a;
|
||||
--viz-4: #e9a3c8;
|
||||
--viz-5: #f5b942;
|
||||
--viz-6: #8fd0f5;
|
||||
--viz-7: #f5ec6a;
|
||||
--viz-8: #e5e5e5;
|
||||
--viz-neg: #56b4e9;
|
||||
--viz-pos: #f28e4b;
|
||||
--viz-ramp: #56b4e9;
|
||||
}
|
||||
|
||||
/* Fallback for browsers without color-mix(). */
|
||||
@supports not (background: color-mix(in srgb, white 50%, black)) {
|
||||
:root {
|
||||
--course-muted: rgba(33, 37, 41, 0.68);
|
||||
--course-rule: rgba(128, 128, 128, 0.3);
|
||||
--course-wash: rgba(128, 128, 128, 0.06);
|
||||
--viz-grid: rgba(128, 128, 128, 0.25);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/* pplus-hw.css: GENERATED by `pixi run quarto-css` (scripts/quarto-css.mjs) from styles/course/bridge.css. Do not edit.
|
||||
The Hardware board's adjustments to the course's machine views (course/*.css), for the pplus-hw shortcodes. A Quarto
|
||||
page already has the colors and fonts those files read (--bs-body-bg, --bs-body-color, body.quarto-dark). */
|
||||
/* ---------------------------------------------------------------------------
|
||||
The Hardware area's machine board (src/ui/hw/board.ts) puts the course's
|
||||
views in the app's dock. Adjustments for that home, never in the course files.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* A register card that also shows its narrower names needs room for the
|
||||
name, sixteen hex digits, and the width on one line. */
|
||||
.board-a86 .a86-regs {
|
||||
grid-template-columns: repeat(auto-fill, minmax(calc(var(--w-fs) * 17), 1fr));
|
||||
}
|
||||
|
||||
.board-a86 .a86-width-row {
|
||||
grid-template-columns: calc(var(--w-fs) * 2.83) minmax(0, 1fr) auto;
|
||||
}
|
||||
.board-a86 .a86-regs { align-items: start; }
|
||||
|
||||
/* The "was ..." line under a register's value is empty until the register
|
||||
changes. asm86.css gives it a min-height (0.8rem) shorter than its own line
|
||||
box, so a card grew a few pixels the step it changed and shrank on the next,
|
||||
moving every card below it. Reserve the whole line, filled or not. */
|
||||
.board-a86 .a86-reg-prev {
|
||||
line-height: 1.35;
|
||||
min-height: 1.35em;
|
||||
}
|
||||
|
||||
.board-a86.a86 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* The board's own "Cache lines" view (src/ui/hw/lines.ts): a line as a row of
|
||||
byte cells, in the course's load, store and match colors. */
|
||||
.hw-line + .hw-line {
|
||||
margin-top: 0.6rem;
|
||||
padding-top: 0.6rem;
|
||||
border-top: 1px dashed var(--w-rule);
|
||||
}
|
||||
|
||||
.hw-line-head,
|
||||
.hw-line-use {
|
||||
margin: 0.2rem 0;
|
||||
}
|
||||
|
||||
.hw-line-cells {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(var(--hw-line, 16), minmax(0, 1fr));
|
||||
gap: 2px;
|
||||
max-width: calc(var(--hw-line, 16) * 1.9rem);
|
||||
}
|
||||
|
||||
.hw-line-cell {
|
||||
display: block;
|
||||
min-height: 1.6rem;
|
||||
border: 1px solid var(--w-rule);
|
||||
border-radius: 2px;
|
||||
background: var(--w-surface);
|
||||
color: var(--w-dim);
|
||||
font-family: var(--w-mono);
|
||||
font-size: 0.7rem;
|
||||
line-height: 1.6rem;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.hw-line-cell.is-read { background: var(--w-read-bg); border-color: var(--w-read); color: var(--w-read); }
|
||||
.hw-line-cell.is-write { background: var(--w-write-bg); border-color: var(--w-write); color: var(--w-write); }
|
||||
.hw-line-cell.is-used { background: var(--w-match-bg); }
|
||||
.hw-line-cell.is-later { background: var(--w-surface-2); border-style: dashed; }
|
||||
|
||||
.hw-swatch {
|
||||
display: inline-block;
|
||||
width: 1rem;
|
||||
min-height: 0.9rem;
|
||||
height: 0.9rem;
|
||||
vertical-align: middle;
|
||||
margin-right: 0.3rem;
|
||||
}
|
||||
|
||||
.hw-hit { color: var(--w-match); font-weight: 600; }
|
||||
.hw-miss { color: var(--w-miss); font-weight: 600; }
|
||||
|
||||
/* The whole core (machineView in hwviews.js): a lit edge's arrowhead takes the
|
||||
edge's color, so the head shows which way that instruction's data moved. */
|
||||
.a86-chip-svg marker.is-active path { fill: var(--w-change); }
|
||||
.a86-chip-svg marker.is-load path { fill: var(--w-read); }
|
||||
.a86-chip-svg marker.is-store path { fill: var(--w-write); }
|
||||
.a86-chip-edge.is-active { stroke-width: 2.2; }
|
||||
|
||||
/* The sentence under the core is one line for some instructions and two for
|
||||
others; hold two, so the legend under it stays put while stepping. */
|
||||
.board-a86 .a86-chip-caption {
|
||||
line-height: 1.45;
|
||||
min-height: 4.35em;
|
||||
}
|
||||
|
||||
/* A port's box is 29 units wide; at 9px "alu mul" fits only in a narrow face,
|
||||
and spills into the next port in the wider fallback fonts. */
|
||||
.a86-chip-node.is-port .a86-chip-sub { font-size: 7px; }
|
||||
|
||||
/* Address arithmetic is one line ("named no memory address") on most steps and
|
||||
a two-row sum with a note on the others. Hold the taller shape, so the card
|
||||
and everything below it keep their place. */
|
||||
.board-a86 .a86-addr { min-height: calc(var(--w-fs) * 14.5); }
|
||||
|
||||
/* The cache-line view lists the lines the last access touched: none before the
|
||||
first access, one or two after. Hold two, so the legend under it stays put. */
|
||||
.board-a86 .hw-lines { min-height: 78px; }
|
||||
|
||||
/* A listing row's trailing comment takes what width is left. In a narrow card
|
||||
that is nothing, and a wrapping comment then stood one character per line,
|
||||
leaving tall blank rows. Cut it with an ellipsis instead (a comment on its
|
||||
own line still wraps). */
|
||||
.board-a86 .a86-code-row:not(.is-note) > .a86-code-comment {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
@@ -0,0 +1,798 @@
|
||||
/* pplus-views.css: GENERATED by `pixi run quarto-css` (scripts/quarto-css.mjs) from styles.css. Do not edit.
|
||||
The app's own rules for what the static views draw, scoped under .pplus-static, with the app's color tokens;
|
||||
the paper and ink follow the Quarto page (Bootstrap's variables). */
|
||||
.pplus-static {
|
||||
--paper: var(--bs-body-bg, #ffffff);
|
||||
--paper-2: color-mix(in srgb, var(--bs-body-bg, #ffffff) 94%, var(--bs-body-color, #16191f));
|
||||
--paper-3: color-mix(in srgb, var(--bs-body-bg, #ffffff) 88%, var(--bs-body-color, #16191f));
|
||||
--ink: var(--bs-body-color, #16191f);
|
||||
--ink-2: color-mix(in srgb, var(--bs-body-color, #16191f) 68%, var(--bs-body-bg, #ffffff));
|
||||
--ink-3: color-mix(in srgb, var(--bs-body-color, #16191f) 48%, var(--bs-body-bg, #ffffff));
|
||||
--line: color-mix(in srgb, var(--bs-body-color, #16191f) 14%, var(--bs-body-bg, #ffffff));
|
||||
--line-2: color-mix(in srgb, var(--bs-body-color, #16191f) 24%, var(--bs-body-bg, #ffffff));
|
||||
--mono: var(--bs-font-monospace, "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace);
|
||||
--sans: inherit;
|
||||
--bg: var(--paper); --bg-2: var(--paper-2); --bg-3: var(--paper-3); --fg: var(--ink); --fg-2: var(--ink-2); --note: var(--ink-3);
|
||||
--current: var(--marker-bg); --last: var(--last-bg); --radius: var(--r-lg);
|
||||
--accent: #2f5bea;
|
||||
--accent-ink: #ffffff;
|
||||
--accent-bg: #e7edfd;
|
||||
--marker: #f6c453;
|
||||
--marker-bg: #fff3cf;
|
||||
--last-bg: #e3ecfb;
|
||||
--ok: #1f9d63;
|
||||
--ok-bg: #e2f5ea;
|
||||
--warn: #b5700d;
|
||||
--warn-bg: #fdf0d6;
|
||||
--err: #d64545;
|
||||
--err-bg: #fbe3e3;
|
||||
--r: 6px;
|
||||
--r-lg: 10px;
|
||||
--shadow: 0 10px 30px rgba(22, 25, 31, .10);
|
||||
--tok-keyword: #1d46c7;
|
||||
--tok-builtin: #7a3fc4;
|
||||
--tok-string: #a8580d;
|
||||
--tok-number: #0f7b6c;
|
||||
--tok-comment: #8a919c;
|
||||
--tok-label: #b4247a;
|
||||
--brand-bg: #f6c453;
|
||||
--brand-fg: #16191f;
|
||||
--brand-edge: #e0ab35;
|
||||
--bg: var(--paper);
|
||||
--bg-2: var(--paper-2);
|
||||
--bg-3: var(--paper-3);
|
||||
--fg: var(--ink);
|
||||
--fg-2: var(--ink-2);
|
||||
--note: var(--ink-3);
|
||||
--current: var(--marker-bg);
|
||||
--last: var(--last-bg);
|
||||
--radius: var(--r-lg);
|
||||
--k-write: #2f5bea;
|
||||
--k-decision: #b5700d;
|
||||
--k-loop: #7a3fc4;
|
||||
--k-call: #0f7b6c;
|
||||
--k-return: #1f9d63;
|
||||
--k-io: #b4247a;
|
||||
--k-life: #8a919c;
|
||||
--k-error: #d64545;
|
||||
--k-other: #c9cfd8;
|
||||
--lang-lingo: #1f9d63;
|
||||
--lang-matho: #b5700d;
|
||||
--lang-pseudo: #2f5bea;
|
||||
--lang-speco: #7a3fc4;
|
||||
--lang-mojo: #e0592a;
|
||||
--lang-asm: #5c6370;
|
||||
}
|
||||
body.quarto-dark .pplus-static,
|
||||
[data-bs-theme="dark"] .pplus-static {
|
||||
--accent: #8db0ff;
|
||||
--accent-ink: #0f1626;
|
||||
--accent-bg: #1f2b4a;
|
||||
--marker: #f0c05a;
|
||||
--marker-bg: #4a3c12;
|
||||
--last-bg: #1f3350;
|
||||
--ok: #5fd39a;
|
||||
--ok-bg: #16331f;
|
||||
--warn: #f0b860;
|
||||
--warn-bg: #3a2c12;
|
||||
--err: #ff8585;
|
||||
--err-bg: #3f1b1b;
|
||||
--shadow: 0 10px 30px rgba(0, 0, 0, .45);
|
||||
--tok-keyword: #8db0ff;
|
||||
--tok-builtin: #c9a7ff;
|
||||
--tok-string: #f2b56b;
|
||||
--tok-number: #5fd3c6;
|
||||
--tok-comment: #7c8594;
|
||||
--tok-label: #f49ac2;
|
||||
--brand-bg: #0e1117;
|
||||
--brand-fg: #f0c05a;
|
||||
--brand-edge: #2c333f;
|
||||
--k-write: #8db0ff;
|
||||
--k-decision: #f0b860;
|
||||
--k-loop: #c9a7ff;
|
||||
--k-call: #5fd3c6;
|
||||
--k-return: #5fd39a;
|
||||
--k-io: #f49ac2;
|
||||
--k-life: #7c8594;
|
||||
--k-error: #ff8585;
|
||||
--k-other: #3b4452;
|
||||
--lang-mojo: #ff8a5c;
|
||||
--lang-asm: #a7afbc;
|
||||
}
|
||||
|
||||
.pplus-static .mono {
|
||||
font-family: var(--mono);
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
.pplus-static .muted {
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .small {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pplus-static .hint {
|
||||
font-size: 12.5px;
|
||||
color: var(--ink-2);
|
||||
background: var(--paper-3);
|
||||
border-left: 3px solid var(--accent);
|
||||
padding: 6px 10px;
|
||||
border-radius: 4px;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.pplus-static .math {
|
||||
font-family: "STIX Two Math", "Cambria Math", var(--mono);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pplus-static .badge {
|
||||
display: inline-block;
|
||||
font-size: 11.5px;
|
||||
padding: 1px 8px;
|
||||
border-radius: 10px;
|
||||
font-weight: 600;
|
||||
margin-right: 6px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.pplus-static .badge-proved {
|
||||
background: var(--ok-bg);
|
||||
color: var(--ok);
|
||||
}
|
||||
|
||||
.pplus-static .badge-broken {
|
||||
background: var(--err-bg);
|
||||
color: var(--err);
|
||||
}
|
||||
|
||||
.pplus-static .badge-open {
|
||||
background: var(--warn-bg);
|
||||
color: var(--warn);
|
||||
}
|
||||
|
||||
.pplus-static .spacer {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pplus-static .badge {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pplus-static .legend {
|
||||
font-size: 11.5px;
|
||||
color: var(--ink-2);
|
||||
position: relative;
|
||||
align-self: center;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.pplus-static .legend summary {
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.pplus-static .legend[open] summary {
|
||||
background: var(--paper-3);
|
||||
}
|
||||
|
||||
.pplus-static .view {
|
||||
padding: 10px 14px 20px;
|
||||
}
|
||||
|
||||
.pplus-static .tok-keyword {
|
||||
color: var(--tok-keyword);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .tok-builtin {
|
||||
color: var(--tok-builtin);
|
||||
}
|
||||
|
||||
.pplus-static .tok-string {
|
||||
color: var(--tok-string);
|
||||
}
|
||||
|
||||
.pplus-static .tok-number {
|
||||
color: var(--tok-number);
|
||||
}
|
||||
|
||||
.pplus-static .tok-comment {
|
||||
color: var(--tok-comment);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.pplus-static .tok-label {
|
||||
color: var(--tok-label);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .tok-op {
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .tok-error {
|
||||
color: var(--err);
|
||||
text-decoration: underline wavy;
|
||||
text-decoration-skip-ink: none;
|
||||
}
|
||||
|
||||
.pplus-static .tok-punct {
|
||||
color: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .tok-convention {
|
||||
color: var(--tok-keyword);
|
||||
font-style: italic;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .tok-transfer {
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pplus-static .tok-name {
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.pplus-static .tbl {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
.pplus-static .tbl caption {
|
||||
text-align: left;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
color: var(--ink-2);
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.pplus-static .tbl th {
|
||||
text-align: left;
|
||||
font-weight: 600;
|
||||
font-size: 11.5px;
|
||||
color: var(--ink-2);
|
||||
padding: 3px 6px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.pplus-static .tbl td {
|
||||
padding: 3px 6px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.pplus-static .problems,
|
||||
.pplus-static .obligations,
|
||||
.pplus-static .facts {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pplus-static .problem {
|
||||
display: grid;
|
||||
grid-template-columns: 14px auto 1fr auto auto;
|
||||
gap: 8px;
|
||||
align-items: start;
|
||||
padding: 7px 0;
|
||||
border-bottom: 1px solid var(--line);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pplus-static .problem-sev {
|
||||
font-size: 10px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.pplus-static .problem-error .problem-sev {
|
||||
color: var(--err);
|
||||
}
|
||||
|
||||
.pplus-static .problem-warning .problem-sev {
|
||||
color: var(--warn);
|
||||
}
|
||||
|
||||
.pplus-static .problem-note .problem-sev {
|
||||
color: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .problem-guide {
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pplus-static .proof-counts {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.pplus-static .proof-unit {
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--r);
|
||||
padding: 6px 10px;
|
||||
}
|
||||
|
||||
.pplus-static .proof-unit summary {
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pplus-static .obligation {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto 1fr;
|
||||
gap: 8px;
|
||||
align-items: baseline;
|
||||
padding: 6px 0;
|
||||
border-top: 1px solid var(--line);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pplus-static .ob-detail {
|
||||
grid-column: 1 / -1;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
.pplus-static .ob-detail summary {
|
||||
color: var(--ink-2);
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pplus-static .facts li {
|
||||
padding: 1px 0 1px 12px;
|
||||
}
|
||||
|
||||
.pplus-static .goal {
|
||||
padding: 2px 0 2px 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .perf-tbl {
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
.pplus-static .perf-tbl td:first-child {
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .bounds {
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
.pplus-static .viz-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 8px;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
.pplus-static .viz-title {
|
||||
font-family: var(--mono);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .viz-scroll {
|
||||
overflow: auto;
|
||||
max-width: 100%;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--r-lg);
|
||||
background: var(--paper-2);
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.pplus-static .flow-svg {
|
||||
display: block;
|
||||
font-family: var(--mono);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pplus-static .flow-svg text {
|
||||
fill: var(--ink);
|
||||
}
|
||||
|
||||
.pplus-static .flow-shape {
|
||||
stroke: var(--ink-2);
|
||||
stroke-width: 1.2;
|
||||
}
|
||||
|
||||
.pplus-static .flow-term {
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.pplus-static .flow-edge {
|
||||
fill: none;
|
||||
stroke: var(--ink-2);
|
||||
stroke-width: 1.4;
|
||||
}
|
||||
|
||||
.pplus-static .flow-back {
|
||||
stroke-dasharray: 4 3;
|
||||
}
|
||||
|
||||
.pplus-static .flow-arrowhead {
|
||||
fill: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .flow-badge {
|
||||
fill: var(--paper-3);
|
||||
stroke: var(--line);
|
||||
}
|
||||
|
||||
.pplus-static .flow-badge-never {
|
||||
fill: var(--warn-bg);
|
||||
stroke: var(--warn);
|
||||
}
|
||||
|
||||
.pplus-static .flow-badge-text {
|
||||
font-size: 10.5px;
|
||||
fill: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .flow-never .flow-shape {
|
||||
stroke-dasharray: 3 3;
|
||||
stroke: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .flow-never text {
|
||||
fill: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .flow-edge-label {
|
||||
font-size: 10.5px;
|
||||
fill: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .flow-edge-label-bg {
|
||||
fill: var(--paper-2);
|
||||
}
|
||||
|
||||
.pplus-static .df-node {
|
||||
stroke: var(--ink-2);
|
||||
stroke-width: 1.2;
|
||||
fill: var(--paper-2);
|
||||
}
|
||||
|
||||
.pplus-static .df-node-in {
|
||||
fill: var(--accent-bg);
|
||||
}
|
||||
|
||||
.pplus-static .df-node-out {
|
||||
fill: var(--ok-bg);
|
||||
}
|
||||
|
||||
.pplus-static .df-node-loop {
|
||||
stroke-dasharray: 5 3;
|
||||
}
|
||||
|
||||
.pplus-static .df-edge {
|
||||
fill: none;
|
||||
stroke: var(--ink-2);
|
||||
stroke-width: 1.4;
|
||||
}
|
||||
|
||||
.pplus-static .df-edge-ctrl {
|
||||
stroke-dasharray: 4 3;
|
||||
stroke: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .df-type {
|
||||
font-size: 10px;
|
||||
fill: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .df-label {
|
||||
font-size: 10px;
|
||||
fill: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .df-label-bg {
|
||||
fill: var(--paper-2);
|
||||
}
|
||||
|
||||
.pplus-static .vals-scroll {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.pplus-static .vals-tbl {
|
||||
border-collapse: collapse;
|
||||
font-family: var(--mono);
|
||||
font-size: 12px;
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
.pplus-static .vals-tbl th,
|
||||
.pplus-static .vals-tbl td {
|
||||
border: 1px solid var(--line);
|
||||
padding: 3px 8px;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pplus-static .vals-tbl thead th {
|
||||
background: var(--paper-3);
|
||||
color: var(--ink-2);
|
||||
font-weight: 500;
|
||||
text-align: center;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.pplus-static .vals-tbl thead tr:nth-child(2) th {
|
||||
top: 25px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.pplus-static .vals-corner,
|
||||
.pplus-static .vals-var {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
background: var(--paper-3);
|
||||
z-index: 1;
|
||||
text-align: left !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .vals-tbl thead .vals-corner {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.pplus-static .vals-changed {
|
||||
font-weight: 600;
|
||||
background: var(--accent-bg);
|
||||
}
|
||||
|
||||
.pplus-static .vals-same {
|
||||
color: var(--ink-3);
|
||||
}
|
||||
|
||||
.pplus-static .vals-absent {
|
||||
background: repeating-linear-gradient(45deg, transparent 0 4px, var(--paper-3) 4px 5px);
|
||||
}
|
||||
|
||||
.pplus-static .vals-unset {
|
||||
color: var(--ink-3);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.pplus-static .vals-out {
|
||||
background: var(--ok-bg);
|
||||
}
|
||||
|
||||
.pplus-static .view-table .viz-scroll,
|
||||
.pplus-static .view-flow .viz-scroll,
|
||||
.pplus-static .view-data .viz-scroll {
|
||||
max-height: calc(100vh - 220px);
|
||||
}
|
||||
|
||||
.pplus-static .life {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.pplus-static .life-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(120px, 18%) 1fr minmax(140px, 20%);
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.pplus-static .life-id {
|
||||
color: var(--ink-3);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.pplus-static .life-lane {
|
||||
position: relative;
|
||||
height: 22px;
|
||||
border-bottom: 1px dashed var(--line);
|
||||
}
|
||||
|
||||
.pplus-static .life-bar {
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background: var(--accent);
|
||||
opacity: 0.35;
|
||||
}
|
||||
|
||||
.pplus-static .life-bar-copied {
|
||||
background: var(--tok-string);
|
||||
}
|
||||
|
||||
.pplus-static .life-bar-moved {
|
||||
background: var(--tok-number);
|
||||
}
|
||||
|
||||
.pplus-static .life-mark {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
margin-left: -7px;
|
||||
padding: 0;
|
||||
border: 2px solid var(--paper);
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
background: var(--accent);
|
||||
}
|
||||
|
||||
.pplus-static .life-mark.legend {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
top: 3px;
|
||||
margin: 0 2px 0 8px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.pplus-static .life-mark-copied {
|
||||
background: var(--tok-string);
|
||||
}
|
||||
|
||||
.pplus-static .life-mark-moved {
|
||||
background: var(--tok-number);
|
||||
}
|
||||
|
||||
.pplus-static .life-mark-moved-out {
|
||||
background: var(--ink-3);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.pplus-static .life-mark-named {
|
||||
background: var(--paper);
|
||||
border-color: var(--accent);
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
top: 6px;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.pplus-static .life-mark-destroyed {
|
||||
background: var(--err);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.pplus-static .life-cursor {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 2px;
|
||||
margin-left: -1px;
|
||||
background: var(--ink-2);
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.pplus-static .life-legend {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.pplus-static .cost-by-line {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.pplus-static .flow-node.flow-last .flow-shape {
|
||||
stroke: var(--accent);
|
||||
stroke-width: 2.4;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-unit {
|
||||
border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px 10px; margin-bottom: 10px; background: var(--paper-2);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-unit > summary {
|
||||
cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-sig {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-unit h5 {
|
||||
margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-checks {
|
||||
margin: 0; padding-left: 0; list-style: none; font-size: 13px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-checks li {
|
||||
padding-left: 1.4em; position: relative; margin: 2px 0;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-checks li::before {
|
||||
content: '✓'; position: absolute; left: 0; color: #2f8f5b; font-weight: 700;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-gens td,
|
||||
.pplus-static .fuzz-gens th {
|
||||
font-size: 12.5px; vertical-align: top;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-strats {
|
||||
margin: 6px 0 0; padding-left: 1.2em; font-size: 12.5px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-strats li {
|
||||
margin: 2px 0;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-fail {
|
||||
border: 1px solid color-mix(in srgb, #c0392b 40%, var(--line)); border-left: 3px solid #c0392b; border-radius: 6px; padding: 8px 10px; margin: 6px 0; background: var(--paper);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-fail-head {
|
||||
display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-msg {
|
||||
margin: 6px 0; font-size: 13px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-cov {
|
||||
display: flex; flex-direction: column; gap: 1px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-cov-bar {
|
||||
display: inline-block; height: 8px; background: var(--paper-3); border-radius: 4px; overflow: hidden;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-cov-bar > span {
|
||||
display: block; height: 100%; background: var(--accent);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-results {
|
||||
display: flex; flex-direction: column; gap: 2px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-result {
|
||||
display: grid; grid-template-columns: minmax(8ch, max-content) 120px 4em; gap: 8px; align-items: center; font-size: 12.5px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-filter {
|
||||
display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-cases-wrap {
|
||||
max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 6px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-cases {
|
||||
width: 100%; font-size: 12px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-cases thead th {
|
||||
position: sticky; top: 0; background: var(--paper); z-index: 1;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-out {
|
||||
font-size: 11px; padding: 0 6px; border-radius: 999px;
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-out-pass {
|
||||
color: #2f8f5b; background: color-mix(in srgb, #2f8f5b 12%, transparent);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-out-fail {
|
||||
color: #c0392b; background: color-mix(in srgb, #c0392b 12%, transparent);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-out-skip {
|
||||
color: var(--ink-2); background: var(--paper-3);
|
||||
}
|
||||
|
||||
.pplus-static .fuzz-new {
|
||||
color: var(--accent);
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
/* The Programming+ Quarto extension: the frames around every view, the rendered views' own parts (the run, the
|
||||
stepper, the translations), and lingo highlighting. Attached to every page that uses a shortcode, after
|
||||
pplus-views.css (the app's rules for what its views draw, generated). Colors come from the page (Bootstrap's
|
||||
variables) and from the app's tokens, which pplus-views.css defines on .pplus-static. */
|
||||
|
||||
/* ---------- the live frame ---------- */
|
||||
figure.pplus-embed,
|
||||
.pplus-figure {
|
||||
margin: 1.25rem 0 1.75rem;
|
||||
border: 1px solid color-mix(in srgb, var(--bs-body-color) 16%, transparent);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
background: var(--bs-body-bg);
|
||||
}
|
||||
figure.pplus-embed .pplus-frame {
|
||||
display: block;
|
||||
width: 100%;
|
||||
border: 0;
|
||||
background: var(--bs-body-bg);
|
||||
}
|
||||
figure.pplus-embed figcaption,
|
||||
.pplus-figure figcaption,
|
||||
.pplus-under figcaption {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: .5rem;
|
||||
align-items: center;
|
||||
padding: .4rem .8rem;
|
||||
font-size: .85rem;
|
||||
color: var(--bs-secondary-color, #6c757d);
|
||||
border-top: 1px solid color-mix(in srgb, var(--bs-body-color) 12%, transparent);
|
||||
background: color-mix(in srgb, var(--bs-body-bg) 97%, var(--bs-body-color));
|
||||
}
|
||||
.pplus-under figcaption { border: 0; background: none; padding: .1rem 0 0; }
|
||||
.pplus-under { margin: -.75rem 0 1.5rem; }
|
||||
figure .pplus-brand, .pplus-figure .pplus-brand, .pplus-under .pplus-brand { font-weight: 700; color: var(--bs-body-color); }
|
||||
figure .pplus-caption, .pplus-figure .pplus-caption, .pplus-under .pplus-caption { color: var(--bs-body-color); }
|
||||
figcaption a { text-decoration: none; }
|
||||
figcaption a:hover { text-decoration: underline; }
|
||||
.pplus-figcode { padding: .75rem .9rem 0; }
|
||||
.pplus-figcode div.sourceCode, .pplus-figcode pre { margin: 0 0 .25rem; }
|
||||
.pplus-figcode .math.display { display: block; margin: .25rem 0; }
|
||||
.pplus-figtitle {
|
||||
padding: .5rem .9rem;
|
||||
font-weight: 600;
|
||||
border-bottom: 1px solid color-mix(in srgb, var(--bs-body-color) 12%, transparent);
|
||||
}
|
||||
button.pplus-golive {
|
||||
font: inherit;
|
||||
font-weight: 600;
|
||||
color: var(--bs-link-color, #2f5bea);
|
||||
background: none;
|
||||
border: 1px solid currentColor;
|
||||
border-radius: 999px;
|
||||
padding: 0 .6rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
button.pplus-golive:hover { background: color-mix(in srgb, var(--bs-link-color, #2f5bea) 10%, transparent); }
|
||||
div.pplus-figure.is-live .pplus-frame { display: block; width: 100%; border: 0; }
|
||||
|
||||
details.pplus-details { margin: 1rem 0 1.5rem; border: 1px solid color-mix(in srgb, var(--bs-body-color) 18%, transparent); border-radius: 10px; padding: .4rem .9rem; }
|
||||
details.pplus-details > summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
|
||||
details.pplus-details[open] > summary { margin-bottom: .5rem; }
|
||||
details.pplus-details figure, details.pplus-details .pplus-figure { margin-top: .5rem; }
|
||||
a.pplus-link::before { content: "▸ "; }
|
||||
|
||||
/* ---------- a rendered view ---------- */
|
||||
.pplus-static {
|
||||
padding: .75rem .9rem;
|
||||
font-size: .9rem;
|
||||
line-height: 1.5;
|
||||
color: var(--ink);
|
||||
overflow-x: auto;
|
||||
}
|
||||
.pplus-static p { margin: .4rem 0; }
|
||||
.pplus-static pre { margin: 0; }
|
||||
.pplus-static code { color: inherit; background: none; padding: 0; }
|
||||
.pplus-static table { margin: 0; }
|
||||
.pplus-static details > summary { cursor: pointer; }
|
||||
.pplus-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .5rem; }
|
||||
.pplus-spacer { flex: 1; }
|
||||
.pplus-muted { color: var(--ink-3); }
|
||||
.pplus-small { font-size: .82em; }
|
||||
.pplus-who { font-size: .82em; }
|
||||
.pplus-call { font-family: var(--mono); font-size: .88em; }
|
||||
.pplus-chip {
|
||||
display: inline-block;
|
||||
font: 600 .72rem/1.6 var(--mono);
|
||||
padding: 0 .45rem;
|
||||
border-radius: 4px;
|
||||
color: var(--paper);
|
||||
background: var(--lang-pseudo, #2f5bea);
|
||||
text-transform: none;
|
||||
}
|
||||
.pplus-chip-lingo { background: var(--lang-lingo); }
|
||||
.pplus-chip-matho { background: var(--lang-matho); }
|
||||
.pplus-chip-pseudo { background: var(--lang-pseudo); }
|
||||
.pplus-chip-speco { background: var(--lang-speco); }
|
||||
.pplus-chip-mojo { background: var(--lang-mojo); }
|
||||
.pplus-chip-asm { background: var(--lang-asm); }
|
||||
.pplus-tag-generated {
|
||||
display: inline-block;
|
||||
font: 600 .7rem/1.6 var(--mono, monospace);
|
||||
padding: 0 .4rem;
|
||||
border-radius: 4px;
|
||||
color: var(--warn, #b5700d);
|
||||
background: var(--warn-bg, #fdf0d6);
|
||||
}
|
||||
.pplus-out {
|
||||
font-family: var(--mono);
|
||||
font-size: .85rem;
|
||||
white-space: pre-wrap;
|
||||
padding: .55rem .7rem;
|
||||
border-radius: 6px;
|
||||
background: var(--paper-2);
|
||||
border: 1px solid var(--line);
|
||||
min-height: 2.2em;
|
||||
}
|
||||
.pplus-err { color: var(--err); font-size: .85rem; }
|
||||
.pplus-note { color: var(--ink-2); font-size: .85rem; font-style: italic; }
|
||||
.pplus-expect { margin-top: .5rem; font-size: .85rem; }
|
||||
.pplus-expect.is-ok { color: var(--ok); }
|
||||
.pplus-expect.is-bad { color: var(--err); }
|
||||
.pplus-expect .pplus-out { margin-top: .3rem; color: var(--ink); }
|
||||
.pplus-ref { font-family: var(--mono); color: var(--accent); margin-right: .35rem; }
|
||||
.pplus-option { display: inline-block; font-size: .8rem; margin: .15rem .3rem 0 0; padding: 0 .4rem; border: 1px solid var(--line-2); border-radius: 4px; }
|
||||
.pplus-picked { font-weight: 600; }
|
||||
|
||||
/* a listing, as the editor highlights it */
|
||||
.pplus-code {
|
||||
font-family: var(--mono);
|
||||
font-size: .82rem;
|
||||
line-height: 1.55;
|
||||
padding: .5rem 0;
|
||||
margin: 0;
|
||||
background: var(--paper-2);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
overflow-x: auto;
|
||||
white-space: pre;
|
||||
}
|
||||
.pplus-ln { display: inline-block; min-width: 100%; padding: 0 .7rem 0 0; }
|
||||
.pplus-lno { display: inline-block; width: 2.6em; padding-right: .8em; text-align: right; color: var(--ink-3); user-select: none; }
|
||||
.pplus-code:not(:has(.pplus-lno)) .pplus-ln { padding-left: .7rem; }
|
||||
.pplus-ln.is-last { background: var(--last-bg); }
|
||||
.pplus-ln.is-next { background: var(--marker-bg); box-shadow: inset 3px 0 0 var(--marker); }
|
||||
|
||||
/* ---------- the stepper ---------- */
|
||||
.pplus-steps-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .6rem; }
|
||||
.pplus-btn {
|
||||
font: 600 .8rem/1 var(--sans, inherit);
|
||||
min-width: 2rem;
|
||||
padding: .35rem .5rem;
|
||||
color: var(--ink);
|
||||
background: var(--paper-2);
|
||||
border: 1px solid var(--line-2);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pplus-btn:hover { border-color: var(--accent); }
|
||||
.pplus-btn:disabled { opacity: .45; cursor: default; }
|
||||
.pplus-steps-slider { flex: 1 1 10rem; min-width: 8rem; accent-color: var(--accent); }
|
||||
.pplus-steps-count { font: .8rem var(--mono); color: var(--ink-2); min-width: 5.5em; text-align: right; }
|
||||
.pplus-steps-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(14rem, 2fr); gap: .8rem; align-items: start; }
|
||||
@media (max-width: 760px) { .pplus-steps-body { grid-template-columns: minmax(0, 1fr); } }
|
||||
.pplus-steps-code .pplus-code { max-height: 30rem; overflow: auto; position: relative; }
|
||||
.pplus-steps-now {
|
||||
font-size: .85rem;
|
||||
padding: .45rem .6rem;
|
||||
border-radius: 6px;
|
||||
background: var(--marker-bg);
|
||||
margin-bottom: .6rem;
|
||||
min-height: 2.6em;
|
||||
}
|
||||
.pplus-vars { width: 100%; border-collapse: collapse; font-size: .84rem; }
|
||||
.pplus-vars th, .pplus-vars td { padding: .25rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
|
||||
.pplus-vars th { font: 600 .82rem var(--mono); color: var(--ink-2); width: 1%; white-space: nowrap; }
|
||||
.pplus-vars td { font-family: var(--mono); word-break: break-word; }
|
||||
.pplus-vars tr.is-wrote td { color: var(--k-write, var(--accent)); font-weight: 600; background: color-mix(in srgb, var(--k-write, #2f5bea) 10%, transparent); }
|
||||
.pplus-steps-out-h { margin: .7rem 0 .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
|
||||
.pplus-steps-out { max-height: 9rem; overflow: auto; }
|
||||
|
||||
/* ---------- the machine (pplus-hw): the board's cards over an x86-64 run ---------- */
|
||||
.pplus-hw-now { font-size: .85rem; padding: .4rem .6rem; border-radius: 6px; background: var(--marker-bg); margin-bottom: .7rem; }
|
||||
.pplus-hw-now .pplus-hw-machine { font-size: .8rem; }
|
||||
.pplus-hw-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; align-items: start; }
|
||||
.pplus-hw-body.has-listing { grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr); }
|
||||
.pplus-hw-body > .pplus-hw-listing { position: sticky; top: 4.5rem; }
|
||||
@media (max-width: 760px) { .pplus-hw-body.has-listing { grid-template-columns: minmax(0, 1fr); } .pplus-hw-body > .pplus-hw-listing { position: static; } }
|
||||
/* the cards: side by side when there is room (a page-wide figure), one under another otherwise */
|
||||
.pplus-hw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: .75rem; align-items: start; }
|
||||
.pplus-hw-card { min-width: 0; }
|
||||
.pplus-hw-card.is-wide { grid-column: 1 / -1; }
|
||||
.pplus-hw-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 0 0 .3rem; }
|
||||
.pplus-hw-listing .pplus-code { max-height: 26rem; overflow: auto; position: relative; }
|
||||
.pplus-static .board-a86.a86 { margin: 0; overflow-x: auto; }
|
||||
.pplus-static .a86-panel { margin: 0; }
|
||||
|
||||
/* ---------- translations, as the app's panes ---------- */
|
||||
.pplus-translate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: .75rem; }
|
||||
.pplus-pane-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
|
||||
.pplus-tabs .pplus-tab-note { font-size: .82rem; color: var(--bs-secondary-color, #6c757d); margin-top: -.4rem; }
|
||||
.pplus-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1rem 0; }
|
||||
.pplus-columns .pplus-col > p:first-child { margin-bottom: .3rem; }
|
||||
|
||||
/* the app's views, on a page: their panels are not boxed in by a workspace */
|
||||
.pplus-static .viz-scroll { max-height: none; }
|
||||
.pplus-static .viz-scroll { overflow: auto; }
|
||||
.pplus-static .flow-svg { max-width: none; }
|
||||
.pplus-static .viz-head { margin-bottom: .5rem; }
|
||||
|
||||
/* A small translation table: pseudo on the left, the language on the right. */
|
||||
.translation-table table { width: 100%; }
|
||||
.translation-table td:first-child, .translation-table th:first-child { white-space: nowrap; }
|
||||
.translation-table code { white-space: pre; }
|
||||
|
||||
/* lingo: the controlled English of Programming+. The colors fall back to the same roles the
|
||||
course's pseudo.css uses, so a site that has that stylesheet gets one family; any other site gets
|
||||
the fallbacks. */
|
||||
.sourceCode.lingo .cf { color: var(--pseudo-flow, #9a2f4e); font-weight: 700; }
|
||||
.sourceCode.lingo .kw { color: var(--pseudo-decl, #2f5d8c); font-weight: 600; }
|
||||
.sourceCode.lingo .dt { color: var(--pseudo-type, #1f6f63); }
|
||||
.sourceCode.lingo .fu { color: var(--pseudo-decl, #2f5d8c); font-weight: 700; }
|
||||
.sourceCode.lingo .va { color: var(--pseudo-builtin, #5a4a8c); }
|
||||
.sourceCode.lingo .op { color: var(--pseudo-keyword, #4a5568); }
|
||||
.sourceCode.lingo .st, .sourceCode.lingo .ch, .sourceCode.lingo .dv { color: var(--pseudo-lit, #2f6f3f); }
|
||||
.sourceCode.lingo .co { color: var(--pseudo-comment, #6f7680); font-style: italic; }
|
||||
|
||||
@media print {
|
||||
.pplus-steps-bar, button.pplus-golive { display: none; }
|
||||
.pplus-steps-code .pplus-code { max-height: none; }
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
// pplus.js: the page side of the Programming+ shortcodes. No dependencies; safe to load twice.
|
||||
//
|
||||
// Steppers a rendered pplus-steps view carries its run as JSON (<script class="pplus-steps-data">); this
|
||||
// moves through it: the line that runs next, the values after each step, what was printed.
|
||||
// Machine a rendered pplus-hw board carries every step's drawing of each card (compressed); this shows them.
|
||||
// Make it live a rendered view's "make it live" button puts the live view (an <iframe> of the app) in its place.
|
||||
// Live frames two messages cross the iframe boundary and nothing else:
|
||||
// pplus:height (frame -> page) height="auto" frames grow to fit what they show.
|
||||
// pplus:theme (page -> frame) the frame follows the site's light/dark switch.
|
||||
//
|
||||
// The app's "With Quarto" gallery loads this same file and calls PPlus.wire(element) on what it draws.
|
||||
(function () {
|
||||
if (typeof window === 'undefined' || window.PPlus) return;
|
||||
|
||||
/* ---------- steppers ---------- */
|
||||
|
||||
function text(node, s) { node.textContent = s; }
|
||||
|
||||
function wireStepper(root) {
|
||||
if (root.__pplus) return;
|
||||
var holder = root.querySelector('script.pplus-steps-data');
|
||||
if (!holder) return;
|
||||
var data;
|
||||
try { data = JSON.parse(holder.textContent); } catch (e) { return; }
|
||||
root.__pplus = true;
|
||||
var lines = root.querySelectorAll('.pplus-ln');
|
||||
var byLine = {};
|
||||
for (var i = 0; i < lines.length; i++) byLine[lines[i].getAttribute('data-line')] = lines[i];
|
||||
var slider = root.querySelector('.pplus-steps-slider');
|
||||
var count = root.querySelector('.pplus-steps-count');
|
||||
var now = root.querySelector('.pplus-steps-now');
|
||||
var out = root.querySelector('.pplus-steps-out');
|
||||
var cells = root.querySelectorAll('.pplus-vars td[data-col]');
|
||||
var rows = root.querySelectorAll('.pplus-vars tr');
|
||||
var code = root.querySelector('.pplus-steps-code .pplus-code');
|
||||
var buttons = root.querySelectorAll('[data-go]');
|
||||
var t = Math.max(0, Math.min(data.t || 0, data.count));
|
||||
var timer = null;
|
||||
|
||||
function mark(cls, line) {
|
||||
var old = root.querySelectorAll('.pplus-ln.' + cls);
|
||||
for (var k = 0; k < old.length; k++) old[k].classList.remove(cls);
|
||||
var el = line != null ? byLine[String(line)] : null;
|
||||
if (el) el.classList.add(cls);
|
||||
return el;
|
||||
}
|
||||
|
||||
function show() {
|
||||
var last = t > 0 ? data.rows[t - 1] : null;
|
||||
var next = t < data.count ? data.rows[t] : null;
|
||||
mark('is-last', last ? last.l : null);
|
||||
var cur = mark('is-next', next ? next.l : null);
|
||||
// keep the line in view inside the listing, without moving the page
|
||||
if (cur && code) {
|
||||
var top = cur.offsetTop, h = cur.offsetHeight;
|
||||
if (top < code.scrollTop || top + h > code.scrollTop + code.clientHeight) code.scrollTop = Math.max(0, top - code.clientHeight / 3);
|
||||
}
|
||||
var vals = last ? last.c : data.c0;
|
||||
var wrote = last ? last.cw : [];
|
||||
for (var c = 0; c < cells.length; c++) {
|
||||
var v = vals[c];
|
||||
text(cells[c], v == null ? '—' : v);
|
||||
rows[c] && rows[c].classList.toggle('is-wrote', wrote.indexOf(c) >= 0);
|
||||
}
|
||||
text(now, t === 0 ? (data.count ? 'Before the first step.' : 'The program takes no steps.')
|
||||
: 'Step ' + t + ': ' + last.x + (last.w.length ? ' — writes ' + last.w.join(', ') : ''));
|
||||
var printed = [];
|
||||
for (var r = 0; r < t; r++) printed.push.apply(printed, data.rows[r].o);
|
||||
if (out) { text(out, printed.join('\n')); out.scrollTop = out.scrollHeight; }
|
||||
if (slider) slider.value = String(t);
|
||||
if (count) text(count, t + ' / ' + data.count);
|
||||
root.setAttribute('data-t', String(t));
|
||||
for (var b = 0; b < buttons.length; b++) {
|
||||
var go = buttons[b].getAttribute('data-go');
|
||||
if (go === 'first' || go === 'back') buttons[b].disabled = t === 0;
|
||||
if (go === 'next' || go === 'last') buttons[b].disabled = t >= data.count;
|
||||
}
|
||||
}
|
||||
function goto(n) { t = Math.max(0, Math.min(n, data.count)); show(); }
|
||||
function stop() { if (timer) { clearInterval(timer); timer = null; } var p = root.querySelector('[data-go="play"]'); if (p) text(p, 'Play'); }
|
||||
function play() {
|
||||
if (t >= data.count) t = 0;
|
||||
var p = root.querySelector('[data-go="play"]');
|
||||
if (p) text(p, 'Pause');
|
||||
timer = setInterval(function () { if (t >= data.count) return stop(); goto(t + 1); }, 450);
|
||||
}
|
||||
for (var b = 0; b < buttons.length; b++) {
|
||||
buttons[b].addEventListener('click', function (ev) {
|
||||
var go = ev.currentTarget.getAttribute('data-go');
|
||||
if (go !== 'play') stop();
|
||||
if (go === 'first') goto(0);
|
||||
else if (go === 'back') goto(t - 1);
|
||||
else if (go === 'next') goto(t + 1);
|
||||
else if (go === 'last') goto(data.count);
|
||||
else if (go === 'play') { if (timer) stop(); else play(); }
|
||||
});
|
||||
}
|
||||
if (slider) slider.addEventListener('input', function () { stop(); goto(Number(slider.value)); });
|
||||
root.setAttribute('tabindex', root.getAttribute('tabindex') || '0');
|
||||
root.addEventListener('keydown', function (ev) {
|
||||
if (ev.target && ev.target.tagName === 'INPUT') return;
|
||||
if (ev.key === 'ArrowRight') { stop(); goto(t + 1); ev.preventDefault(); }
|
||||
else if (ev.key === 'ArrowLeft') { stop(); goto(t - 1); ev.preventDefault(); }
|
||||
else if (ev.key === 'Home') { stop(); goto(0); ev.preventDefault(); }
|
||||
else if (ev.key === 'End') { stop(); goto(data.count); ev.preventDefault(); }
|
||||
});
|
||||
show();
|
||||
}
|
||||
|
||||
/* ---------- the machine (pplus-hw) ---------- */
|
||||
|
||||
// A machine board's cards, drawn at render time at every step: each card's distinct drawings, and which one each
|
||||
// step shows. Compressed by render.mjs (deflate, base64); the app's gallery hands them over as plain JSON.
|
||||
function readHwData(holder) {
|
||||
var text = holder.textContent || '';
|
||||
if (holder.getAttribute('type') !== 'application/x-pplus-deflate') return Promise.resolve(JSON.parse(text));
|
||||
if (typeof DecompressionStream === 'undefined') return Promise.reject(new Error('this browser cannot decompress the run'));
|
||||
var bin = atob(text), bytes = new Uint8Array(bin.length);
|
||||
for (var i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
||||
var stream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('deflate-raw'));
|
||||
return new Response(stream).text().then(JSON.parse);
|
||||
}
|
||||
|
||||
function wireHw(root) {
|
||||
if (root.__pplus) return;
|
||||
var holder = root.querySelector('script.pplus-hw-data');
|
||||
if (!holder) return;
|
||||
root.__pplus = true;
|
||||
readHwData(holder).then(function (data) {
|
||||
var lines = root.querySelectorAll('.pplus-hw-listing .pplus-ln');
|
||||
var byLine = {};
|
||||
for (var i = 0; i < lines.length; i++) byLine[lines[i].getAttribute('data-line')] = lines[i];
|
||||
var hosts = {};
|
||||
var cardEls = root.querySelectorAll('[data-hw]');
|
||||
for (var c = 0; c < cardEls.length; c++) hosts[cardEls[c].getAttribute('data-hw')] = cardEls[c].querySelector('[data-hw-frame]');
|
||||
var slider = root.querySelector('.pplus-steps-slider');
|
||||
var count = root.querySelector('.pplus-steps-count');
|
||||
var now = root.querySelector('.pplus-hw-now');
|
||||
var nowText = now && now.firstChild && now.firstChild.nodeType === 3 ? now.firstChild : null;
|
||||
var code = root.querySelector('.pplus-hw-listing .pplus-code');
|
||||
var buttons = root.querySelectorAll('[data-go]');
|
||||
var last = data.shown.length - 1;
|
||||
var k = Math.max(0, data.shown.indexOf(data.t));
|
||||
var shownFrame = {};
|
||||
var timer = null;
|
||||
function mark(cls, line) {
|
||||
var old = root.querySelectorAll('.pplus-hw-listing .pplus-ln.' + cls);
|
||||
for (var j = 0; j < old.length; j++) old[j].classList.remove(cls);
|
||||
var e = line != null ? byLine[String(line)] : null;
|
||||
if (e) e.classList.add(cls);
|
||||
return e;
|
||||
}
|
||||
function show() {
|
||||
var t = data.shown[k], s = data.steps[k];
|
||||
mark('is-last', s.l);
|
||||
var cur = mark('is-next', s.n);
|
||||
if (cur && code) {
|
||||
var top = cur.offsetTop, h = cur.offsetHeight;
|
||||
if (top < code.scrollTop || top + h > code.scrollTop + code.clientHeight) code.scrollTop = Math.max(0, top - code.clientHeight / 3);
|
||||
}
|
||||
for (var j = 0; j < data.cards.length; j++) {
|
||||
var card = data.cards[j], host = hosts[card.id];
|
||||
if (!host) continue;
|
||||
var f = card.at[k];
|
||||
if (shownFrame[card.id] === f) continue;
|
||||
shownFrame[card.id] = f;
|
||||
host.innerHTML = card.frames[f];
|
||||
// a card keeps the tallest height it has reached, so the cards under it stay put while stepping
|
||||
var hgt = host.offsetHeight;
|
||||
if (hgt > (parseFloat(host.style.minHeight) || 0)) host.style.minHeight = hgt + 'px';
|
||||
}
|
||||
if (nowText) nowText.textContent = t === 0 ? 'Before the first instruction.' : 'Step ' + t + ': ' + s.x;
|
||||
if (slider) slider.value = String(k);
|
||||
if (count) text(count, t + ' / ' + data.count);
|
||||
root.setAttribute('data-t', String(t));
|
||||
for (var b = 0; b < buttons.length; b++) {
|
||||
var go = buttons[b].getAttribute('data-go');
|
||||
if (go === 'first' || go === 'back') buttons[b].disabled = k === 0;
|
||||
if (go === 'next' || go === 'last') buttons[b].disabled = k >= last;
|
||||
}
|
||||
}
|
||||
function goto(n) { k = Math.max(0, Math.min(n, last)); show(); }
|
||||
function stop() { if (timer) { clearInterval(timer); timer = null; } var p = root.querySelector('[data-go="play"]'); if (p) text(p, 'Play'); }
|
||||
function play() {
|
||||
if (k >= last) k = 0;
|
||||
var p = root.querySelector('[data-go="play"]');
|
||||
if (p) text(p, 'Pause');
|
||||
timer = setInterval(function () { if (k >= last) return stop(); goto(k + 1); }, 450);
|
||||
}
|
||||
for (var b = 0; b < buttons.length; b++) {
|
||||
buttons[b].addEventListener('click', function (ev) {
|
||||
var go = ev.currentTarget.getAttribute('data-go');
|
||||
if (go !== 'play') stop();
|
||||
if (go === 'first') goto(0);
|
||||
else if (go === 'back') goto(k - 1);
|
||||
else if (go === 'next') goto(k + 1);
|
||||
else if (go === 'last') goto(last);
|
||||
else if (go === 'play') { if (timer) stop(); else play(); }
|
||||
});
|
||||
}
|
||||
if (slider) slider.addEventListener('input', function () { stop(); goto(Number(slider.value)); });
|
||||
root.setAttribute('tabindex', root.getAttribute('tabindex') || '0');
|
||||
root.addEventListener('keydown', function (ev) {
|
||||
if (ev.target && ev.target.tagName === 'INPUT') return;
|
||||
if (ev.key === 'ArrowRight') { stop(); goto(k + 1); ev.preventDefault(); }
|
||||
else if (ev.key === 'ArrowLeft') { stop(); goto(k - 1); ev.preventDefault(); }
|
||||
else if (ev.key === 'Home') { stop(); goto(0); ev.preventDefault(); }
|
||||
else if (ev.key === 'End') { stop(); goto(last); ev.preventDefault(); }
|
||||
});
|
||||
// the frame in the markup is the step the page opened on; mark it shown, and hold every card's height
|
||||
for (var j = 0; j < data.cards.length; j++) shownFrame[data.cards[j].id] = data.cards[j].at[k];
|
||||
show();
|
||||
}).catch(function (e) {
|
||||
var bar = root.querySelector('.pplus-steps-bar');
|
||||
if (bar) bar.replaceWith(Object.assign(document.createElement('p'), { className: 'pplus-note', textContent: 'This page shows one step of the run: ' + e.message + '.' }));
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- make it live ---------- */
|
||||
|
||||
function wireLive(btn) {
|
||||
if (btn.__pplus) return;
|
||||
btn.__pplus = true;
|
||||
btn.addEventListener('click', function () {
|
||||
var fig = btn.closest('.pplus-figure');
|
||||
if (!fig) return;
|
||||
var frame = document.createElement('iframe');
|
||||
frame.className = 'pplus-frame';
|
||||
frame.src = btn.getAttribute('data-src');
|
||||
frame.height = btn.getAttribute('data-height') || '520';
|
||||
frame.title = 'Programming+';
|
||||
frame.setAttribute('allow', 'clipboard-write');
|
||||
var view = fig.querySelector('.pplus-static');
|
||||
if (view) view.replaceWith(frame); else fig.insertBefore(frame, fig.firstChild);
|
||||
var code = fig.querySelector('.pplus-figcode');
|
||||
if (code) code.remove(); // the live view has the code in it
|
||||
fig.classList.add('is-live');
|
||||
btn.remove();
|
||||
send(frame);
|
||||
});
|
||||
}
|
||||
|
||||
function wire(root) {
|
||||
root = root || document;
|
||||
var steppers = root.querySelectorAll ? root.querySelectorAll('.pplus-v-steps') : [];
|
||||
for (var i = 0; i < steppers.length; i++) wireStepper(steppers[i]);
|
||||
if (root.classList && root.classList.contains('pplus-v-steps')) wireStepper(root);
|
||||
var boards = root.querySelectorAll ? root.querySelectorAll('.pplus-v-hw') : [];
|
||||
for (var h = 0; h < boards.length; h++) wireHw(boards[h]);
|
||||
if (root.classList && root.classList.contains('pplus-v-hw')) wireHw(root);
|
||||
var live = root.querySelectorAll ? root.querySelectorAll('button.pplus-golive') : [];
|
||||
for (var j = 0; j < live.length; j++) wireLive(live[j]);
|
||||
}
|
||||
|
||||
/* ---------- live frames ---------- */
|
||||
|
||||
// Quarto marks the page quarto-dark or quarto-light (and moves between them when the reader uses
|
||||
// the toggle). A site with a single theme has neither, and the frames keep their own default.
|
||||
function siteTheme() {
|
||||
var b = document.body, de = document.documentElement;
|
||||
if (b.classList.contains('quarto-dark')) return 'dark';
|
||||
if (b.classList.contains('quarto-light')) return 'light';
|
||||
var bs = b.getAttribute('data-bs-theme') || de.getAttribute('data-bs-theme');
|
||||
return bs === 'dark' || bs === 'light' ? bs : null;
|
||||
}
|
||||
|
||||
function send(frame) {
|
||||
var theme = siteTheme();
|
||||
if (theme && frame.contentWindow) frame.contentWindow.postMessage({ type: 'pplus:theme', theme: theme }, '*');
|
||||
}
|
||||
|
||||
function sendAll() {
|
||||
var frames = document.querySelectorAll('iframe.pplus-frame');
|
||||
for (var i = 0; i < frames.length; i++) send(frames[i]);
|
||||
}
|
||||
|
||||
window.addEventListener('message', function (ev) {
|
||||
var d = ev.data;
|
||||
if (!d) return;
|
||||
var frames = document.querySelectorAll('iframe.pplus-frame');
|
||||
for (var i = 0; i < frames.length; i++) {
|
||||
if (frames[i].contentWindow !== ev.source) continue;
|
||||
if (d.type === 'pplus:height' && typeof d.height === 'number' && frames[i].hasAttribute('data-pplus-auto')) {
|
||||
frames[i].style.height = Math.max(120, Math.ceil(d.height) + 2) + 'px';
|
||||
} else if (d.type === 'pplus:ready') {
|
||||
send(frames[i]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// The toggle changes a class on <body> (or an attribute on <html>/<body>); tell every frame.
|
||||
function start() {
|
||||
var obs = new MutationObserver(sendAll);
|
||||
obs.observe(document.body, { attributes: true, attributeFilter: ['class', 'data-bs-theme'] });
|
||||
obs.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-bs-theme'] });
|
||||
sendAll();
|
||||
wire(document);
|
||||
}
|
||||
|
||||
window.PPlus = { wire: wire };
|
||||
if (document.body) start(); else document.addEventListener('DOMContentLoaded', start);
|
||||
})();
|
||||
@@ -0,0 +1,781 @@
|
||||
-- pplus.lua: the shortcodes of the Programming+ Quarto extension. See README.md beside _extensions/.
|
||||
--
|
||||
-- Two kinds of shortcode, over the same program files beside the page (count.pseudo, count.lingo, mean.tex,
|
||||
-- spec.speco, demo.mojo, demo.asm):
|
||||
--
|
||||
-- Rendered with the page. The program runs while Quarto renders, through the app's own engines and views
|
||||
-- (render.mjs, with a built Programming+), and the result is part of the page: no iframe, no network, and it
|
||||
-- prints. A run that does not print its EXPECT lines is reported as the page renders.
|
||||
-- pplus-run what it prints and returns, checked against its EXPECT lines
|
||||
-- pplus-steps the listing with a stepper: every step, its line, the values after it
|
||||
-- pplus-table the table of values
|
||||
-- pplus-flow the flowchart, shaded by how often each line ran
|
||||
-- pplus-dataflow the data-flow graph
|
||||
-- pplus-lifetimes each Mojo value made, copied, moved and destroyed
|
||||
-- pplus-proof every claim of the specification: proved, broken or open
|
||||
-- pplus-tests the fuzzer's report, every routine
|
||||
-- pplus-check what the checker says about each file
|
||||
-- pplus-translate the procedure in every notation, Mojo generated from the pseudo
|
||||
-- pplus-machine the x86-64 run on the model machine: cycles, misses, branches
|
||||
-- pplus-view any of these by name: view="flow"
|
||||
--
|
||||
-- The machine, rendered with the page: the Hardware area's board over an x86-64 file (asm=, setup=), the course's
|
||||
-- own views drawn at every step of the run, with a stepper that moves through them.
|
||||
-- pplus-hw the board: preset="regs" (default) | "caches" | "pipeline" | "chip", or views="registers,cache"
|
||||
-- pplus-hw-<view> one view: code, explain, registers, flags, address, memory, stack, dataflow, alu, branches,
|
||||
-- vectors, lines (cache lines), cache, hierarchy, paging (virtual memory, switched on), pipeline,
|
||||
-- uops, timeline, bottleneck, counters, chip (the whole core), core (out of order), encoding
|
||||
--
|
||||
-- Live. An <iframe> of the app (pplus.scient.ing by default), with the program in its URL: the reader edits,
|
||||
-- steps and runs it on the page.
|
||||
-- pplus-playground the whole playground
|
||||
-- pplus-embed one view of it: view="trace" (and every view= of the original {{< pplus >}})
|
||||
-- pplus the original shortcode: a live embed, a listing, or both (show=)
|
||||
--
|
||||
-- And plain:
|
||||
-- pplus-listing the files as highlighted listings (matho typeset as equations)
|
||||
-- pplus-tabs the files as a tabset, one tab per notation
|
||||
-- pplus-link a link that opens the program in the app
|
||||
--
|
||||
-- Every rendered view also takes live="click": a button under it puts the live view in its place.
|
||||
--
|
||||
-- Options shared by all
|
||||
-- lingo, matho, pseudo, speco, mojo, asm files next to the page whose text fills that pane
|
||||
-- setup a file next to the page holding the x86-64 pane's setup block (registers, memory)
|
||||
-- lang the pane that runs (default: the first of lingo, matho, pseudo, mojo, asm given)
|
||||
-- call the call to run (default: the file's own `// CALL:` line, else the engine's choice)
|
||||
-- input lines INPUT reads, separated by | (default: the file's `// INPUT:` lines)
|
||||
-- machine the x86-64 machine model preset
|
||||
-- t the step the stepper starts on (or is parked at, live)
|
||||
-- title a title over the view (and the iframe's title, for accessibility)
|
||||
-- caption a sentence under the view, before the Programming+ links
|
||||
-- collapse 1 folds it into a <details> block titled with `title` (or "Show the program")
|
||||
-- area bridge (default), dev or hw: the area the "open in Programming+" link (and the live playground) opens in
|
||||
--
|
||||
-- Options of the rendered views
|
||||
-- code 1 prints the program's listing above the view (run, table, flow, dataflow, proof, tests)
|
||||
-- numbers 1 numbers the lines of a listing
|
||||
-- follow steps, table: the variables to show, comma-separated (default: those of the routine that does the most work)
|
||||
-- max steps: the most steps kept (default 400)
|
||||
-- to translate: the notations to show, comma-separated (lingo,matho,pseudo,speco,mojo)
|
||||
-- layout translate: tabs (default) | columns | grid (the app's own panes side by side)
|
||||
-- compiler run, for a Mojo file: auto (default: the real `mojo` when one is on the PATH) | on (it must be) | off
|
||||
-- preset, views pplus-hw: the board's arrangement, or the views (comma-separated) to show
|
||||
-- listing pplus-hw: 0 leaves out the x86-64 listing beside the cards
|
||||
-- column body | page | screen | ...: Quarto's column for the figure (pplus-hw's board is page-wide by default)
|
||||
-- stepper pplus-hw: 0 draws only step t (no stepper); max: the most steps drawn (a longer run is sampled)
|
||||
-- live click: a button that puts the live view in place of the rendered one
|
||||
-- height the live frame's height in px when live="click" is pressed (default 520)
|
||||
--
|
||||
-- Options of the live views: see `live_embed` below (view, panel, build, dock, docktab, editor, side, dockheight,
|
||||
-- theme, ro, showcall, split, height, mode, text, show, state, problem).
|
||||
--
|
||||
-- Project metadata (_quarto.yml or the page's front matter)
|
||||
-- pplus-url where the live views point (default https://pplus.scient.ing)
|
||||
-- pplus-engine a built Programming+ (its folder, or its dist/) for the rendered views; see README.md for where it is
|
||||
-- looked for. none: render nothing with the page (each rendered view shows its listing and the live view)
|
||||
-- pplus-node the node to run it with (default: node on the PATH)
|
||||
-- pplus-strict true: a rendered view that fails (a run that does not print its EXPECT lines, a program that does not run) stops the render
|
||||
-- pplus-cache false: render every view again each time (by default results are kept in .quarto/pplus/)
|
||||
|
||||
local str = pandoc.utils.stringify
|
||||
|
||||
local function esc(s)
|
||||
s = tostring(s or "")
|
||||
s = s:gsub("&", "&"):gsub("<", "<"):gsub(">", ">"):gsub('"', """)
|
||||
return s
|
||||
end
|
||||
|
||||
local function warn(msg) io.stderr:write("pplus: " .. msg .. "\n") end
|
||||
|
||||
local function raw(html) return pandoc.RawBlock("html", html) end
|
||||
|
||||
local function is_html() return quarto.doc.is_format("html") end
|
||||
|
||||
-- A shortcode argument cannot hold a literal double quote inside double quotes, so " stands for one.
|
||||
local function kwarg(kwargs, name)
|
||||
local v = kwargs[name]
|
||||
if v == nil then return nil end
|
||||
local s = str(v):gsub(""", '"')
|
||||
return s ~= "" and s or nil
|
||||
end
|
||||
|
||||
local function meta_str(meta, name)
|
||||
local v = meta and meta[name]
|
||||
if v == nil then return nil end
|
||||
local s = str(v)
|
||||
return s ~= "" and s or nil
|
||||
end
|
||||
|
||||
local function meta_bool(meta, name, default)
|
||||
local v = meta and meta[name]
|
||||
if v == nil then return default end
|
||||
if type(v) == "boolean" then return v end
|
||||
local s = str(v)
|
||||
if s == "true" or s == "1" or s == "yes" then return true end
|
||||
if s == "false" or s == "0" or s == "no" then return false end
|
||||
return default
|
||||
end
|
||||
|
||||
-- Absolute path of the file being rendered, with forward slashes.
|
||||
local function input_path()
|
||||
local f = quarto and quarto.doc and quarto.doc.input_file or ""
|
||||
return (tostring(f):gsub("\\", "/"))
|
||||
end
|
||||
|
||||
local function page_dir() return input_path():match("^(.*)/[^/]*$") or "." end
|
||||
|
||||
-- This file's folder: the extension, where render.mjs and the stylesheets are.
|
||||
local EXT_DIR = (function()
|
||||
local src = debug.getinfo(1, "S").source or ""
|
||||
src = src:gsub("^@", ""):gsub("\\", "/")
|
||||
return src:match("^(.*)/[^/]*$") or "."
|
||||
end)()
|
||||
|
||||
local function exists(path)
|
||||
local f = io.open(path, "r")
|
||||
if f then f:close() return true end
|
||||
return false
|
||||
end
|
||||
|
||||
-- The extension's stylesheets and script, attached once per page that uses a shortcode.
|
||||
local deps_added = false
|
||||
local function ensure_deps()
|
||||
if deps_added or not is_html() then return end
|
||||
deps_added = true
|
||||
quarto.doc.add_html_dependency({ name = "pplus", version = "2.1.0", stylesheets = { "pplus-views.css", "pplus.css" }, scripts = { "pplus.js" } })
|
||||
end
|
||||
|
||||
-- The machine views' stylesheets: the course's own (course/, written for Quarto pages) and the board's adjustments
|
||||
-- to them; attached only to a page that shows the machine.
|
||||
local hw_deps_added = false
|
||||
local function ensure_hw_deps()
|
||||
if hw_deps_added or not is_html() then return end
|
||||
hw_deps_added = true
|
||||
quarto.doc.add_html_dependency({ name = "pplus-hw", version = "2.1.0", stylesheets = { "course/tokens.css", "course/kit.css", "course/asm86.css", "pplus-hw.css" } })
|
||||
end
|
||||
|
||||
local PPLUS_DEFAULT_URL = "https://pplus.scient.ing"
|
||||
|
||||
local function pplus_url(meta)
|
||||
return ((meta_str(meta, "pplus-url") or PPLUS_DEFAULT_URL):gsub("/+$", ""))
|
||||
end
|
||||
|
||||
local function read_beside_page(name)
|
||||
local f = io.open(page_dir() .. "/" .. name, "r")
|
||||
if not f then return nil end
|
||||
local s = f:read("a"); f:close()
|
||||
return (s:gsub("\n+$", ""))
|
||||
end
|
||||
|
||||
local function base64url(s)
|
||||
local b = quarto.base64.encode(s)
|
||||
return (b:gsub("%+", "-"):gsub("/", "_"):gsub("=+$", ""))
|
||||
end
|
||||
|
||||
local function json_encode(v) return quarto.json.encode(v) end
|
||||
local function json_decode(s)
|
||||
if quarto.json and quarto.json.decode then return quarto.json.decode(s) end
|
||||
return pandoc.json.decode(s, false)
|
||||
end
|
||||
|
||||
-- The call and input lines a program file carries for scripts/check-pages.mjs (// CALL: ..., // INPUT: ...),
|
||||
-- so the embed runs exactly what the checker verified.
|
||||
local function header_of(text)
|
||||
local h = { input = {} }
|
||||
for line in (text .. "\n"):gmatch("(.-)\n") do
|
||||
local call = line:match("^%s*//%s*CALL:%s*(.-)%s*$") or line:match("^%s*%%%s*CALL:%s*(.-)%s*$") or line:match("^%s*#%s*CALL:%s*(.-)%s*$")
|
||||
if call then h.call = call end
|
||||
local inp = line:match("^%s*//%s*INPUT:%s?(.*)$") or line:match("^%s*%%%s*INPUT:%s?(.*)$") or line:match("^%s*#%s*INPUT:%s?(.*)$")
|
||||
if inp then h.input[#h.input + 1] = inp end
|
||||
end
|
||||
return h
|
||||
end
|
||||
|
||||
-- The file as a page shows it: the checker's header lines (// CALL:, // EXPECT:, ...) removed. A Mojo
|
||||
-- file's header is its leading block of `# key: value` comments (mojo/local/'s origin, probe, mode, args,
|
||||
-- expect...; check-pages' EXPECT), so only that block goes: a `# note:` further down is the program's.
|
||||
-- (src/quarto/program.ts listingText does the same for the rendered views; tests/quarto.test.mjs holds them together.)
|
||||
local function listing_text(text, pane)
|
||||
local out = {}
|
||||
local head = pane == "mojo"
|
||||
for line in (text .. "\n"):gmatch("(.-)\n") do
|
||||
if head then
|
||||
if line:match("^#%s*[%w%-]+:") then goto continue end
|
||||
if line:match("^%s*$") and #out == 0 then goto continue end
|
||||
head = false
|
||||
end
|
||||
if pane ~= "mojo" and (line:match("^%s*//%s*[A-Z]+:") or line:match("^%s*%%%s*[A-Z]+:")) then goto continue end
|
||||
out[#out + 1] = line
|
||||
::continue::
|
||||
end
|
||||
local s = table.concat(out, "\n")
|
||||
return (s:gsub("^\n+", ""):gsub("\n+$", ""))
|
||||
end
|
||||
|
||||
-- A LaTeX file as display mathematics: one block per equation, where an equation continues while a
|
||||
-- brace or \begin{cases} is open or the next line starts with an operator.
|
||||
local function math_blocks(text)
|
||||
local eqs, cur, depth, cases = {}, nil, 0, 0
|
||||
local function flush() if cur and cur:match("%S") then eqs[#eqs + 1] = cur end cur = nil end
|
||||
for raw_line in (text .. "\n"):gmatch("(.-)\n") do
|
||||
local line = raw_line:gsub("%%.*$", "")
|
||||
if not line:match("%S") then
|
||||
if depth <= 0 and cases <= 0 then flush() end
|
||||
else
|
||||
local continues = depth > 0 or cases > 0 or line:match("^%s*[=+%-&]") or line:match("^%s*\\cdot") or (cur and cur:match("[=+%-{]%s*$"))
|
||||
if not continues then flush() end
|
||||
cur = cur and (cur .. "\n" .. line) or line
|
||||
for ch in line:gmatch("[{}]") do depth = depth + (ch == "{" and 1 or -1) end
|
||||
for _ in line:gmatch("\\begin{cases}") do cases = cases + 1 end
|
||||
for _ in line:gmatch("\\end{cases}") do cases = cases - 1 end
|
||||
end
|
||||
end
|
||||
flush()
|
||||
local blocks = pandoc.Blocks({})
|
||||
for _, eq in ipairs(eqs) do
|
||||
blocks:insert(pandoc.Para({ pandoc.Math("DisplayMath", (eq:gsub("%s*\\\\%s*$", ""))) }))
|
||||
end
|
||||
return blocks
|
||||
end
|
||||
|
||||
local function split_on(s, sep)
|
||||
local out = {}
|
||||
for piece in (s .. sep):gmatch("(.-)" .. sep:gsub("%p", "%%%0")) do out[#out + 1] = piece end
|
||||
return out
|
||||
end
|
||||
local function split_bar(s) return split_on(s, "|") end
|
||||
local function split_list(s)
|
||||
local out = {}
|
||||
for piece in s:gmatch("[^,%s]+") do out[#out + 1] = piece end
|
||||
return out
|
||||
end
|
||||
|
||||
local PANES = { "lingo", "matho", "pseudo", "speco", "mojo", "asm" }
|
||||
local PANE_LABEL = { lingo = "lingo", matho = "matho", pseudo = "pseudo", speco = "speco", mojo = "Mojo", asm = "x86-64" }
|
||||
local function set_of(list) local t = {} for _, k in ipairs(list) do t[k] = true end return t end
|
||||
-- what view= can show (src/core/state.ts EMBED_VIEWS) and what the state's own view (the open tab) can be
|
||||
local VIEWS = set_of({ "playground", "trace", "table", "flow", "data", "life", "problems", "proof", "tests", "compiler", "asm", "lingo", "matho", "pseudo", "speco", "mojo" })
|
||||
local TABS = set_of({ "trace", "table", "flow", "data", "life", "problems", "proof", "tests", "compiler", "asm" })
|
||||
local DOCK_TABS = set_of({ "setup", "output", "problems", "compiler", "asm" })
|
||||
-- the options that arrange the example; the app reads them from the embed's query (applyEmbedParams)
|
||||
local ARRANGE = { "area", "lang", "panel", "build", "machine", "dock", "docktab", "editor", "side", "dockheight", "theme" }
|
||||
-- the rendered views (src/quarto/render.ts STATIC_VIEWS), and the live view each one opens as
|
||||
local STATIC = { run = "trace", steps = "trace", table = "table", flow = "flow", data = "data", life = "life", proof = "proof", tests = "tests", check = "problems", translate = "playground", machine = "asm", hw = "playground" }
|
||||
-- the machine's views, as pplus-hw-<name> names them (src/quarto/machine.ts HW_NAMES)
|
||||
local HW_VIEWS = { "code", "explain", "registers", "flags", "address", "memory", "stack", "dataflow", "alu", "branches", "vectors",
|
||||
"lines", "cache", "hierarchy", "paging", "pipeline", "uops", "timeline", "bottleneck", "counters", "chip", "core", "encoding" }
|
||||
|
||||
local function urlencode(v)
|
||||
return (tostring(v):gsub("[^%w%-%._~,]", function(c) return string.format("%%%02X", string.byte(c)) end))
|
||||
end
|
||||
|
||||
local function fraction(v)
|
||||
local n = tonumber(v)
|
||||
return (n and n > 0 and n < 1) and n or nil
|
||||
end
|
||||
|
||||
-- The program files the shortcode names, read from beside the page: { pane = text } in pane order, the panes given,
|
||||
-- and the name of a file that could not be read.
|
||||
local function read_files(kwargs)
|
||||
local files, given = {}, {}
|
||||
for _, pane in ipairs(PANES) do
|
||||
local file = kwarg(kwargs, pane)
|
||||
if file then
|
||||
local text = read_beside_page(file)
|
||||
if not text then return nil, nil, file end
|
||||
files[pane] = text
|
||||
given[#given + 1] = pane
|
||||
end
|
||||
end
|
||||
return files, given, nil
|
||||
end
|
||||
|
||||
local function missing(file)
|
||||
warn("cannot read " .. file .. " next to " .. input_path())
|
||||
return pandoc.Blocks({ pandoc.Para({ pandoc.Str("[pplus: missing file " .. file .. "]") }) })
|
||||
end
|
||||
|
||||
local function wrap_collapse(kwargs, blocks)
|
||||
if kwarg(kwargs, "collapse") ~= "1" or not is_html() then return blocks end
|
||||
local out = pandoc.Blocks({ raw('<details class="pplus-details"><summary>' .. esc(kwarg(kwargs, "title") or "Show the program") .. '</summary>') })
|
||||
out:extend(blocks)
|
||||
out:insert(raw('</details>'))
|
||||
return out
|
||||
end
|
||||
|
||||
-- One file as a listing: a highlighted code block, or (matho) its equations typeset.
|
||||
local function listing_blocks(pane, text, kwargs)
|
||||
local shown = listing_text(text, pane)
|
||||
if pane == "matho" and kwarg(kwargs, "math") ~= "0" then return math_blocks(shown) end
|
||||
local attr = kwarg(kwargs, "numbers") == "1" and { ["code-line-numbers"] = "true" } or {}
|
||||
-- matho is written in LaTeX: give its listing the class pandoc highlights as LaTeX
|
||||
return pandoc.Blocks({ pandoc.CodeBlock(shown, pandoc.Attr("", { pane == "matho" and "latex" or pane }, attr)) })
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
-- Live: the app in an <iframe>
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- {{< pplus pseudo="count-base.pseudo" >}}
|
||||
-- {{< pplus lingo="count-base.lingo" pseudo="count-base.pseudo" lang="lingo" view="trace" t=7 >}}
|
||||
-- {{< pplus problem="count-base" view="trace" >}}
|
||||
-- {{< pplus pseudo="x.pseudo" mode="link" text="Open it in the playground" >}}
|
||||
-- {{< pplus mojo="demo.mojo" asm="demo.asm" setup="demo.setup" view="playground" area="hw" >}}
|
||||
-- {{< pplus problem="demo" view="playground" panel="compiler" build="default" >}}
|
||||
-- {{< pplus state="<blob from Share>" view="playground" >}}
|
||||
--
|
||||
-- Options (beside the shared ones at the top of this file)
|
||||
-- problem a catalog problem id instead of files (its embed URL is #/embed/<view>/p/<id>)
|
||||
-- state a state from the playground's Share dialog (the part of the link after #/<area>/s/): the
|
||||
-- example exactly as it was arranged there, panes, layout, build and step included.
|
||||
-- Share also writes this shortcode for you. (Pane files cannot be combined with it.)
|
||||
-- view playground | trace | table | flow | data | life | problems | proof | tests | compiler | asm,
|
||||
-- or a pane name to show just that editor (default trace). playground is the whole
|
||||
-- playground in the frame: every pane, the stepper, the variables, every inspect tab and
|
||||
-- the dock, arranged by the options below.
|
||||
-- panel the tab the playground opens on: trace table flow data life proof tests (beside the
|
||||
-- editor) or output problems compiler asm setup (the dock)
|
||||
-- build O0 (as written, every function kept; the default) | default (as `mojo build` does)
|
||||
-- dock open | closed: the dock under the editors; docktab picks its tab
|
||||
-- editor 0.25-0.8: the editor column's share of the width
|
||||
-- side the variables panel's share of the right column
|
||||
-- dockheight 0.3-0.9: the editors' share of the height above the dock
|
||||
-- theme light | dark (default: follow the page's own switch)
|
||||
-- ro 1 makes the embedded editors read-only (and the frame keeps no save)
|
||||
-- showcall 0 hides the run box above a flow, data or table view
|
||||
-- height iframe height in px (default 520, or 720 for view="playground"), or auto: the frame
|
||||
-- grows to fit its content (not for the playground, which fills its frame)
|
||||
-- split the share of a fixed-height frame the code takes above the panel (default 0.7)
|
||||
-- mode embed (default) | link: only a link to the full playground
|
||||
-- text the link text (mode=link)
|
||||
-- show embed (default) | listing | both: the file(s) as listings, the embed, or the listings then the embed
|
||||
--
|
||||
-- The state travels in the URL as `~` + base64url(JSON), which the app reads without decompression,
|
||||
-- so no script of the app runs on this site: the page holds a plain <iframe>. In non-HTML output the
|
||||
-- embed becomes a link.
|
||||
|
||||
-- Where the example opens: { embed = the iframe's src, open = the app link }, or nil and blocks to show instead.
|
||||
local function live_target(kwargs, meta, view, listings, default_area)
|
||||
local base = pplus_url(meta)
|
||||
local playground = view == "playground"
|
||||
local area = kwarg(kwargs, "area") or default_area or "bridge"
|
||||
if area ~= "bridge" and area ~= "dev" and area ~= "hw" then
|
||||
warn("unknown area=\"" .. area .. "\" (use bridge, dev or hw); using bridge")
|
||||
area = "bridge"
|
||||
end
|
||||
local height = kwarg(kwargs, "height")
|
||||
local query = {}
|
||||
local function q_add(k, v) query[#query + 1] = k .. "=" .. urlencode(v) end
|
||||
for _, k in ipairs({ "t", "ro", "showcall", "split" }) do
|
||||
if kwarg(kwargs, k) then q_add(k, kwarg(kwargs, k)) end
|
||||
end
|
||||
for _, k in ipairs(ARRANGE) do
|
||||
local v = kwarg(kwargs, k)
|
||||
if v then q_add(k, v) end
|
||||
end
|
||||
-- a view of the machine opens in the Hardware area unless the page says otherwise
|
||||
if default_area and not kwarg(kwargs, "area") then q_add("area", default_area) end
|
||||
if height == "auto" and not playground then query[#query + 1] = "autosize=1" end
|
||||
local q = #query > 0 and ("?" .. table.concat(query, "&")) or ""
|
||||
|
||||
local problem = kwarg(kwargs, "problem")
|
||||
local given_state = kwarg(kwargs, "state")
|
||||
if given_state then
|
||||
-- a state made in the playground: Share -> Quarto writes this shortcode; the blob is opaque here
|
||||
local blob = given_state:gsub("^.*#/%a+/s/", ""):gsub("^.*#/embed/[^/]+/", ""):gsub("%?.*$", "")
|
||||
for _, pane in ipairs(PANES) do
|
||||
if kwarg(kwargs, pane) then warn("state= already holds every pane; " .. pane .. "= is ignored (drop state= to build the example from files)") end
|
||||
end
|
||||
return { embed = base .. "/#/embed/" .. view .. "/" .. blob .. q, open = base .. "/#/" .. area .. "/s/" .. blob }
|
||||
elseif problem then
|
||||
local embed = base .. "/#/embed/" .. view .. "/p/" .. problem .. q
|
||||
-- the arranged example, whole, in a tab of its own
|
||||
return { embed = embed, open = playground and embed or (base .. "/#/" .. area .. "/p/" .. problem) }
|
||||
end
|
||||
|
||||
local files, given, bad = read_files(kwargs)
|
||||
if bad then return nil, missing(bad) end
|
||||
if #given == 0 then
|
||||
warn("give at least one of lingo=, matho=, pseudo=, speco=, mojo=, asm=, or problem= or state=")
|
||||
return nil, pandoc.Blocks({})
|
||||
end
|
||||
local sources, file_call, file_input = {}, nil, nil
|
||||
for _, pane in ipairs(given) do
|
||||
local text = files[pane]
|
||||
sources[pane] = listing_text(text, pane)
|
||||
local h = header_of(text)
|
||||
file_call = file_call or h.call
|
||||
if #h.input > 0 and not file_input then file_input = table.concat(h.input, "\n") end
|
||||
if listings then listings:extend(listing_blocks(pane, text, kwargs)) end
|
||||
end
|
||||
local panel = kwarg(kwargs, "panel")
|
||||
local state = {
|
||||
v = 3,
|
||||
sources = sources,
|
||||
lang = kwarg(kwargs, "lang") or given[1],
|
||||
view = (TABS[panel or ""] and panel) or (TABS[view] and view) or "trace",
|
||||
}
|
||||
local setup_file = kwarg(kwargs, "setup")
|
||||
if setup_file then
|
||||
local text = read_beside_page(setup_file)
|
||||
if text then state.setup = text else warn("cannot read " .. setup_file .. " next to " .. input_path()) end
|
||||
end
|
||||
if kwarg(kwargs, "build") == "O0" or kwarg(kwargs, "build") == "default" then state.build = kwarg(kwargs, "build") end
|
||||
if kwarg(kwargs, "machine") then state.machine = kwarg(kwargs, "machine") end
|
||||
local layout = {}
|
||||
local dock = kwarg(kwargs, "dock")
|
||||
if dock == "open" or dock == "closed" then layout.dockCollapsed = dock == "closed" end
|
||||
local tab = kwarg(kwargs, "docktab") or ((panel == "output" or panel == "setup") and panel) or nil
|
||||
if tab and DOCK_TABS[tab] then layout.dockTab = tab end
|
||||
layout.split = fraction(kwarg(kwargs, "editor"))
|
||||
layout.right = fraction(kwarg(kwargs, "side"))
|
||||
layout.dock = fraction(kwarg(kwargs, "dockheight"))
|
||||
if next(layout) then state.layout = { [area] = layout } end
|
||||
local call = kwarg(kwargs, "call") or file_call
|
||||
if call then state.call = call end
|
||||
local input = kwarg(kwargs, "input") and table.concat(split_bar(kwarg(kwargs, "input")), "\n") or file_input
|
||||
if input then state.input = input end
|
||||
if kwarg(kwargs, "t") then state.t = tonumber(kwarg(kwargs, "t")) end
|
||||
if kwarg(kwargs, "title") then state.title = kwarg(kwargs, "title") end
|
||||
local blob = "~" .. base64url(json_encode(state))
|
||||
return { embed = base .. "/#/embed/" .. view .. "/" .. blob .. q, open = base .. "/#/" .. area .. "/s/" .. blob }
|
||||
end
|
||||
|
||||
local function figcaption(caption, links)
|
||||
return '<figcaption>' .. (caption and ('<span class="pplus-caption">' .. esc(caption) .. '</span> · ') or '')
|
||||
.. '<span class="pplus-brand">Programming+</span>' .. links .. '</figcaption>'
|
||||
end
|
||||
|
||||
local function live_embed(kwargs, meta, view_override)
|
||||
ensure_deps()
|
||||
local view = view_override or kwarg(kwargs, "view") or "trace"
|
||||
if not VIEWS[view] then
|
||||
if STATIC[view] then
|
||||
warn("view=\"" .. view .. "\" is a rendered view: use {{< pplus-view view=\"" .. view .. "\" >}} (or {{< pplus-" .. view .. " >}}); showing the live " .. STATIC[view])
|
||||
view = STATIC[view]
|
||||
else
|
||||
warn("unknown view=\"" .. view .. "\" (use playground, trace, table, flow, data, life, problems, proof, tests, compiler, asm, or a pane name); showing trace")
|
||||
view = "trace"
|
||||
end
|
||||
end
|
||||
local playground = view == "playground"
|
||||
local mode = kwarg(kwargs, "mode") or "embed"
|
||||
local show = kwarg(kwargs, "show") or "embed"
|
||||
local height = kwarg(kwargs, "height") or (playground and "720" or "520")
|
||||
if playground and height == "auto" then
|
||||
warn("height=\"auto\" does not apply to view=\"playground\", which fills its frame; using 720")
|
||||
height = "720"
|
||||
end
|
||||
local listings = pandoc.Blocks({})
|
||||
local target, instead = live_target(kwargs, meta, view, show ~= "embed" and listings or nil)
|
||||
if not target then return instead end
|
||||
local title = kwarg(kwargs, "title")
|
||||
local caption = kwarg(kwargs, "caption")
|
||||
|
||||
if show == "listing" or mode == "link" or not is_html() then
|
||||
local text = kwarg(kwargs, "text") or "Open this in Programming+"
|
||||
listings:insert(pandoc.Para({ pandoc.Link({ pandoc.Str(text) }, target.open, "", pandoc.Attr("", { "pplus-link" })) }))
|
||||
return wrap_collapse(kwargs, listings)
|
||||
end
|
||||
local auto = height == "auto"
|
||||
local label = title or ("Programming+: " .. view)
|
||||
local html = '<figure class="pplus-embed' .. (auto and ' pplus-auto' or '') .. (playground and ' pplus-playground' or '') .. '">'
|
||||
.. '<iframe class="pplus-frame" src="' .. esc(target.embed) .. '" height="' .. esc(auto and "360" or height)
|
||||
.. '" loading="lazy" title="' .. esc(label) .. '"' .. (auto and ' data-pplus-auto="1"' or '')
|
||||
.. ' allow="clipboard-write"></iframe>'
|
||||
.. figcaption(caption, ' · <a href="' .. esc(target.open) .. '" target="_blank" rel="noopener">open in the playground</a>'
|
||||
.. ' · <a href="' .. esc(target.embed) .. '" target="_blank" rel="noopener">full screen</a>')
|
||||
.. '</figure>'
|
||||
listings:insert(raw(html))
|
||||
return wrap_collapse(kwargs, listings)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
-- Rendered with the page: render.mjs runs the app's views on the files
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
-- A built Programming+ for render.mjs, looked for in this order: pplus-engine (project or page metadata), the
|
||||
-- PPLUS_ENGINE environment variable, an engine/ folder in this extension (`pixi run quarto-engine <dir>` puts one
|
||||
-- there), and the repository this extension sits in (quarto/_extensions/pplus inside a Programming+ checkout).
|
||||
local function engine_dir(meta)
|
||||
local function built(dir)
|
||||
if not dir then return nil end
|
||||
dir = dir:gsub("\\", "/"):gsub("/+$", "")
|
||||
if exists(dir .. "/quarto/render.js") then return dir end
|
||||
if exists(dir .. "/dist/quarto/render.js") then return dir .. "/dist" end
|
||||
return nil
|
||||
end
|
||||
local configured = meta_str(meta, "pplus-engine")
|
||||
-- none: render nothing with the page; every rendered view becomes its listing and the live view
|
||||
if configured == "none" or configured == "false" then return nil end
|
||||
if configured and not configured:match("^/") and not configured:match("^%a:") then
|
||||
-- relative to the project (or, without one, to the page)
|
||||
local root = (quarto.project and quarto.project.directory) or page_dir()
|
||||
configured = root .. "/" .. configured
|
||||
end
|
||||
return built(configured) or built(os.getenv("PPLUS_ENGINE")) or built(EXT_DIR .. "/engine") or built(EXT_DIR .. "/../../..")
|
||||
end
|
||||
|
||||
local engine_warned = false
|
||||
local function cache_dir(meta)
|
||||
if not meta_bool(meta, "pplus-cache", true) then return nil end
|
||||
local root = (quarto.project and quarto.project.directory) or page_dir()
|
||||
return root .. "/.quarto/pplus"
|
||||
end
|
||||
|
||||
-- Run one view. Returns the result (a table), or nil and why not.
|
||||
local function render_view(req, meta)
|
||||
local engine = engine_dir(meta)
|
||||
if not engine then
|
||||
local off = meta_str(meta, "pplus-engine")
|
||||
if off == "none" or off == "false" then return nil, "pplus-engine is none" end
|
||||
return nil, "no built Programming+ found (set pplus-engine in _quarto.yml, or see README.md)"
|
||||
end
|
||||
req.cache = cache_dir(meta)
|
||||
local node = meta_str(meta, "pplus-node") or os.getenv("PPLUS_NODE") or "node"
|
||||
local ok, out = pcall(pandoc.pipe, node, { EXT_DIR .. "/render.mjs", engine }, json_encode(req))
|
||||
if not ok then return nil, "could not run " .. node .. " (" .. tostring(out):gsub("%s+$", "") .. ")" end
|
||||
local ok2, res = pcall(json_decode, out)
|
||||
if not ok2 or type(res) ~= "table" then return nil, "render.mjs answered something that is not JSON: " .. tostring(out):sub(1, 300) end
|
||||
if res.error then return nil, res.error end
|
||||
return res
|
||||
end
|
||||
|
||||
local function strict_fail(meta, what)
|
||||
if meta_bool(meta, "pplus-strict", false) then error("pplus: " .. what .. " (pplus-strict is on)") end
|
||||
end
|
||||
|
||||
-- The tabs of a translate view, or of pplus-tabs: one per notation, a code block (matho typeset) in each.
|
||||
local function tabset(panes, kwargs)
|
||||
if not is_html() then
|
||||
local out = pandoc.Blocks({})
|
||||
for _, p in ipairs(panes) do
|
||||
out:insert(pandoc.Para({ pandoc.Strong({ pandoc.Str(p.label) }), pandoc.Str(p.generated and " (generated)" or "") }))
|
||||
if p.text ~= "" then out:extend(listing_blocks(p.lang, p.text, kwargs)) else out:insert(pandoc.Para({ pandoc.Emph({ pandoc.Str(p.note or "") }) })) end
|
||||
end
|
||||
return out
|
||||
end
|
||||
local tabs = {}
|
||||
for _, p in ipairs(panes) do
|
||||
local content = pandoc.Blocks({})
|
||||
if p.text ~= "" then
|
||||
if p.lang == "matho" and kwarg(kwargs, "math") ~= "0" then
|
||||
content:extend(math_blocks(p.text))
|
||||
content:extend(listing_blocks("matho", p.text, { math = pandoc.Str("0") }))
|
||||
else
|
||||
local attr = kwarg(kwargs, "numbers") == "1" and { ["code-line-numbers"] = "true" } or {}
|
||||
content:insert(pandoc.CodeBlock(p.text, pandoc.Attr("", { p.lang == "matho" and "latex" or p.lang }, attr)))
|
||||
end
|
||||
if p.generated and p.lang == "mojo" then
|
||||
content:insert(raw('<p class="pplus-tab-note"><span class="pplus-tag-generated">generated</span> ' .. esc(p.note or "Generated from the pseudo.") .. '</p>'))
|
||||
elseif p.generated then
|
||||
content:insert(raw('<p class="pplus-tab-note"><span class="pplus-tag-generated">generated</span> Written by Programming+ from the ' .. esc(PANE_LABEL[p.from or "pseudo"] or "pseudo") .. '.</p>'))
|
||||
end
|
||||
else
|
||||
content:insert(raw('<p class="pplus-tab-note">' .. esc(p.note or "") .. '</p>'))
|
||||
end
|
||||
tabs[#tabs + 1] = { title = p.label, content = content }
|
||||
end
|
||||
local attr = pandoc.Attr("", { "panel-tabset", "pplus-tabs" })
|
||||
-- Quarto turns a .panel-tabset div into tabs before shortcodes run, so a shortcode makes the tabset node itself
|
||||
if quarto.Tabset and quarto.Tab then
|
||||
local list = pandoc.List({})
|
||||
for _, t in ipairs(tabs) do list:insert(quarto.Tab({ title = pandoc.Inlines({ pandoc.Str(t.title) }), content = t.content })) end
|
||||
return pandoc.Blocks({ quarto.Tabset({ level = 3, tabs = list, attr = attr }) })
|
||||
end
|
||||
local inner = pandoc.Blocks({})
|
||||
for _, t in ipairs(tabs) do
|
||||
inner:insert(pandoc.Header(3, { pandoc.Str(t.title) }))
|
||||
inner:extend(t.content)
|
||||
end
|
||||
return pandoc.Blocks({ pandoc.Div(inner, attr) })
|
||||
end
|
||||
|
||||
local function static_view(view, kwargs, meta, extra)
|
||||
ensure_deps()
|
||||
if view == "hw" then ensure_hw_deps() end
|
||||
local files, given, bad = read_files(kwargs)
|
||||
if bad then return missing(bad) end
|
||||
if #given == 0 then
|
||||
warn("pplus-" .. view .. ": give a program file: lingo=, matho=, pseudo=, speco=, mojo= or asm=")
|
||||
return pandoc.Blocks({})
|
||||
end
|
||||
local req = { view = view, files = files }
|
||||
req.lang = kwarg(kwargs, "lang")
|
||||
if kwarg(kwargs, "call") then req.call = kwarg(kwargs, "call") end
|
||||
if kwarg(kwargs, "input") then req.input = split_bar(kwarg(kwargs, "input")) end
|
||||
local setup_file = kwarg(kwargs, "setup")
|
||||
if setup_file then
|
||||
local text = read_beside_page(setup_file)
|
||||
if text then req.setup = text else warn("cannot read " .. setup_file .. " next to " .. input_path()) end
|
||||
end
|
||||
req.machine = kwarg(kwargs, "machine")
|
||||
req.t = tonumber(kwarg(kwargs, "t") or "")
|
||||
req.title = kwarg(kwargs, "title")
|
||||
req.max = tonumber(kwarg(kwargs, "max") or "")
|
||||
if kwarg(kwargs, "follow") then req.follow = split_list(kwarg(kwargs, "follow")) end
|
||||
if kwarg(kwargs, "to") then req.to = split_list(kwarg(kwargs, "to")) end
|
||||
req.compiler = kwarg(kwargs, "compiler") or "auto"
|
||||
if view == "hw" then
|
||||
req.hw = (extra and extra.hw) or (kwarg(kwargs, "views") and split_list(kwarg(kwargs, "views"))) or (kwarg(kwargs, "view") and kwarg(kwargs, "view") ~= "hw" and { kwarg(kwargs, "view") }) or nil
|
||||
req.preset = kwarg(kwargs, "preset")
|
||||
req.listing = kwarg(kwargs, "listing") ~= "0"
|
||||
req.stepper = kwarg(kwargs, "stepper") ~= "0"
|
||||
end
|
||||
|
||||
local name = (extra and extra.name) or ("pplus-" .. view)
|
||||
local where = name .. " in " .. (input_path():match("[^/]*$") or "")
|
||||
local res, why = render_view(req, meta)
|
||||
local blocks = pandoc.Blocks({})
|
||||
local title = kwarg(kwargs, "title")
|
||||
local caption = kwarg(kwargs, "caption")
|
||||
local target = live_target(kwargs, meta, STATIC[view], nil, view == "hw" and "hw" or nil)
|
||||
|
||||
if not res then
|
||||
-- no engine (or it failed): the page still renders, with the program and the live view in its place
|
||||
if not engine_warned then warn(where .. ": " .. why .. "; showing the live view instead") engine_warned = true end
|
||||
strict_fail(meta, where .. ": " .. why)
|
||||
for _, pane in ipairs(given) do blocks:extend(listing_blocks(pane, files[pane], kwargs)) end
|
||||
if target then blocks:extend(live_embed(kwargs, meta, STATIC[view])) end
|
||||
return wrap_collapse(kwargs, blocks)
|
||||
end
|
||||
for _, w in ipairs(res.warnings or {}) do warn(where .. ": " .. w) end
|
||||
if res.expect and not res.expect.ok then strict_fail(meta, where .. ": the run does not print its EXPECT lines") end
|
||||
|
||||
local code = pandoc.Blocks({})
|
||||
if kwarg(kwargs, "code") == "1" then
|
||||
for _, pane in ipairs(given) do
|
||||
local shows = pane == res.lang or #given == 1
|
||||
or (res.lang == "pseudo" and (pane == "lingo" or pane == "matho" or (pane == "speco" and view == "proof")))
|
||||
if shows then code:extend(listing_blocks(pane, files[pane], kwargs)) end
|
||||
end
|
||||
end
|
||||
|
||||
-- translate, as tabs: Quarto's own tabset over pandoc code blocks (highlighted by the syntax definitions)
|
||||
local layout = kwarg(kwargs, "layout") or "tabs"
|
||||
if view == "translate" and (layout == "tabs" or layout == "columns" or not is_html()) and res.panes then
|
||||
if layout == "columns" and is_html() then
|
||||
local cols = pandoc.Blocks({})
|
||||
for _, p in ipairs(res.panes) do
|
||||
local col = pandoc.Blocks({ pandoc.Para({ pandoc.Strong({ pandoc.Str(p.label) }), pandoc.Str(p.generated and " (generated)" or "") }) })
|
||||
if p.text ~= "" then col:extend(listing_blocks(p.lang, p.text, kwargs)) else col:insert(pandoc.Para({ pandoc.Emph({ pandoc.Str(p.note or "") }) })) end
|
||||
cols:insert(pandoc.Div(col, pandoc.Attr("", { "pplus-col" })))
|
||||
end
|
||||
blocks:insert(pandoc.Div(cols, pandoc.Attr("", { "pplus-columns" })))
|
||||
else
|
||||
blocks:extend(tabset(res.panes, kwargs))
|
||||
end
|
||||
if is_html() and (caption or target) then
|
||||
blocks:insert(raw('<div class="pplus-under">' .. figcaption(caption, target and (' · <a href="' .. esc(target.open) .. '" target="_blank" rel="noopener">open in the playground</a>') or '') .. '</div>'))
|
||||
end
|
||||
return wrap_collapse(kwargs, blocks)
|
||||
end
|
||||
|
||||
if not is_html() then
|
||||
if title then blocks:insert(pandoc.Para({ pandoc.Strong({ pandoc.Str(title) }) })) end
|
||||
blocks:extend(code)
|
||||
blocks:extend(pandoc.read(res.markdown or "", "markdown").blocks)
|
||||
if caption then blocks:insert(pandoc.Para({ pandoc.Emph({ pandoc.Str(caption) }) })) end
|
||||
if target then blocks:insert(pandoc.Para({ pandoc.Link({ pandoc.Str(kwarg(kwargs, "text") or "Open this in Programming+") }, target.open, "", pandoc.Attr("", { "pplus-link" })) })) end
|
||||
return wrap_collapse(kwargs, blocks)
|
||||
end
|
||||
|
||||
local live = kwarg(kwargs, "live")
|
||||
local links = ''
|
||||
if target then
|
||||
if live == "click" then
|
||||
links = links .. ' · <button type="button" class="pplus-golive" data-src="' .. esc(target.embed) .. '" data-height="' .. esc(kwarg(kwargs, "height") or (STATIC[view] == "playground" and "720" or "520")) .. '">make it live</button>'
|
||||
end
|
||||
links = links .. ' · <a href="' .. esc(target.open) .. '" target="_blank" rel="noopener">open in the playground</a>'
|
||||
end
|
||||
-- a div, not a raw <figure>, so a listing inside it is still pandoc's (highlighted, numbered)
|
||||
local fig = pandoc.Blocks({})
|
||||
if title then fig:insert(raw('<div class="pplus-figtitle">' .. esc(title) .. '</div>')) end
|
||||
if #code > 0 then fig:insert(pandoc.Div(code, pandoc.Attr("", { "pplus-figcode" }))) end
|
||||
fig:insert(raw(res.html))
|
||||
fig:insert(raw(figcaption(caption, links)))
|
||||
local classes = { "pplus-figure", "pplus-figure-" .. view }
|
||||
-- column= widens the figure into Quarto's page grid (body, page, screen, margin...); the whole machine board is page-wide
|
||||
local column = kwarg(kwargs, "column") or ((view == "hw" and not (extra and extra.name)) and "page" or nil)
|
||||
if column and column ~= "body" then classes[#classes + 1] = "column-" .. column end
|
||||
blocks:insert(pandoc.Div(fig, pandoc.Attr("", classes)))
|
||||
return wrap_collapse(kwargs, blocks)
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
-- Plain: listings, tabs, a link
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function listing(kwargs, meta)
|
||||
ensure_deps()
|
||||
local files, given, bad = read_files(kwargs)
|
||||
if bad then return missing(bad) end
|
||||
local blocks = pandoc.Blocks({})
|
||||
for _, pane in ipairs(given) do blocks:extend(listing_blocks(pane, files[pane], kwargs)) end
|
||||
if kwarg(kwargs, "link") == "1" then
|
||||
local target = live_target(kwargs, meta, kwarg(kwargs, "view") or "trace", nil)
|
||||
if target then blocks:insert(pandoc.Para({ pandoc.Link({ pandoc.Str(kwarg(kwargs, "text") or "Open this in Programming+") }, target.open, "", pandoc.Attr("", { "pplus-link" })) })) end
|
||||
end
|
||||
return wrap_collapse(kwargs, blocks)
|
||||
end
|
||||
|
||||
local function tabs(kwargs, meta)
|
||||
ensure_deps()
|
||||
local files, given, bad = read_files(kwargs)
|
||||
if bad then return missing(bad) end
|
||||
local panes = {}
|
||||
for _, pane in ipairs(given) do panes[#panes + 1] = { lang = pane, label = PANE_LABEL[pane], text = listing_text(files[pane], pane), generated = false } end
|
||||
return wrap_collapse(kwargs, tabset(panes, kwargs))
|
||||
end
|
||||
|
||||
local function link(kwargs, meta)
|
||||
ensure_deps()
|
||||
local view = kwarg(kwargs, "view") or "playground"
|
||||
local target, instead = live_target(kwargs, meta, VIEWS[view] and view or "playground", nil)
|
||||
if not target then return instead end
|
||||
-- the whole playground opens in its area; a single view opens as that embed, full screen
|
||||
local href = view == "playground" and target.open or target.embed
|
||||
return pandoc.Para({ pandoc.Link({ pandoc.Str(kwarg(kwargs, "text") or "Open this in Programming+") }, href, "", pandoc.Attr("", { "pplus-link" })) })
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function static(view) return function(args, kwargs, meta) return static_view(view, kwargs, meta) end end
|
||||
|
||||
local shortcodes = {
|
||||
["pplus"] = function(args, kwargs, meta) return live_embed(kwargs, meta) end,
|
||||
["pplus-embed"] = function(args, kwargs, meta) return live_embed(kwargs, meta) end,
|
||||
["pplus-playground"] = function(args, kwargs, meta) return live_embed(kwargs, meta, "playground") end,
|
||||
["pplus-view"] = function(args, kwargs, meta)
|
||||
local view = kwarg(kwargs, "view") or (args[1] and str(args[1])) or "steps"
|
||||
if view == "dataflow" then view = "data" elseif view == "lifetimes" then view = "life" end
|
||||
if not STATIC[view] then
|
||||
warn("pplus-view: unknown view=\"" .. view .. "\" (use run, steps, table, flow, data, life, proof, tests, check, translate, machine)")
|
||||
return pandoc.Blocks({})
|
||||
end
|
||||
return static_view(view, kwargs, meta)
|
||||
end,
|
||||
["pplus-run"] = static("run"),
|
||||
["pplus-steps"] = static("steps"),
|
||||
["pplus-table"] = static("table"),
|
||||
["pplus-flow"] = static("flow"),
|
||||
["pplus-dataflow"] = static("data"),
|
||||
["pplus-lifetimes"] = static("life"),
|
||||
["pplus-proof"] = static("proof"),
|
||||
["pplus-tests"] = static("tests"),
|
||||
["pplus-check"] = static("check"),
|
||||
["pplus-translate"] = static("translate"),
|
||||
["pplus-machine"] = static("machine"),
|
||||
-- the machine: the Hardware board over an x86-64 run, every card steppable
|
||||
["pplus-hw"] = function(args, kwargs, meta) return static_view("hw", kwargs, meta) end,
|
||||
["pplus-listing"] = function(args, kwargs, meta) return listing(kwargs, meta) end,
|
||||
["pplus-tabs"] = function(args, kwargs, meta) return tabs(kwargs, meta) end,
|
||||
["pplus-link"] = function(args, kwargs, meta) return link(kwargs, meta) end,
|
||||
}
|
||||
|
||||
for _, name in ipairs(HW_VIEWS) do
|
||||
shortcodes["pplus-hw-" .. name] = function(args, kwargs, meta) return static_view("hw", kwargs, meta, { hw = { name }, name = "pplus-hw-" .. name }) end
|
||||
end
|
||||
|
||||
return shortcodes
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env node
|
||||
// render.mjs: runs one static view for the Programming+ shortcodes (pplus.lua calls it while Quarto renders).
|
||||
//
|
||||
// node render.mjs <engine> a request as JSON on stdin; the result as JSON on stdout
|
||||
//
|
||||
// <engine> is a built Programming+ (a folder holding dist/, or dist/ itself): the extension finds it as
|
||||
// quarto/README.md describes. The views run the app's own engines, from dist/quarto/render.js, under a small
|
||||
// document (dist/quarto/dom.js): nothing here knows how a program runs.
|
||||
//
|
||||
// A Mojo file asked to run is also given to a real compiler when one is on the PATH (`mojo`; inside pixi, the
|
||||
// pinned one), and the page shows that compiler's output; without one, Programming+'s interpreter runs it and
|
||||
// the page says so. `"compiler": "off"` in the request skips the compiler.
|
||||
//
|
||||
// Results are cached by the request and the engine's build, in the folder the request names (`cache`).
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import crypto from 'node:crypto';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
|
||||
// written synchronously: process.exit() would cut an asynchronous write to a pipe short
|
||||
const write = (text) => { const b = Buffer.from(text); let o = 0; while (o < b.length) o += fs.writeSync(1, b, o); };
|
||||
const out = (obj) => write(JSON.stringify(obj));
|
||||
function fail(message) { out({ error: message }); process.exit(0); }
|
||||
|
||||
const arg = process.argv[2];
|
||||
if (!arg) fail('usage: node render.mjs <Programming+ folder or its dist/>');
|
||||
const dist = fs.existsSync(path.join(arg, 'quarto', 'render.js')) ? arg : path.join(arg, 'dist');
|
||||
const entry = path.join(dist, 'quarto', 'render.js');
|
||||
if (!fs.existsSync(entry)) fail(`no built Programming+ at ${arg} (looked for ${entry}); build it with \`pixi run build\``);
|
||||
|
||||
let req;
|
||||
try { req = JSON.parse(fs.readFileSync(0, 'utf8')); } catch (e) { fail(`the request is not JSON: ${e.message}`); }
|
||||
|
||||
// the cache key: the request, and the build of every file the views read (a rebuilt engine renders again)
|
||||
let key = null;
|
||||
if (req.cache) {
|
||||
const h = crypto.createHash('sha256').update(JSON.stringify({ ...req, cache: undefined }));
|
||||
for (const f of ['quarto/render.js', 'quarto/machine.js', 'quarto/dom.js', 'core/session.js', 'ui/views/viz.js', 'engines/asm86/hwviews.js', 'engines/asm86/views.js', 'mojo/generated/pin.js']) {
|
||||
try { h.update(f + fs.statSync(path.join(dist, f)).mtimeMs); } catch { /* absent: not part of the key */ }
|
||||
}
|
||||
key = h.digest('hex').slice(0, 24);
|
||||
try { write(fs.readFileSync(path.join(req.cache, key + '.json'), 'utf8')); process.exit(0); } catch { /* not cached yet */ }
|
||||
}
|
||||
|
||||
// a real Mojo compiler, for a run of a Mojo file
|
||||
let compiled = null;
|
||||
if (req.view === 'run' && typeof req.files?.mojo === 'string' && req.compiler !== 'off') {
|
||||
const v = spawnSync('mojo', ['--version'], { encoding: 'utf8' });
|
||||
if (v.status === 0) {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'pplus-mojo-'));
|
||||
const file = path.join(dir, 'main.mojo');
|
||||
fs.writeFileSync(file, req.files.mojo);
|
||||
const input = (req.input ?? []).map((l) => l + '\n').join('');
|
||||
const r = spawnSync('mojo', ['run', file], { input, encoding: 'utf8', timeout: 180000 });
|
||||
compiled = { stdout: r.stdout ?? '', stderr: r.stderr ?? '', status: r.status, version: v.stdout.trim() };
|
||||
fs.rmSync(dir, { recursive: true, force: true });
|
||||
} else if (req.compiler === 'on') fail('compiler="on", and there is no `mojo` on the PATH');
|
||||
}
|
||||
|
||||
const { installDocument } = await import(pathToFileURL(path.join(dist, 'quarto', 'dom.js')).href);
|
||||
installDocument();
|
||||
const { renderStatic } = await import(pathToFileURL(entry).href);
|
||||
let res;
|
||||
try {
|
||||
res = renderStatic({ ...req, compiled });
|
||||
} catch (e) {
|
||||
fail(`the ${req.view} view failed: ${e?.stack || e}`);
|
||||
}
|
||||
const { node, ...rest } = res;
|
||||
// a machine board keeps every step's drawing of every card: they repeat from step to step, so deflate (which
|
||||
// pplus.js undoes with the browser's DecompressionStream) makes them a few kilobytes a card
|
||||
if (rest.html) {
|
||||
const zlib = await import('node:zlib');
|
||||
rest.html = rest.html.replace(/<script type="application\/json" class="pplus-hw-data">([^<]*)<\/script>/g, (_, json) =>
|
||||
`<script type="application/x-pplus-deflate" class="pplus-hw-data">${zlib.deflateRawSync(Buffer.from(json, 'utf8'), { level: 9 }).toString('base64')}</script>`);
|
||||
}
|
||||
const text = JSON.stringify(rest);
|
||||
if (key) { try { fs.mkdirSync(req.cache, { recursive: true }); fs.writeFileSync(path.join(req.cache, key + '.json'), text); } catch { /* a cache that cannot be written is no cache */ } }
|
||||
write(text);
|
||||
// the views leave timers behind (a deferred scroll, a tooltip); the answer is written, so do not wait for them
|
||||
process.exit(0);
|
||||
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- lingo: the controlled English of Programming+ (pplus.scient.ing). A reader knows a fixed set of
|
||||
sentence shapes; this definition colors those shapes so a page can show which words carry the
|
||||
meaning. Hand-written, like pseudo.xml. -->
|
||||
<language name="Lingo"
|
||||
section="Sources"
|
||||
version="1"
|
||||
kateversion="5.0"
|
||||
extensions="*.lingo"
|
||||
mimetype="text/x-lingo"
|
||||
author="BIOSC 1540"
|
||||
license="MIT">
|
||||
|
||||
<highlighting>
|
||||
<!-- sentence openers that start a block or end the routine -->
|
||||
<list name="flow">
|
||||
<item>If</item>
|
||||
<item>Otherwise</item>
|
||||
<item>Repeat</item>
|
||||
<item>Stop</item>
|
||||
<item>Skip</item>
|
||||
</list>
|
||||
<!-- steps that create or change a value -->
|
||||
<list name="steps">
|
||||
<item>Start</item>
|
||||
<item>Set</item>
|
||||
<item>Add</item>
|
||||
<item>Subtract</item>
|
||||
<item>Count</item>
|
||||
<item>Swap</item>
|
||||
<item>Check</item>
|
||||
</list>
|
||||
<!-- comparison and connective words -->
|
||||
<list name="glue">
|
||||
<item>is</item>
|
||||
<item>are</item>
|
||||
<item>not</item>
|
||||
<item>and</item>
|
||||
<item>or</item>
|
||||
<item>neither</item>
|
||||
<item>nor</item>
|
||||
<item>at</item>
|
||||
<item>of</item>
|
||||
<item>in</item>
|
||||
<item>to</item>
|
||||
<item>from</item>
|
||||
<item>with</item>
|
||||
<item>when</item>
|
||||
<item>where</item>
|
||||
<item>otherwise</item>
|
||||
<item>plus</item>
|
||||
<item>minus</item>
|
||||
<item>times</item>
|
||||
<item>less</item>
|
||||
<item>more</item>
|
||||
<item>than</item>
|
||||
<item>least</item>
|
||||
<item>most</item>
|
||||
<item>one</item>
|
||||
<item>every</item>
|
||||
<item>each</item>
|
||||
<item>called</item>
|
||||
<item>empty</item>
|
||||
<item>contains</item>
|
||||
</list>
|
||||
<!-- kinds of thing -->
|
||||
<list name="kinds">
|
||||
<item>text</item>
|
||||
<item>letter</item>
|
||||
<item>number</item>
|
||||
<item>whole</item>
|
||||
<item>list</item>
|
||||
<item>tally</item>
|
||||
<item>position</item>
|
||||
<item>positions</item>
|
||||
<item>length</item>
|
||||
<item>letters</item>
|
||||
<item>window</item>
|
||||
</list>
|
||||
|
||||
<contexts>
|
||||
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
|
||||
<DetectSpaces/>
|
||||
<Detect2Chars attribute="Comment" char="/" char1="/" context="Comment"/>
|
||||
<DetectChar attribute="String" char=""" context="StringDouble"/>
|
||||
<DetectChar attribute="Char" char="'" context="CharSingle"/>
|
||||
|
||||
<!-- the routine's first line and its last -->
|
||||
<RegExpr attribute="Function" String="^\s*To\b" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="The answer is" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="Stop and answer" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="Stop the loop" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="Skip to the next" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="For each" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="For every" context="#stay"/>
|
||||
<StringDetect attribute="Control Flow" String="Repeat while" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="up to but not including" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="up to and including" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="the number of" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="the letter of" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="the length of" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="starting at" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="to the end of" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="an empty list called" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="an empty tally called" context="#stay"/>
|
||||
<StringDetect attribute="Keyword" String="an empty text called" context="#stay"/>
|
||||
|
||||
<keyword attribute="Control Flow" String="flow"/>
|
||||
<keyword attribute="Keyword" String="steps"/>
|
||||
<keyword attribute="Data Type" String="kinds"/>
|
||||
<keyword attribute="Operator" String="glue"/>
|
||||
|
||||
<RegExpr attribute="Decimal" String="\b[0-9]+\b" context="#stay"/>
|
||||
<!-- a name: a capitalized word or a single lowercase letter that is not a glue word -->
|
||||
<RegExpr attribute="Variable" String="\b[A-Z][A-Za-z0-9_]*\b" context="#stay"/>
|
||||
<RegExpr attribute="Variable" String="\b[a-z]\b" context="#stay"/>
|
||||
<AnyChar attribute="Operator" String=":.,+-()"/>
|
||||
</context>
|
||||
|
||||
<context name="Comment" attribute="Comment" lineEndContext="#pop">
|
||||
<DetectSpaces/>
|
||||
<DetectIdentifier/>
|
||||
</context>
|
||||
|
||||
<context name="StringDouble" attribute="String" lineEndContext="#pop">
|
||||
<DetectChar attribute="String" char=""" context="#pop"/>
|
||||
</context>
|
||||
|
||||
<context name="CharSingle" attribute="Char" lineEndContext="#pop">
|
||||
<DetectChar attribute="Char" char="'" context="#pop"/>
|
||||
</context>
|
||||
</contexts>
|
||||
|
||||
<itemDatas>
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
||||
<itemData name="Control Flow" defStyleNum="dsControlFlow"/>
|
||||
<itemData name="Keyword" defStyleNum="dsKeyword"/>
|
||||
<itemData name="Data Type" defStyleNum="dsDataType"/>
|
||||
<itemData name="Operator" defStyleNum="dsOperator"/>
|
||||
<itemData name="Function" defStyleNum="dsFunction"/>
|
||||
<itemData name="Variable" defStyleNum="dsVariable"/>
|
||||
<itemData name="String" defStyleNum="dsString"/>
|
||||
<itemData name="Char" defStyleNum="dsChar"/>
|
||||
<itemData name="Decimal" defStyleNum="dsDecVal"/>
|
||||
<itemData name="Comment" defStyleNum="dsComment"/>
|
||||
</itemDatas>
|
||||
</highlighting>
|
||||
|
||||
<general>
|
||||
<keywords casesensitive="1" weakDeliminator="'"/>
|
||||
<comments>
|
||||
<comment name="singleLine" start="//"/>
|
||||
</comments>
|
||||
</general>
|
||||
</language>
|
||||
@@ -0,0 +1,310 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated by scripts/mojo/corpus.py emit from modular/modular@c6fa49f712fe (Mojo 1.1.0). Do not edit. -->
|
||||
<language name="Mojo"
|
||||
section="Sources"
|
||||
version="1"
|
||||
kateversion="5.0"
|
||||
extensions="*.mojo;*.🔥"
|
||||
mimetype="text/x-mojo"
|
||||
author="Programming+"
|
||||
license="MIT">
|
||||
|
||||
<highlighting>
|
||||
<list name="keywords">
|
||||
<item>False</item>
|
||||
<item>None</item>
|
||||
<item>Self</item>
|
||||
<item>True</item>
|
||||
<item>_</item>
|
||||
<item>abi</item>
|
||||
<item>and</item>
|
||||
<item>as</item>
|
||||
<item>assert</item>
|
||||
<item>async</item>
|
||||
<item>await</item>
|
||||
<item>break</item>
|
||||
<item>capturing</item>
|
||||
<item>case</item>
|
||||
<item>class</item>
|
||||
<item>comptime</item>
|
||||
<item>conforms_to</item>
|
||||
<item>continue</item>
|
||||
<item>def</item>
|
||||
<item>del</item>
|
||||
<item>elif</item>
|
||||
<item>else</item>
|
||||
<item>escaping</item>
|
||||
<item>except</item>
|
||||
<item>finally</item>
|
||||
<item>for</item>
|
||||
<item>from</item>
|
||||
<item>global</item>
|
||||
<item>if</item>
|
||||
<item>import</item>
|
||||
<item>in</item>
|
||||
<item>is</item>
|
||||
<item>lambda</item>
|
||||
<item>match</item>
|
||||
<item>nonlocal</item>
|
||||
<item>not</item>
|
||||
<item>or</item>
|
||||
<item>origin_of</item>
|
||||
<item>pass</item>
|
||||
<item>raise</item>
|
||||
<item>raises</item>
|
||||
<item>return</item>
|
||||
<item>struct</item>
|
||||
<item>thin</item>
|
||||
<item>trait</item>
|
||||
<item>try</item>
|
||||
<item>type_of</item>
|
||||
<item>where</item>
|
||||
<item>while</item>
|
||||
<item>with</item>
|
||||
<item>yield</item>
|
||||
</list>
|
||||
<list name="conventions">
|
||||
<item>deinit</item>
|
||||
<item>imm</item>
|
||||
<item>mut</item>
|
||||
<item>out</item>
|
||||
<item>ref</item>
|
||||
<item>var</item>
|
||||
</list>
|
||||
<list name="removed">
|
||||
<item>fn</item>
|
||||
<item>read</item>
|
||||
</list>
|
||||
<list name="builtins">
|
||||
<item>Absable</item>
|
||||
<item>AddressSpace</item>
|
||||
<item>AnyOrigin</item>
|
||||
<item>AnyType</item>
|
||||
<item>Array</item>
|
||||
<item>BFloat16</item>
|
||||
<item>Bool</item>
|
||||
<item>Boolable</item>
|
||||
<item>Byte</item>
|
||||
<item>Codepoint</item>
|
||||
<item>Comparable</item>
|
||||
<item>Copyable</item>
|
||||
<item>DType</item>
|
||||
<item>Defaultable</item>
|
||||
<item>Deinitable</item>
|
||||
<item>Dict</item>
|
||||
<item>Equatable</item>
|
||||
<item>Error</item>
|
||||
<item>FileDescriptor</item>
|
||||
<item>FileHandle</item>
|
||||
<item>Float16</item>
|
||||
<item>Float32</item>
|
||||
<item>Float4_e2m1fn</item>
|
||||
<item>Float64</item>
|
||||
<item>Float8_e4m3fn</item>
|
||||
<item>Float8_e4m3fnuz</item>
|
||||
<item>Float8_e5m2</item>
|
||||
<item>Float8_e5m2fnuz</item>
|
||||
<item>Float8_e8m0fnu</item>
|
||||
<item>FloatLiteral</item>
|
||||
<item>Floatable</item>
|
||||
<item>FloatableRaising</item>
|
||||
<item>Hashable</item>
|
||||
<item>Identifiable</item>
|
||||
<item>ImmOpaquePointer</item>
|
||||
<item>ImmOrigin</item>
|
||||
<item>ImmPointer</item>
|
||||
<item>ImmSpan</item>
|
||||
<item>ImmStaticOrigin</item>
|
||||
<item>ImmStringSlice</item>
|
||||
<item>ImmStringSpan</item>
|
||||
<item>ImmUnsafeAnyOrigin</item>
|
||||
<item>ImmUntrackedOrigin</item>
|
||||
<item>ImmutAnyOrigin</item>
|
||||
<item>ImplicitlyCopyable</item>
|
||||
<item>Indexer</item>
|
||||
<item>InlineLevel</item>
|
||||
<item>Int</item>
|
||||
<item>Int128</item>
|
||||
<item>Int16</item>
|
||||
<item>Int256</item>
|
||||
<item>Int32</item>
|
||||
<item>Int64</item>
|
||||
<item>Int8</item>
|
||||
<item>IntLiteral</item>
|
||||
<item>Intable</item>
|
||||
<item>IntableRaising</item>
|
||||
<item>Iterable</item>
|
||||
<item>IterableOwned</item>
|
||||
<item>Iterator</item>
|
||||
<item>KeyElement</item>
|
||||
<item>List</item>
|
||||
<item>Movable</item>
|
||||
<item>MutAnyOrigin</item>
|
||||
<item>MutOpaquePointer</item>
|
||||
<item>MutOrigin</item>
|
||||
<item>MutPointer</item>
|
||||
<item>MutSpan</item>
|
||||
<item>MutStringSlice</item>
|
||||
<item>MutStringSpan</item>
|
||||
<item>MutUnsafeAnyOrigin</item>
|
||||
<item>MutUntrackedOrigin</item>
|
||||
<item>Never</item>
|
||||
<item>NoneType</item>
|
||||
<item>OpaquePointer</item>
|
||||
<item>Optional</item>
|
||||
<item>OptionalPointer</item>
|
||||
<item>Origin</item>
|
||||
<item>OriginSet</item>
|
||||
<item>ParameterList</item>
|
||||
<item>Pointer</item>
|
||||
<item>Powable</item>
|
||||
<item>RegisterPassable</item>
|
||||
<item>ReversibleRange</item>
|
||||
<item>Roundable</item>
|
||||
<item>SIMD</item>
|
||||
<item>SIMDLength</item>
|
||||
<item>Scalar</item>
|
||||
<item>Sized</item>
|
||||
<item>SizedRaising</item>
|
||||
<item>Slice</item>
|
||||
<item>Some</item>
|
||||
<item>SomeTypeList</item>
|
||||
<item>Span</item>
|
||||
<item>StaticString</item>
|
||||
<item>StopIteration</item>
|
||||
<item>String</item>
|
||||
<item>StringLiteral</item>
|
||||
<item>StringSlice</item>
|
||||
<item>StringSpan</item>
|
||||
<item>TrivialRegisterPassable</item>
|
||||
<item>Tuple</item>
|
||||
<item>TypeList</item>
|
||||
<item>UInt</item>
|
||||
<item>UInt128</item>
|
||||
<item>UInt16</item>
|
||||
<item>UInt256</item>
|
||||
<item>UInt32</item>
|
||||
<item>UInt64</item>
|
||||
<item>UInt8</item>
|
||||
<item>UnsafeAnyOrigin</item>
|
||||
<item>UnsafePointer</item>
|
||||
<item>UntrackedOrigin</item>
|
||||
<item>VariadicList</item>
|
||||
<item>VariadicPack</item>
|
||||
<item>Writable</item>
|
||||
<item>Writer</item>
|
||||
<item>abs</item>
|
||||
<item>all</item>
|
||||
<item>alloc</item>
|
||||
<item>any</item>
|
||||
<item>ascii</item>
|
||||
<item>atof</item>
|
||||
<item>atol</item>
|
||||
<item>bin</item>
|
||||
<item>breakpoint</item>
|
||||
<item>chr</item>
|
||||
<item>debug_assert</item>
|
||||
<item>deinit</item>
|
||||
<item>divmod</item>
|
||||
<item>doc_hidden</item>
|
||||
<item>enumerate</item>
|
||||
<item>hash</item>
|
||||
<item>hex</item>
|
||||
<item>index</item>
|
||||
<item>input</item>
|
||||
<item>iter</item>
|
||||
<item>len</item>
|
||||
<item>map</item>
|
||||
<item>materialize</item>
|
||||
<item>max</item>
|
||||
<item>min</item>
|
||||
<item>next</item>
|
||||
<item>oct</item>
|
||||
<item>open</item>
|
||||
<item>ord</item>
|
||||
<item>partition</item>
|
||||
<item>pow</item>
|
||||
<item>print</item>
|
||||
<item>range</item>
|
||||
<item>rebind</item>
|
||||
<item>rebind_var</item>
|
||||
<item>reflect</item>
|
||||
<item>repr</item>
|
||||
<item>reversed</item>
|
||||
<item>round</item>
|
||||
<item>slice</item>
|
||||
<item>sort</item>
|
||||
<item>swap</item>
|
||||
<item>zip</item>
|
||||
</list>
|
||||
|
||||
<contexts>
|
||||
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
|
||||
<DetectSpaces/>
|
||||
<DetectChar attribute="Comment" char="#" context="Comment"/>
|
||||
<RegExpr attribute="String" String="[rRtT]{0,2}"""" context="TripleDouble"/>
|
||||
<RegExpr attribute="String" String="[rRtT]{0,2}'''" context="TripleSingle"/>
|
||||
<RegExpr attribute="String" String="[rRtT]{0,2}"" context="StringDouble"/>
|
||||
<RegExpr attribute="String" String="[rRtT]{0,2}'" context="StringSingle"/>
|
||||
<RegExpr attribute="Decorator" String="@[A-Za-z_][A-Za-z0-9_.]*" context="#stay" firstNonSpace="true"/>
|
||||
<keyword attribute="Removed" String="removed"/>
|
||||
<keyword attribute="Convention" String="conventions"/>
|
||||
<keyword attribute="Keyword" String="keywords"/>
|
||||
<keyword attribute="Builtin" String="builtins"/>
|
||||
<RegExpr attribute="Transfer" String="(?<=[A-Za-z0-9_\)\]])\^(?=\s*[\),\]\}:]|\s*$)" context="#stay"/>
|
||||
<RegExpr attribute="Float" String="\b[0-9][0-9_]*\.[0-9_]*(?:[eE][+-]?[0-9]+)?|\b[0-9][0-9_]*[eE][+-]?[0-9]+\b" context="#stay"/>
|
||||
<RegExpr attribute="Decimal" String="\b(?:0[xX][0-9a-fA-F_]+|0[oO][0-7_]+|0[bB][01_]+|[0-9][0-9_]*)\b" context="#stay"/>
|
||||
<RegExpr attribute="Function" String="\b[A-Za-z_][A-Za-z0-9_]*(?=\s*[\(\[])" context="#stay"/>
|
||||
<AnyChar attribute="Operator" String="+-*/%<>=!^~&|:,.@[](){}"/>
|
||||
</context>
|
||||
<context name="Comment" attribute="Comment" lineEndContext="#pop">
|
||||
<DetectSpaces/>
|
||||
<RegExpr attribute="Alert" String="\b(TODO|FIXME|NOTE)\b" context="#stay"/>
|
||||
<DetectIdentifier/>
|
||||
</context>
|
||||
<context name="TripleDouble" attribute="String" lineEndContext="#stay">
|
||||
<DetectChar attribute="String" char="\" context="Escape"/>
|
||||
<StringDetect attribute="String" String=""""" context="#pop"/>
|
||||
</context>
|
||||
<context name="TripleSingle" attribute="String" lineEndContext="#stay">
|
||||
<DetectChar attribute="String" char="\" context="Escape"/>
|
||||
<StringDetect attribute="String" String="'''" context="#pop"/>
|
||||
</context>
|
||||
<context name="StringDouble" attribute="String" lineEndContext="#pop">
|
||||
<DetectChar attribute="String" char="\" context="Escape"/>
|
||||
<DetectChar attribute="String" char=""" context="#pop"/>
|
||||
</context>
|
||||
<context name="StringSingle" attribute="String" lineEndContext="#pop">
|
||||
<DetectChar attribute="String" char="\" context="Escape"/>
|
||||
<DetectChar attribute="String" char="'" context="#pop"/>
|
||||
</context>
|
||||
<context name="Escape" attribute="String" lineEndContext="#pop">
|
||||
<RegExpr attribute="String" String="." context="#pop"/>
|
||||
</context>
|
||||
</contexts>
|
||||
|
||||
<itemDatas>
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
||||
<itemData name="Keyword" defStyleNum="dsKeyword"/>
|
||||
<itemData name="Convention" defStyleNum="dsAttribute" bold="1" italic="1"/>
|
||||
<itemData name="Transfer" defStyleNum="dsSpecialChar" bold="1"/>
|
||||
<itemData name="Removed" defStyleNum="dsError"/>
|
||||
<itemData name="Builtin" defStyleNum="dsBuiltIn"/>
|
||||
<itemData name="Decorator" defStyleNum="dsAttribute"/>
|
||||
<itemData name="Function" defStyleNum="dsFunction"/>
|
||||
<itemData name="Decimal" defStyleNum="dsDecVal"/>
|
||||
<itemData name="Float" defStyleNum="dsFloat"/>
|
||||
<itemData name="String" defStyleNum="dsString"/>
|
||||
<itemData name="Comment" defStyleNum="dsComment"/>
|
||||
<itemData name="Alert" defStyleNum="dsAlert"/>
|
||||
<itemData name="Operator" defStyleNum="dsOperator"/>
|
||||
</itemDatas>
|
||||
</highlighting>
|
||||
|
||||
<general>
|
||||
<comments>
|
||||
<comment name="singleLine" start="#"/>
|
||||
</comments>
|
||||
<keywords casesensitive="1"/>
|
||||
</general>
|
||||
</language>
|
||||
@@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<language name="Pseudo"
|
||||
section="Sources"
|
||||
version="1"
|
||||
kateversion="5.0"
|
||||
extensions="*.pseudo;*.pcode"
|
||||
mimetype="text/x-pseudocode"
|
||||
author="BIOSC 1540"
|
||||
license="MIT">
|
||||
|
||||
<highlighting>
|
||||
<list name="controlflow">
|
||||
<item>IF</item>
|
||||
<item>THEN</item>
|
||||
<item>ELSE</item>
|
||||
<item>ELSEIF</item>
|
||||
<item>ENDIF</item>
|
||||
<item>CASE</item>
|
||||
<item>OTHERWISE</item>
|
||||
<item>ENDCASE</item>
|
||||
<item>FOR</item>
|
||||
<item>TO</item>
|
||||
<item>STEP</item>
|
||||
<item>NEXT</item>
|
||||
<item>EACH</item>
|
||||
<item>REPEAT</item>
|
||||
<item>UNTIL</item>
|
||||
<item>WHILE</item>
|
||||
<item>ENDWHILE</item>
|
||||
<item>RETURN</item>
|
||||
<item>BREAK</item>
|
||||
<item>CONTINUE</item>
|
||||
</list>
|
||||
|
||||
<list name="keywords">
|
||||
<item>AND</item>
|
||||
<item>OR</item>
|
||||
<item>NOT</item>
|
||||
<item>DIV</item>
|
||||
<item>MOD</item>
|
||||
<item>OF</item>
|
||||
<item>CALL</item>
|
||||
<item>IN</item>
|
||||
</list>
|
||||
|
||||
<list name="io">
|
||||
<item>INPUT</item>
|
||||
<item>OUTPUT</item>
|
||||
</list>
|
||||
|
||||
<list name="declarations">
|
||||
<item>DECLARE</item>
|
||||
<item>CONSTANT</item>
|
||||
<item>DEFINE</item>
|
||||
<item>TYPE</item>
|
||||
<item>ENDTYPE</item>
|
||||
<item>RETURNS</item>
|
||||
<item>CLASS</item>
|
||||
<item>ENDCLASS</item>
|
||||
</list>
|
||||
|
||||
<list name="modifiers">
|
||||
<item>BYVAL</item>
|
||||
<item>BYREF</item>
|
||||
<item>PUBLIC</item>
|
||||
<item>PRIVATE</item>
|
||||
<item>INHERITS</item>
|
||||
<item>SUPER</item>
|
||||
<item>NEW</item>
|
||||
</list>
|
||||
|
||||
<list name="types">
|
||||
<item>INTEGER</item>
|
||||
<item>FLOAT</item>
|
||||
<item>CHAR</item>
|
||||
<item>STRING</item>
|
||||
<item>BOOL</item>
|
||||
<item>BOOLEAN</item>
|
||||
<item>ARRAY</item>
|
||||
<item>SET</item>
|
||||
<item>HASHMAP</item>
|
||||
<item>LIST</item>
|
||||
</list>
|
||||
|
||||
<list name="reasoning">
|
||||
<item>REQUIRE</item>
|
||||
<item>ENSURE</item>
|
||||
<item>INVARIANT</item>
|
||||
<item>DECREASES</item>
|
||||
<item>ASSERT</item>
|
||||
<item>FORALL</item>
|
||||
<item>EXISTS</item>
|
||||
<item>RESULT</item>
|
||||
<item>OLD</item>
|
||||
</list>
|
||||
<list name="constants">
|
||||
<item>TRUE</item>
|
||||
<item>FALSE</item>
|
||||
<item>NULL</item>
|
||||
</list>
|
||||
|
||||
<list name="builtins">
|
||||
<item>LENGTH</item>
|
||||
<item>APPEND</item>
|
||||
<item>INT</item>
|
||||
<item>RAND</item>
|
||||
<item>ABS</item>
|
||||
<item>ROUND</item>
|
||||
<item>MIN</item>
|
||||
<item>MAX</item>
|
||||
<item>ROWS</item>
|
||||
<item>COLUMNS</item>
|
||||
<item>SQRT</item>
|
||||
<item>EXP</item>
|
||||
<item>LOG</item>
|
||||
<item>LOG2</item>
|
||||
<item>RANDINT</item>
|
||||
<item>SLICE</item>
|
||||
<item>UPPER</item>
|
||||
<item>LOWER</item>
|
||||
<item>ORD</item>
|
||||
<item>CHR</item>
|
||||
<item>TO_STRING</item>
|
||||
<item>TO_INTEGER</item>
|
||||
<item>TO_FLOAT</item>
|
||||
<item>KEYS</item>
|
||||
<item>SORTED</item>
|
||||
<item>INSERT</item>
|
||||
<item>REMOVE</item>
|
||||
<item>ADD</item>
|
||||
<item>DELETE</item>
|
||||
<item>SORT</item>
|
||||
</list>
|
||||
|
||||
<contexts>
|
||||
|
||||
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
|
||||
<DetectSpaces/>
|
||||
|
||||
<Detect2Chars attribute="Comment" char="/" char1="/" context="Comment"/>
|
||||
|
||||
<StringDetect attribute="Assignment" String="<-" context="#stay"/>
|
||||
<RegExpr attribute="Assignment" String="\x{2190}" context="#stay"/>
|
||||
|
||||
<Detect2Chars attribute="Operator" char="=" char1="=" context="#stay"/>
|
||||
<Detect2Chars attribute="Operator" char="!" char1="=" context="#stay"/>
|
||||
<Detect2Chars attribute="Operator" char="<" char1="=" context="#stay"/>
|
||||
<Detect2Chars attribute="Operator" char=">" char1="=" context="#stay"/>
|
||||
|
||||
<DetectChar attribute="String" char=""" context="StringDouble"/>
|
||||
<DetectChar attribute="Char" char="'" context="CharSingle"/>
|
||||
|
||||
<WordDetect attribute="Declaration" String="FUNCTION" context="FunctionName"/>
|
||||
<WordDetect attribute="Declaration" String="PROCEDURE" context="FunctionName"/>
|
||||
<WordDetect attribute="Declaration" String="ENDFUNCTION" context="#stay"/>
|
||||
<WordDetect attribute="Declaration" String="ENDPROCEDURE" context="#stay"/>
|
||||
<WordDetect attribute="Declaration" String="DECLARE" context="DeclName"/>
|
||||
|
||||
<keyword attribute="Control Flow" String="controlflow"/>
|
||||
<keyword attribute="Keyword" String="keywords"/>
|
||||
<keyword attribute="IO" String="io"/>
|
||||
<keyword attribute="Declaration" String="declarations"/>
|
||||
<keyword attribute="Modifier" String="modifiers"/>
|
||||
<keyword attribute="Data Type" String="types"/>
|
||||
<keyword attribute="Constant" String="constants"/>
|
||||
<keyword attribute="Reasoning" String="reasoning"/>
|
||||
<keyword attribute="Builtin" String="builtins"/>
|
||||
|
||||
<RegExpr attribute="Float" String="\b[0-9]+\.[0-9]+\b" context="#stay"/>
|
||||
<RegExpr attribute="Decimal" String="\b[0-9]+\b" context="#stay"/>
|
||||
|
||||
<RegExpr attribute="Function" String="\b[A-Za-z][A-Za-z0-9_]*(?=\s*\()" context="#stay"/>
|
||||
|
||||
<AnyChar attribute="Operator" String="+-*/<>=!^:,.[](){}&"/>
|
||||
</context>
|
||||
|
||||
<context name="Comment" attribute="Comment" lineEndContext="#pop">
|
||||
<DetectSpaces/>
|
||||
<RegExpr attribute="Alert" String="\b(TODO|FIXME|NOTE)\b" context="#stay"/>
|
||||
<DetectIdentifier/>
|
||||
</context>
|
||||
|
||||
<context name="FunctionName" attribute="Normal Text" lineEndContext="#pop">
|
||||
<DetectSpaces/>
|
||||
<RegExpr attribute="Function" String="[A-Za-z][A-Za-z0-9_]*" context="#pop"/>
|
||||
<RegExpr attribute="Normal Text" String="." context="#pop"/>
|
||||
</context>
|
||||
|
||||
<context name="DeclName" attribute="Normal Text" lineEndContext="#pop">
|
||||
<DetectSpaces/>
|
||||
<RegExpr attribute="Variable" String="[A-Za-z][A-Za-z0-9_]*" context="#pop"/>
|
||||
<RegExpr attribute="Normal Text" String="." context="#pop"/>
|
||||
</context>
|
||||
|
||||
<context name="StringDouble" attribute="String" lineEndContext="#pop">
|
||||
<DetectChar attribute="String" char=""" context="#pop"/>
|
||||
</context>
|
||||
|
||||
<context name="CharSingle" attribute="Char" lineEndContext="#pop">
|
||||
<DetectChar attribute="Char" char="'" context="#pop"/>
|
||||
</context>
|
||||
|
||||
</contexts>
|
||||
|
||||
<itemDatas>
|
||||
<itemData name="Normal Text" defStyleNum="dsNormal"/>
|
||||
<itemData name="Keyword" defStyleNum="dsKeyword"/>
|
||||
<itemData name="Control Flow" defStyleNum="dsControlFlow" bold="1"/>
|
||||
<itemData name="Declaration" defStyleNum="dsImport"/> <!-- .im -->
|
||||
<itemData name="Modifier" defStyleNum="dsAttribute"/>
|
||||
<itemData name="IO" defStyleNum="dsExtension"/> <!-- .ex -->
|
||||
<itemData name="Data Type" defStyleNum="dsDataType"/>
|
||||
<itemData name="Builtin" defStyleNum="dsBuiltIn"/>
|
||||
<itemData name="Function" defStyleNum="dsFunction"/>
|
||||
<itemData name="Variable" defStyleNum="dsVariable"/>
|
||||
<itemData name="Constant" defStyleNum="dsConstant"/>
|
||||
<itemData name="Reasoning" defStyleNum="dsPreprocessor" bold="1"/> <!-- .pp -->
|
||||
<itemData name="Decimal" defStyleNum="dsDecVal"/>
|
||||
<itemData name="Float" defStyleNum="dsFloat"/>
|
||||
<itemData name="String" defStyleNum="dsString"/>
|
||||
<itemData name="Char" defStyleNum="dsChar"/>
|
||||
<itemData name="Comment" defStyleNum="dsComment"/>
|
||||
<itemData name="Alert" defStyleNum="dsAlert"/>
|
||||
<itemData name="Assignment" defStyleNum="dsSpecialChar"/>
|
||||
<itemData name="Operator" defStyleNum="dsOperator"/>
|
||||
</itemDatas>
|
||||
|
||||
</highlighting>
|
||||
|
||||
<general>
|
||||
<comments>
|
||||
<comment name="singleLine" start="//"/>
|
||||
</comments>
|
||||
<keywords casesensitive="1"/>
|
||||
</general>
|
||||
|
||||
</language>
|
||||
Reference in new issue
Block a user