commit 97dc1bf1daa1221828bcaeaa24d5f878e626a313
parent 29949b500a8800e7a800f23371cfab72182b8c96
Author: Ben Alpert <spicyjalapeno@gmail.com>
Date: Fri, 5 Jul 2013 21:44:17 -0700
Add \pm, \div
Reviewers: xymostech
Reviewed By: xymostech
Differential Revision: http://phabricator.benalpert.com/D36
Diffstat:
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/MJLite.js b/MJLite.js
@@ -62,11 +62,13 @@ var MJLite = (function() {
};
var charLookup = {
- '*': '\u2217',
- '-': '\u2212',
- 'cdot': '\u22C5',
- 'lvert': '|',
- 'rvert': '|'
+ "*": "\u2217",
+ "-": "\u2212",
+ "cdot": "\u22C5",
+ "lvert": "|",
+ "rvert": "|",
+ "pm": "\u00b1",
+ "div": "\u00f7"
};
var textit = function(value) {
diff --git a/parser.jison b/parser.jison
@@ -9,6 +9,8 @@ cdot return 'CDOT'
frac return 'FRAC'
lvert return 'LVERT'
rvert return 'RVERT'
+pm return 'PM'
+div return 'DIV'
[/|a-zA-Z0-9] return 'ORD'
[*+-] return 'BIN'
\^ return '^'
@@ -66,6 +68,10 @@ group
func
: 'CDOT'
{$$ = [{type: 'bin', value: yytext}];}
+ | 'PM'
+ {$$ = [{type: 'bin', value: yytext}];}
+ | 'DIV'
+ {$$ = [{type: 'bin', value: yytext}];}
| 'FRAC' group group
{$$ = [{type: 'frac', value: {numer: $2, denom: $3}}];}
| 'LVERT'