diff --git a/sjscript/src/sjscript/parse.d b/sjscript/src/sjscript/parse.d index a44ee05..9435c4a 100644 --- a/sjscript/src/sjscript/parse.d +++ b/sjscript/src/sjscript/parse.d @@ -120,6 +120,10 @@ private class RuleSet { static Expression ParseExpressionFromFirstTerm(Term term) { return Expression([term]); } + static Expression ParseExpressionFromFirstNegativeTerm( + @(TokenType.Sub) Token, Term term) { + return Expression([term * -1f]); + } static Expression ParseExpressionFromFollowingAddedTerm( Expression expr, @(TokenType.Add) Token, Term term) { return expr + term; diff --git a/sjscript/test/test02.sj b/sjscript/test/test02.sj index 27df68e..a070c12 100644 --- a/sjscript/test/test02.sj +++ b/sjscript/test/test02.sj @@ -2,6 +2,6 @@ $define beat {0} $repeat i 100 { A [$i*5+$beat..($i+1)*5+$beat] { - damage = 1; + damage = -1; } }