Skip to content

Commit

Permalink
feat: menus, menu doc, keyhint doc
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpombrio committed Apr 13, 2024
1 parent 3491219 commit 235f6e7
Show file tree
Hide file tree
Showing 8 changed files with 475 additions and 239 deletions.
41 changes: 41 additions & 0 deletions data/keyhints_lang.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
LanguageSpec(
name: "Keyhints",
grammar: GrammarSpec(
constructs: [
ConstructSpec(
name: "Root",
arity: Listy(SortSpec(["Entry"])),
),
ConstructSpec(
name: "Entry",
arity: Fixed([SortSpec(["Key"]), SortSpec(["Hint"])]),
),
ConstructSpec(
name: "Key",
arity: Texty,
),
ConstructSpec(
name: "Hint",
arity: Texty,
),
],
sorts: [],
root_construct: "Root",
),
default_display_notation: NotationSetSpec(
name: "DefaultDisplay",
notations: [
("Root", Fold(
first: Child(0),
join: Concat(Left, Concat(Choice(Literal(" "), Newline), Right)),
)),
("Entry", Concat(
Child(0), Concat(
Style(Properties(fg_color: Some(Base04)), Literal(": ")),
Child(1))
)),
("Key", Text),
("Hint", Text),
]
),
)
25 changes: 19 additions & 6 deletions data/selection_lang.ron
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
// TODO: styles

LanguageSpec(
name: "SelectionMenu",
grammar: GrammarSpec(
constructs: [
ConstructSpec(
name: "Root",
arity: Listy(SortSpec(["element"])),
arity: Listy(SortSpec(["entry"])),
),
ConstructSpec(
name: "Input",
arity: Texty,
),
ConstructSpec(
name: "Selected",
arity: Fixed([SortSpec(["candidate"])]),
),
ConstructSpec(
name: "Custom",
arity: Texty,
Expand All @@ -26,7 +28,8 @@ LanguageSpec(
),
],
sorts: [
("element", SortSpec(["Input", "Custom", "Literal", "NonLiteral"]))
("entry", SortSpec(["Input", "Selected", "candidate"])),
("candidate", SortSpec(["Custom", "Literal", "NonLiteral"]))
],
root_construct: "Root",
),
Expand All @@ -37,8 +40,18 @@ LanguageSpec(
first: Child(0),
join: Concat(Left, Concat(Newline, Right)),
)),
("Input", Concat(Literal("> "), Text)),
("Custom", Concat(Literal("[+] "), Text)),
("Input", Concat(
Style(Properties(bold: Some(true), fg_color: Some(Base0C)), Literal("> ")),
Style(Properties(bold: Some(true)), Text))),
("Selected", Style(Properties(
bold: Some(true),
fg_color: Some(Base01),
bg_color: Some(Base0A),
priority: High,
), Child(0))),
("Custom", Concat(
Style(Properties(fg_color: Some(Base0B)), Literal("[+] ")),
Text)),
("Literal", Text),
("NonLiteral", Text),
]
Expand Down
Loading

0 comments on commit 235f6e7

Please sign in to comment.