Annotation of loncom/html/adm/LC_math_editor/src/operator.js, revision 1.2
1.1 damieng 1: /*
2:
3: Copyright (C) 2014 Michigan State University Board of Trustees
4:
5: The JavaScript code in this page is free software: you can
6: redistribute it and/or modify it under the terms of the GNU
7: General Public License (GNU GPL) as published by the Free Software
8: Foundation, either version 3 of the License, or (at your option)
9: any later version. The code is distributed WITHOUT ANY WARRANTY;
10: without even the implied warranty of MERCHANTABILITY or FITNESS
11: FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
12:
13: As additional permission under GNU GPL version 3 section 7, you
14: may distribute non-source (e.g., minimized or compacted) forms of
15: that code without the copy of the GNU GPL normally required by
16: section 4, provided you include this license notice and a URL
17: through which recipients can access the Corresponding Source.
18:
19: */
20:
1.2 ! damieng 21: "use strict";
! 22:
1.1 damieng 23: /**
24: * Null denotation function
25: * @callback nudFunction
26: * @param {Parser} p - the parser
27: * @returns {ENode}
28: */
29:
30: /**
31: * Left denotation function
32: * @callback ledFunction
33: * @param {Parser} p - the parser
34: * @param {ENode} left - left node
35: * @returns {ENode}
36: */
37:
38: /**
39: * Parser operator, like "(".
40: * @constructor
41: * @param {string} id - Characters used to recognize the operator
42: * @param {number} arity (UNKNOWN, UNARY, BINARY, TERNARY)
43: * @param {number} lbp - left binding power
44: * @param {number} rbp - right binding power
45: * @param {nudFunction} nud - Null denotation function
46: * @param {ledFunction} led - Left denotation function
47: */
48: function Operator(id, arity, lbp, rbp, nud, led) {
49: this.id = id;
50: this.arity = arity;
51: this.lbp = lbp;
52: this.rbp = rbp;
53: this.nud = nud;
54: this.led = led;
55: }
56:
57: Operator.UNKNOWN = 0;
58: Operator.UNARY = 1;
59: Operator.BINARY = 2;
60: Operator.TERNARY = 3;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>