Skip to content

Commit 22936c0

Browse files
authored
Merge pull request #7 from rezigned/deploy-github-pages
Support blank lines between transitions
2 parents b18cb95 + 3eec9a2 commit 22936c0

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ state:
146146
cargo run -p tur-cli -- examples/binary-addition.tur
147147

148148
# Pipe input to a program
149-
echo '$011-' | cargo run -p tur-cli -- examples/binary-addition.tur
149+
echo '$011' | cargo run -p tur-cli -- examples/binary-addition.tur
150150

151151
# Chaining programs with pipes
152152
echo '$011' | cargo run -p tur-cli -- examples/binary-addition.tur | cargo run -p tur-cli -- examples/binary-addition.tur

platforms/web/src/components/graph_view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl GraphView {
194194
{{ selector: '.current', style: {{ 'background-color': gt.activeNodeColor }} }},
195195
{{ selector: '.previous', style: {{ 'background-color': gt.defaultNodeColor }} }},
196196
{{ selector: '.halt', style: {{ 'background-color': gt.defaultNodeColor }} }},
197-
{{ selector: 'edge', style: {{ 'width': 2, 'line-color': gt.edgeColor, 'target-arrow-color': gt.edgeColor, 'target-arrow-shape': 'triangle', 'curve-style': 'bezier', 'font-size': '12px', 'text-background-color': 'white', 'text-background-opacity': 0.8 }} }},
197+
{{ selector: 'edge', style: {{ 'width': 2, 'line-color': gt.edgeColor, 'target-arrow-color': gt.edgeColor, 'target-arrow-shape': 'triangle', 'curve-style': 'bezier', 'font-family': '"Fira Code", monospace', 'font-size': '12px', 'color': '#444', 'text-background-color': '#F5F7FA', 'text-background-opacity': 0.8 }} }},
198198
{{ selector: 'edge[label]', style: {{ 'label': 'data(label)', 'text-wrap': 'wrap', 'text-max-width': '120px' }} }}
199199
],
200200
layout: {{ name: 'circle', padding: 30 }},
@@ -313,6 +313,6 @@ impl GraphView {
313313
.collect::<Vec<&str>>()
314314
.join(",");
315315

316-
format!("{}/{}/{}", read_str, write_str, dir_str)
316+
format!("{} -> {}, {}", read_str, write_str, dir_str)
317317
}
318318
}

platforms/web/styles.css

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -668,17 +668,16 @@ body {
668668
.app {
669669
padding: 1.5rem;
670670
}
671+
body {
672+
padding-top: 1rem;
673+
}
674+
body .socials {
675+
position: relative;
676+
margin: 0 1rem 0.2rem;
677+
}
671678
.main-layout, .left-panel, .right-panel {
672679
gap: 1.5rem;
673680
}
674-
.card, .program-selector-section, .editor-section, .tape-view,
675-
.state-display,
676-
.control-panel,
677-
.graph-view,
678-
.multi-tape-view,
679-
.status-section {
680-
/* These styles are now handled by .section */
681-
}
682681
.btn {
683682
padding: 0.7rem 1.4rem;
684683
font-size: 0.9rem;
@@ -687,10 +686,12 @@ body {
687686

688687
.socials {
689688
position: absolute;
690-
top: 1.5rem;
691-
right: 1.5rem;
689+
right: 0;
690+
top: 0;
692691
display: flex;
692+
justify-content: flex-end;
693693
gap: 5px;
694+
margin: 1.5rem 1.5rem 0 0;
694695
z-index: 10;
695696
}
696697
/* Share Button Styles */

platforms/web/turing-editor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ window.addEventListener("load", () => {
1313
nodeTextColor: "white",
1414
edgeTextBackgroundColor: "white",
1515
};
16+
1617
console.log("Graph theme initialized");
1718

1819
// Initialize CodeMirror-based syntax highlighting

src/grammar.pest

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ state_stop = { "stop:" ~ state ~ ("," ~ state)* }
4141
// =============================================================================
4242
// TRANSITIONS SECTION
4343
// =============================================================================
44-
rules = ${ "rules:" ~ transition_block ~ last_transition_block? }
45-
transition_block = _{ block_start ~ (comment | transition+) ~ block_end ~ transition_block* }
46-
transition = ${ state ~ ":" ~ actions+ }
47-
last_transition_block = _{ block_start ~ (comment | last_transition) ~ block_end }
48-
last_transition = ${ state ~ ":" }
44+
rules = ${ "rules:" ~ transition_block ~ (block_sep ~ last_transition)? }
45+
transition_block = _{ block_start ~ transition ~ (block_sep ~ (comment | transition))* ~ block_end ~ transition_block* }
46+
transition = ${ state ~ ":" ~ actions+ }
47+
last_transition = ${ state ~ ":" }
4948

5049
// =============================================================================
5150
// ACTIONS AND TRANSITIONS
@@ -63,6 +62,7 @@ direction = { "<" | ">" | "-" | "L" | "R" | "S" }
6362
// =============================================================================
6463
block_start = _{ NEWLINE ~ PEEK_ALL ~ PUSH(INDENT) }
6564
block_end = _{ DROP }
65+
block_sep = _{ NEWLINE+ ~ INDENT }
6666

6767
// =============================================================================
6868
// BASIC ELEMENTS
@@ -88,6 +88,6 @@ trailing_comment = _{ WHITESPACE+ ~ "#" ~ (!NEWLINE ~ ANY)* }
8888
// =============================================================================
8989
// WHITESPACE AND INDENTATION
9090
// =============================================================================
91-
LEADING = { NEWLINE | comment }
91+
LEADING = _{ NEWLINE | comment }
9292
INDENT = _{ (" " | "\t")+ }
9393
WHITESPACE = _{ " " }

src/parser.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,11 @@ name: Simple Test
484484
tape: a
485485
rules:
486486
start:
487-
a -> b, R, halt
487+
a -> b, R, other
488+
489+
other:
490+
b -> c, R, halt
491+
488492
halt:
489493
"#;
490494

0 commit comments

Comments
 (0)