tags
The community/lang/tags
directory contains a collection of files that define tags, actions, and rules for various programming language constructs. These files work together to provide a more natural and efficient way to write code using voice commands.
The directory is organized by concept, with each concept having a corresponding .py
file that defines the actions, and a corresponding .talon
file that defines the voice commands. For example, operators_math.py
defines actions for inserting mathematical operators, and operators_math.talon
defines the voice commands for those actions.
Here's a breakdown of the most important files and how they work together:
comment_block.py
,comment_block.talon
,comment_line.py
,comment_line.talon
,comment_documentation.py
, andcomment_documentation.talon
: These files define commands for inserting various types of comments. The.py
files define actions for inserting block comments, line comments, and documentation comments, while the.talon
files provide the voice commands for these actions. Notably,comment_block.py
defines acode_comment_block_c_like
tag and associated actions that are specific to C-style block comments.operators_*.py
andoperators_*.talon
: These files define commands for inserting operators. There are several pairs of these files, such asoperators_math.py
andoperators_math.talon
,operators_assignment.py
andoperators_assignment.talon
,operators_pointer.py
andoperators_pointer.talon
,operators_array.py
andoperators_array.talon
,operators_lambda.py
andoperators_lambda.talon
, andoperators_bitwise.py
andoperators_bitwise.talon
. Each pair defines actions and voice commands for specific kinds of operators. For example,operators_math
covers mathematical, comparison, and logical operators;operators_assignment
handles assignment and combined assignment operators; andoperators_pointer
defines pointer-related operators. The.talon
files often use thetag(): user.code_operators_math
syntax to enable related tags.data_bool.py
anddata_bool.talon
: These files define commands for inserting boolean values (true
andfalse
). The.py
file defines the actions, and the.talon
file defines the voice commands.data_null.py
anddata_null.talon
: These files define commands for inserting null values and checking for null. The.py
file defines the actions, and the.talon
file defines the voice commands.object_oriented.py
andobject_oriented.talon
: These files provide commands related to object-oriented programming. The.py
file defines actions for object access, self-references, and class definitions. The.talon
file provides the voice commands and uses theuser.code_object_oriented
tag to enable these commands.functions.py
,functions.talon
,functions_common.py
, andfunctions_common.talon
: These files define commands for working with functions.functions.py
defines actions for inserting function declarations with various modifiers and type annotations.functions.talon
defines voice commands for these actions.functions_common.py
andfunctions_common.talon
define a mechanism for selecting and inserting common functions using a GUI, along with corresponding voice commands.functions_common_gui_active.talon
provides a tag to signify that the function picker GUI is currently displayed.imperative.py
andimperative.talon
: These files provide commands for common imperative programming constructs like if, else, for, and while statements.imperative.py
defines the actions, andimperative.talon
defines the voice commands.imperative.py
also defines thecode_block_c_like
tag, which indicates that the language uses C-style code blocks (braces).libraries.py
andlibraries.talon
: These files define commands for importing libraries.libraries.py
defines actions for importing libraries, whilelibraries.talon
defines the voice command for this action and enables theuser.code_libraries
tag.keywords.py
andkeywords.talon
: These files define commands for inserting keywords.keywords.py
defines an action that inserts keywords.keywords.talon
defines the voice command for inserting one or more keywords.
These files demonstrate how Talon's tagging and action system is used to create a rich, extensible, and easily customized programming environment using voice commands. The separation of actions and voice commands allows for flexible customization and language-specific implementations.