Clean up some keywords + mobile view

This commit is contained in:
Linus Lee 2020-09-24 08:22:22 -04:00
parent e6797461f8
commit 342fd2e8d6
3 changed files with 18 additions and 14 deletions

View File

@ -178,7 +178,6 @@ textarea.editor-input {
textarea.editor-input:focus { textarea.editor-input:focus {
outline: none; outline: none;
background: #f8f8f8;
} }
.filler p { .filler p {
@ -227,4 +226,7 @@ footer a {
textarea.editor-input { textarea.editor-input {
font-size: .8em; font-size: .8em;
} }
.desktop {
display: none;
}
} }

View File

@ -103,7 +103,7 @@ const T = {
DiscoverHowTo: Symbol('DiscoverHowTo'), DiscoverHowTo: Symbol('DiscoverHowTo'),
With: Symbol('With'), With: Symbol('With'),
Of: Symbol('Of'), Of: Symbol('Of'),
WeSaid: Symbol('WeSaid'), RumorHasIt: Symbol('RumorHasIt'),
WhatIf: Symbol('WhatIf'), WhatIf: Symbol('WhatIf'),
LiesBang: Symbol('LiesBang'), LiesBang: Symbol('LiesBang'),
EndOfStory: Symbol('EndOfStory'), EndOfStory: Symbol('EndOfStory'),
@ -160,9 +160,10 @@ function tokenize(prog) {
tokens.push(T.Of); tokens.push(T.Of);
break; break;
} }
case 'WE': { case 'RUMOR': {
reader.expect('SAID'); reader.expect('HAS');
tokens.push(T.WeSaid); reader.expect('IT');
tokens.push(T.RumorHasIt);
break; break;
} }
case 'WHAT': { case 'WHAT': {
@ -409,7 +410,7 @@ class Parser {
body: this.expr(), body: this.expr(),
} }
} }
} else if (next === T.WeSaid) { } else if (next === T.RumorHasIt) {
// block // block
const exprs = []; const exprs = [];
while (this.tokens.hasNext() && this.tokens.peek() !== T.EndOfStory) { while (this.tokens.hasNext() && this.tokens.peek() !== T.EndOfStory) {

View File

@ -1,7 +1,7 @@
const PROG_FACTORIAL = `YOU WON'T WANT TO MISS 'Hello, World!' const PROG_FACTORIAL = `YOU WON'T WANT TO MISS 'Hello, World!'
DISCOVER HOW TO factorial WITH n DISCOVER HOW TO factorial WITH n
WE SAID RUMOR HAS IT
WHAT IF n IS ACTUALLY 0 WHAT IF n IS ACTUALLY 0
SHOCKING DEVELOPMENT 1 SHOCKING DEVELOPMENT 1
LIES! LIES!
@ -16,10 +16,10 @@ YOU WON'T WANT TO MISS result
PLEASE LIKE AND SUBSCRIBE`; PLEASE LIKE AND SUBSCRIBE`;
const PROG_FIBONACCI = `DISCOVER HOW TO fibonacci WITH a, b, n const PROG_FIBONACCI = `DISCOVER HOW TO fibonacci WITH a, b, n
WE SAID RUMOR HAS IT
WHAT IF n SMALLER THAN 1 WHAT IF n SMALLER THAN 1
SHOCKING DEVELOPMENT b SHOCKING DEVELOPMENT b
LIES! WE SAID LIES! RUMOR HAS IT
YOU WON'T WANT TO MISS b YOU WON'T WANT TO MISS b
SHOCKING DEVELOPMENT SHOCKING DEVELOPMENT
fibonacci OF b, a PLUS b, n MINUS 1 fibonacci OF b, a PLUS b, n MINUS 1
@ -109,11 +109,11 @@ class Editor extends Component {
return jdom`<div class="editor fixed block"> return jdom`<div class="editor fixed block">
<div class="controls"> <div class="controls">
<button class="block" <button class="block"
onclick=${this.setFibonacci}>Fibonacci sample</button> onclick=${this.setFibonacci}>Fibonacci <span class="desktop">sample</span></button>
<button class="block" <button class="block"
onclick=${this.setFactorial}>Factorial sample</button> onclick=${this.setFactorial}>Factorial <span class="desktop">sample</span></button>
<button class="accent block" <button class="accent block"
onclick=${this.handleRun}>Run this!</button> onclick=${this.handleRun}>Run<span class="desktop"> this</span>!</button>
</div> </div>
<div class="code"> <div class="code">
<div class="filler"> <div class="filler">
@ -231,10 +231,10 @@ class App extends Component {
target="_blank">Ink</a>. target="_blank">Ink</a>.
</p> </p>
<h2>How much is there?</h2> <h2>How much is there?</h2>
<p>Here's the full list of non-standard keywords that Tabloid currently uses:</p> <p>Here's the full list of standard keywords that Tabloid currently uses:</p>
<ul> <ul>
<li><code class="inline fixed block">DISCOVER HOW TO...WITH</code> declare a function</li> <li><code class="inline fixed block">DISCOVER HOW TO...WITH</code> declare a function</li>
<li><code class="inline fixed block">WE SAID</code> begin a block scope</li> <li><code class="inline fixed block">RUMOR HAS IT</code> begin a block scope</li>
<li><code class="inline fixed block">A OF B, C</code> call function A with arguments B, C</li> <li><code class="inline fixed block">A OF B, C</code> call function A with arguments B, C</li>
<li><code class="inline fixed block">WHAT IF...LIES!</code> an if-else expression</li> <li><code class="inline fixed block">WHAT IF...LIES!</code> an if-else expression</li>
<li><code class="inline fixed block">END OF STORY</code> end a block scope</li> <li><code class="inline fixed block">END OF STORY</code> end a block scope</li>
@ -243,6 +243,7 @@ class App extends Component {
<li><code class="inline fixed block">TOTALLY RIGHT</code> true</li> <li><code class="inline fixed block">TOTALLY RIGHT</code> true</li>
<li><code class="inline fixed block">COMPLETELY WRONG</code> false</li> <li><code class="inline fixed block">COMPLETELY WRONG</code> false</li>
<li><code class="inline fixed block">PLUS / MINUS / TIMES / DIVIDED BY / MODULO</code> the obvious arithmetic operations</li> <li><code class="inline fixed block">PLUS / MINUS / TIMES / DIVIDED BY / MODULO</code> the obvious arithmetic operations</li>
<li><code class="inline fixed block">BEATS / SMALLER THAN</code> greater than / less than</li>
<li><code class="inline fixed block">IS ACTUALLY</code> is equal to</li> <li><code class="inline fixed block">IS ACTUALLY</code> is equal to</li>
<li><code class="inline fixed block">BEATS / SMALLER THAN</code> greater than / less than</li> <li><code class="inline fixed block">BEATS / SMALLER THAN</code> greater than / less than</li>
<li><code class="inline fixed block">SHOCKING DEVELOPMENT</code> return from a function</li> <li><code class="inline fixed block">SHOCKING DEVELOPMENT</code> return from a function</li>