-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: GoxScript - Implement parser and adds documentations
- Loading branch information
Showing
5 changed files
with
1,055 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ mod config; | |
mod hotkey; | ||
mod input; | ||
mod platform; | ||
mod scripting; | ||
mod ui; | ||
|
||
use std::thread; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/// This module, `parser`, is built for the goxscript language. | ||
/// It parses the goxscript language and returns an AST which can be used to | ||
/// generate the corresponding vi-rs rule map. | ||
/// | ||
/// # Example | ||
/// The script would look like this: | ||
/// | ||
/// ``` | ||
/// import telex | ||
/// import vni | ||
/// | ||
/// on s or ': add_tone(acute) end | ||
/// | ||
/// on a or e or o or 6: | ||
/// letter_mod(circumflex for a or e or o) | ||
/// end | ||
/// | ||
/// on w or 7 or 8: | ||
/// reset_inserted_uw() or | ||
/// letter_mod(horn or breve for u or o) or | ||
/// insert_uw() | ||
/// end | ||
/// ``` | ||
/// | ||
/// # Syntax | ||
/// The following EBNF describes the syntax of the goxscript language: | ||
/// | ||
/// ```ebnf | ||
/// <program> ::= <import_list>? <whitespace> <block_list>? | ||
/// | ||
/// <import_list> ::= <import> ( <whitespace> <import_list> )? | ||
/// <import> ::= "import" <whitespace> <identifier> | ||
/// | ||
/// <block_list> ::= <block> ( <whitespace> <block_list> )? | ||
/// <block> ::= "on" <whitespace> <key_list> <whitespace> ":" <whitespace> <function_call_list> <whitespace> "end" | ||
/// | ||
/// <function_call_list> ::= <function_call> ( <whitespace> "or" <whitespace> <function_call_list> )? | ||
/// <function_call> ::= <identifier> "(" ( <identifier_list> ( <whitespace> "for" <whitespace> <key_list> )? )? ")" | ||
/// | ||
/// <identifier_list> ::= <identifier> ( <whitespace> "or" <whitespace> <identifier_list> )? | ||
/// <identifier> ::= (<upper_letter> | <lower_letter> | <digit> | "_")+ | ||
/// | ||
/// <key_list> ::= <key> ( <whitespace> "or" <whitespace> <key_list> )? | ||
/// <key> ::= <any_character> | ||
/// | ||
/// <whitespace> ::= (" " | "\n")* | ||
/// <any_character> ::= <upper_letter> | <lower_letter> | <digit> | <punctuation> | ||
/// <upper_letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | | ||
/// "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | ||
/// <lower_letter> ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | | ||
/// "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | ||
/// <digit> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | ||
/// <punctuation> ::= "!" | "\"" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | | ||
/// ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "\\" | "]" | "^" | "_" | "`" | "{" | "}" | "~" | ||
/// ``` | ||
pub mod parser; |
Oops, something went wrong.