| def emitErrorMessage(self, msg): |
| self.reportedErrors.append(msg) |
| evaluate returns [result]: r=expression {result = r}; |
| expression returns [result]: r=mult ( |
| mult returns [result]: r=log ( |
| // | '%' r2=log {r %= r2} |
| log returns [result]: 'ln' r=exp {result = math.log(r)} |
| exp returns [result]: r=atom ('^' r2=atom {r = math.pow(r,r2)} )? {result = r} |
| n=INTEGER {result = int($n.text)} |
| | n=DECIMAL {result = float($n.text)} |
| | '(' r=expression {result = r} ')' |
| | 'PI' {result = math.pi} |
| DECIMAL: DIGIT+ '.' DIGIT+; |
| WS: (' ' | '\n' | '\t')+ {$channel = HIDDEN}; |