diff options
Diffstat (limited to 'source/compiler/aslcstyle.y')
-rw-r--r-- | source/compiler/aslcstyle.y | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/source/compiler/aslcstyle.y b/source/compiler/aslcstyle.y index f510b8714..305d60d88 100644 --- a/source/compiler/aslcstyle.y +++ b/source/compiler/aslcstyle.y @@ -154,6 +154,13 @@ NoEcho(' * 13) = += -= *= /= %= <<= >>= &= ^= |= */ + +/******************************************************************************* + * + * Basic operations for math and logical expressions. + * + ******************************************************************************/ + Expression /* Unary operators */ @@ -212,33 +219,43 @@ Expression | TermArg PARSEOP_EXP_LOGICAL_OR {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} TermArg {$$ = TrLinkChildren ($<n>3,2,$1,$4);} - /* Parentheses */ + /* Parentheses */ | '(' TermArg ')' { $$ = $2;} - /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ + /* Index term -- "= BUF1[5]" on right-hand side of an equals (source) */ - | SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT - {$$ = TrCreateLeafNode (PARSEOP_INDEX); + | SuperName PARSEOP_EXP_INDEX_LEFT + TermArg PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafNode (PARSEOP_INDEX); TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} ; - /* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */ + /* Index term -- "BUF1[5] = " on left-hand side of an equals (target) */ IndexExpTerm - : SuperName PARSEOP_EXP_INDEX_LEFT TermArg PARSEOP_EXP_INDEX_RIGHT - {$$ = TrCreateLeafNode (PARSEOP_INDEX); + : SuperName PARSEOP_EXP_INDEX_LEFT + TermArg PARSEOP_EXP_INDEX_RIGHT {$$ = TrCreateLeafNode (PARSEOP_INDEX); TrLinkChildren ($$,3,$1,$3,TrCreateNullTarget ());} ; + +/******************************************************************************* + * + * All assignment-type operations -- math and logical. Includes simple + * assignment and compound assignments. + * + ******************************************************************************/ + EqualsTerm - /* All assignment-type operations */ + /* Simple Store() operation */ : SuperName PARSEOP_EXP_EQUALS TermArg {$$ = TrCreateAssignmentNode ($1, $3);} + /* Compound assignments -- Add (operand, operand, target) */ + | TermArg PARSEOP_EXP_ADD_EQ {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} TermArg {$$ = TrLinkChildren ($<n>3,3,$1,$4, TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} |