Skip to content

php

The community/lang/php directory contains files to support the PHP programming language in Talon.

The file php.py defines a Talon context for PHP. This file contains a variety of actions to make coding in PHP easier with voice commands. These include:

  • Inserting keywords and common code constructs, such as class, use, if, else, while, for, foreach, switch, case, do, goto, and return.
  • Inserting comments, including line comments, block comments, and documentation comments.
  • Inserting common operators, such as ->, =, +, -, *, /, %, ===, !==, >, >=, <, <=, &&, and ||.
  • Inserting boolean (true, false) and null (null) values.
  • Inserting functions to check null (is_null(), isset())
  • Defining public, private, and protected functions.
  • Defining public, private, and protected static functions.
  • Inserting return types into function declarations.

The file php.talon defines the Talon grammar and settings for PHP. This file includes:

  • Tagging the context with several useful tags: user.code_imperative, user.code_object_oriented, user.code_libraries, user.code_block_c_like, user.code_comment_line, user.code_comment_block, user.code_comment_documentation, user.code_data_bool, user.code_data_null, user.code_operators_assignment, user.code_operators_math, and user.code_functions.
  • Setting formatters for private, protected, and public functions and variables to PRIVATE_CAMEL_CASE.
  • Defining phrases to insert loose equality and loose inequality operators (== and !=).
  • Defining phrases to insert try and catch blocks.
  • Defining a phrase to insert a variable with a leading $.