feat: grammar for lex string

This commit is contained in:
Araozu 2024-11-27 20:07:27 -05:00
parent cc565982a7
commit c38eae1eeb
2 changed files with 28 additions and 33 deletions

View File

@ -52,9 +52,7 @@ const posts_2 = posts
// being `/spec/ast/tokens` would be `/ast/tokens` // being `/spec/ast/tokens` would be `/ast/tokens`
path: post.url.substring(base_len), path: post.url.substring(base_len),
})) }))
.sort((p1, p2) => .sort((p1, p2) => (p1.frontmatter.order > p2.frontmatter.order ? 1 : -1));
p1.frontmatter.order > p2.frontmatter.order ? 1 : -1,
);
// build a hierarchy of the files // build a hierarchy of the files
const second_level: Record<string, Array<AstroFile>> = { const second_level: Record<string, Array<AstroFile>> = {
@ -129,20 +127,13 @@ const rc = url_components[1] ?? "";
class="pt-12 h-screen lg:sticky top-0 fixed z-10 bg-c-bg w-60 lg:w-auto border-r-2 lg:border-0 class="pt-12 h-screen lg:sticky top-0 fixed z-10 bg-c-bg w-60 lg:w-auto border-r-2 lg:border-0
border-c-border-1 -translate-x-64 lg:translate-x-0 transition-transform" border-c-border-1 -translate-x-64 lg:translate-x-0 transition-transform"
> >
<nav <nav class="py-4 pr-2 overflow-x-scroll h-[calc(100vh-3rem)]">
class="py-4 pr-2 overflow-x-scroll h-[calc(100vh-3rem)]" <div class="mb-2 relative" x-data="{open: false}">
>
<div
class="mb-2 relative"
x-data="{open: false}"
>
<button <button
class="bg-c-bg text-c-text border border-c-primary rounded px-3 w-full font-mono mt-2 flex items-center hover:dark:bg-zinc-800 transition-colors cursor-pointer text-left" class="bg-c-bg text-c-text border border-c-primary rounded px-3 w-full font-mono mt-2 flex items-center hover:dark:bg-zinc-800 transition-colors cursor-pointer text-left"
@click="open = !open" @click="open = !open"
> >
<span <span class="inline-block w-full">
class="inline-block w-full"
>
{version} {version}
</span> </span>
<svg <svg
@ -166,18 +157,14 @@ const rc = url_components[1] ?? "";
class="absolute top-0 w-full bg-c-bg border border-c-primary rounded" class="absolute top-0 w-full bg-c-bg border border-c-primary rounded"
> >
{ {
versions.map( versions.map((x) => (
(x) => ( <a
<a class="px-3 py-1 hover:dark:bg-zinc-800 transition-colors font-mono inline-block w-full text-left"
class="px-3 py-1 hover:dark:bg-zinc-800 transition-colors font-mono inline-block w-full text-left" href={`${lc}${x}${rc}`}
href={`${lc}${x}${rc}`} >
> {x}
{ </a>
x ))
}
</a>
),
)
} }
</div> </div>
</div> </div>
@ -185,11 +172,7 @@ const rc = url_components[1] ?? "";
<hr class="my-6" /> <hr class="my-6" />
{ {entries.map((entry) => <Sidebar entry={entry} />)}
entries.map((entry) => (
<Sidebar entry={entry} />
))
}
</nav> </nav>
</div> </div>
@ -203,9 +186,7 @@ const rc = url_components[1] ?? "";
class="lg:pt-12 hidden lg:block pt-4 max-h-screen overflow-x-scroll sticky top-0" class="lg:pt-12 hidden lg:block pt-4 max-h-screen overflow-x-scroll sticky top-0"
> >
<nav class="rounded-md lg:mt-10"> <nav class="rounded-md lg:mt-10">
<h2 <h2 class="font-display font-medium pb-2 text-c-text-2">
class="font-display font-medium pb-2 text-c-text-2"
>
On this page On this page
</h2> </h2>

View File

@ -264,4 +264,18 @@ Operator = operator_char+
At this time, only single line comments are allowed. At this time, only single line comments are allowed.
## Strings
Strings in THP only use double quotes.
As of the writing of this page, an escape character is a backslash followed
by any byte, except newline.
```ebnf
String = double_quote, (escape_seq | string_char)*, double_quote
escape_seq = backslash, any_except_newline
double_quote = '"'
string_char = any_except_newline_and_double_quote
```