Last active
July 20, 2018 10:07
-
-
Save breeko/866b3be771796c9ef402f8d0fd8bf07f to your computer and use it in GitHub Desktop.
Operation Types and SubTypes for OpenCalc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //@flow | |
| export const OperationType = Object.freeze({ | |
| 'Constant': 1, // a constant value (e.g. 2, 5, pi) | |
| 'Operation': 2, // can be calculated based on inputs (e.g. cos, +, !) | |
| 'Equals': 3, // clears and evaluates the queue | |
| 'Clear': 4, // clears the queue | |
| 'Parenthesis': 5, // parenthesis | |
| }); | |
| export const OperationSubType = Object.freeze({ | |
| 'Constant': 1, // a constant value (e.g. 2, 5, pi) | |
| 'UnaryOp': 2, // single input to the right of it (e.g. sqrt, cos,log) | |
| 'BackwardUnaryOp': 3, // single input to the left of it (e.g. !, %) | |
| 'BinaryOp': 4, // two inputs to the left and right (e.g. +, -, /) | |
| 'Equals': 5, // clears and evaluates the queue | |
| 'Clear': 6, // clears the queue | |
| 'ParenthesisClose': 7, // closed parenthesis | |
| 'ParenthesisOpen': 8, // open parenthesis | |
| }); | |
| export const OperationArgs = Object.freeze({ | |
| 'Cleared': 1, // indicates queue has just been cleared | |
| 'PrintAlone': 2, // displays in the evaluation even if alone; used for pi and e | |
| 'PrintAsString': 3, // displays as string in the display; used for pi and e | |
| 'NotParseable': 4, // constant cannot be parsed (e.g. if pi is followed by 1, 1 should not be appended to pi) | |
| 'AddParenthesis': 5, // an open parenthesis operation should be added after; used for binary ops | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment