diff options
Diffstat (limited to '')
-rw-r--r-- | src/parser.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 5bb0aa6..df9e869 100644 --- a/src/parser.cpp +++ b/src/parser.cpp | |||
@@ -239,6 +239,18 @@ void Parser::unwind() | |||
239 | ); | 239 | ); |
240 | } | 240 | } |
241 | break; | 241 | break; |
242 | |||
243 | case Token::tModulus: | ||
244 | { | ||
245 | Token b = tsTerminal.peekPop(); | ||
246 | Token a = tsTerminal.peekPop(); | ||
247 | tsTerminal.push( | ||
248 | Token( Token::tNumber, | ||
249 | new Number( deref(a) % deref(b) ) | ||
250 | ) | ||
251 | ); | ||
252 | } | ||
253 | break; | ||
242 | 254 | ||
243 | case Token::tOpenParen: | 255 | case Token::tOpenParen: |
244 | tsNonTerminal.push( t ); | 256 | tsNonTerminal.push( t ); |
@@ -296,6 +308,7 @@ int Parser::reqTokens( Token::Type eType ) | |||
296 | case Token::tMinus: | 308 | case Token::tMinus: |
297 | case Token::tDivide: | 309 | case Token::tDivide: |
298 | case Token::tMultiply: | 310 | case Token::tMultiply: |
311 | case Token::tModulus: | ||
299 | case Token::tEquals: | 312 | case Token::tEquals: |
300 | return 2; | 313 | return 2; |
301 | 314 | ||
@@ -326,6 +339,7 @@ int Parser::getPriority( Token::Type eType ) | |||
326 | 339 | ||
327 | case Token::tDivide: | 340 | case Token::tDivide: |
328 | case Token::tMultiply: | 341 | case Token::tMultiply: |
342 | case Token::tModulus: | ||
329 | return 2; | 343 | return 2; |
330 | 344 | ||
331 | case Token::tOpenParen: | 345 | case Token::tOpenParen: |