|
1 | 1 | # ============================================================================= |
2 | | -# TVKL GRAMMAR SPECIFICATION |
3 | | -# |
4 | | -# This document defines the formal EBNF for the Terminal Virtual Keyboard Layout. |
5 | | -# |
6 | | -# SYMBOLS: |
7 | | -# ::= Production |
8 | | -# | Alternation (OR) |
9 | | -# [] Optional (0 or 1) |
10 | | -# {}* Zero or more repetitions |
11 | | -# {}+ One or more repetitions |
12 | | -# "" Literal string |
| 2 | +# TVKL — Terminal Virtual Keyboard Layout |
| 3 | +# ============================================================================= |
| 4 | +# |
| 5 | +# ----------------------------------------------------------------------------- |
| 6 | +# SYMBOL LEGEND (EBNF META-SYNTAX) |
| 7 | +# ----------------------------------------------------------------------------- |
| 8 | +# |
| 9 | +# ::= Production rule definition |
| 10 | +# | Alternation (logical OR) |
| 11 | +# {} Zero or more repetitions |
| 12 | +# [] Optional (0 or 1 occurrence) |
| 13 | +# "" Literal terminal string |
| 14 | +# |
| 15 | +# ============================================================================= |
| 16 | +# FORMAL GRAMMAR |
13 | 17 | # ============================================================================= |
14 | 18 |
|
15 | | -tvkl ::= declaration* EOF |
16 | | -declaration ::= assign | line* |
17 | | -assign ::= ident "=" value |
18 | | -ident ::= "#" name |
19 | | -value ::= number | rgb |
20 | | -rgb ::= "rgb(" num "," num "," num ")" |
21 | | -line ::= ":" "|" { item (, item)* "|" }* "-" |
22 | | -item ::= ( quoted_name | name ) [ attr_decl ] |
23 | | -quoted_name ::= ( "'" name "'" ) | ( '"' name '"' ) |
24 | | -attr_decl ::= "[" { attr }+ "]" |
| 19 | +tvkl ::= { declaration } EOF ; |
| 20 | +declaration ::= assign |
| 21 | + | line ; |
| 22 | +assign ::= ident "=" value ; |
| 23 | +ident ::= "#" name ; |
| 24 | +value ::= number |
| 25 | + | color ; |
| 26 | +color ::= "@" "(" number "," number "," number ")" ; |
| 27 | +line ::= ":" "|" { item "|" } "-" ; |
| 28 | +item ::= key_name [ attr_decl ] ; |
| 29 | +key_name ::= quoted_name |
| 30 | + | name ; |
| 31 | +quoted_name ::= "'" name "'" |
| 32 | + | '"' name '"' ; |
| 33 | +attr_decl ::= "[" attr { "," attr } "]" ; |
25 | 34 | attr ::= number |
26 | | -name ::= { ? any character ? }+ ; |
27 | | -number ::= "$" num |
28 | | -num ::= [0-9]+ |
29 | | - |
| 35 | +name ::= name_char { name_char } ; |
| 36 | +name_char ::= ? any character except whitespace, |
| 37 | +number ::= "$" num ; |
| 38 | +num ::= digit { digit } ; |
| 39 | +digit ::= "0" | "1" | "2" | "3" | "4" |
| 40 | + | "5" | "6" | "7" | "8" | "9" ; |
0 commit comments