Skip to content

Commit

Permalink
re-implement decrement operator
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnicollo committed Jan 31, 2025
1 parent f496f37 commit b8b3d7e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lang/c/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def code_operator_modulo_assignment():

# chrisnicollo EDIT START: adding increment and decrement operators
def code_operator_increment():
actions.auto_insert('++')
actions.auto_insert('++')

def code_operator_decrement():
actions.auto_insert('--')
# chrisnicollo EDIT END
Expand Down
3 changes: 3 additions & 0 deletions lang/tags/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Operators(TypedDict, total=False):
ASSIGNMENT_DIVISION: Operator
ASSIGNMENT_MODULO: Operator
ASSIGNMENT_INCREMENT: Operator
ASSIGNMENT_DECREMENT: Operator # chrisnicollo EDIT: Add decrement operator to code operators list
ASSIGNMENT_BITWISE_AND: Operator
ASSIGNMENT_BITWISE_OR: Operator
ASSIGNMENT_BITWISE_EXCLUSIVE_OR: Operator
Expand Down Expand Up @@ -127,6 +128,8 @@ def operators_fallback(identifier: str) -> None:
actions.user.code_operator_modulo_assignment()
case "ASSIGNMENT_INCREMENT":
actions.user.code_operator_increment()
case "ASSIGNMENT_DECREMENT": # chrisnicollo EDIT: Add legacy action for decrement operator
actions.user.code_operator_decrement() # chrisnicollo EDIT
case "ASSIGNMENT_BITWISE_AND":
actions.user.code_operator_bitwise_and_assignment()
case "ASSIGNMENT_BITWISE_OR":
Expand Down
2 changes: 2 additions & 0 deletions lang/tags/operators_assignment.talon-list
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ times equals: ASSIGNMENT_MULTIPLICATION
divide equals: ASSIGNMENT_DIVISION
mod equals: ASSIGNMENT_MODULO
increment: ASSIGNMENT_INCREMENT
# chrisnicollo EDIT: Add spoken form of decrement function
decrement: ASSIGNMENT_DECREMENT

# Bitwise operators
bitwise and equals: ASSIGNMENT_BITWISE_AND
Expand Down

0 comments on commit b8b3d7e

Please sign in to comment.