Skip to content

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, and comment_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 a code_comment_block_c_like tag and associated actions that are specific to C-style block comments.
  • operators_*.py and operators_*.talon: These files define commands for inserting operators. There are several pairs of these files, such as operators_math.py and operators_math.talon, operators_assignment.py and operators_assignment.talon, operators_pointer.py and operators_pointer.talon, operators_array.py and operators_array.talon, operators_lambda.py and operators_lambda.talon, and operators_bitwise.py and operators_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; and operators_pointer defines pointer-related operators. The .talon files often use the tag(): user.code_operators_math syntax to enable related tags.
  • data_bool.py and data_bool.talon: These files define commands for inserting boolean values (true and false). The .py file defines the actions, and the .talon file defines the voice commands.
  • data_null.py and data_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 and object_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 the user.code_object_oriented tag to enable these commands.
  • functions.py, functions.talon, functions_common.py, and functions_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 and functions_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 and imperative.talon: These files provide commands for common imperative programming constructs like if, else, for, and while statements. imperative.py defines the actions, and imperative.talon defines the voice commands. imperative.py also defines the code_block_c_like tag, which indicates that the language uses C-style code blocks (braces).
  • libraries.py and libraries.talon: These files define commands for importing libraries. libraries.py defines actions for importing libraries, while libraries.talon defines the voice command for this action and enables the user.code_libraries tag.
  • keywords.py and keywords.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.