Add punctuation
Summary: Add punctuation, like ",", ";", and "\colon" Reviewers: spicyj Reviewed By: spicyj Differential Revision: http://phabricator.benalpert.com/D49
This commit is contained in:
parent
66a43f551d
commit
a0eff74be3
|
@ -86,6 +86,8 @@ var buildGroup = function(group, prev) {
|
||||||
} else if (group.type === "rlap") {
|
} else if (group.type === "rlap") {
|
||||||
var inner = makeSpan("", buildExpression(group.value));
|
var inner = makeSpan("", buildExpression(group.value));
|
||||||
return makeSpan("rlap", inner);
|
return makeSpan("rlap", inner);
|
||||||
|
} else if (group.type === "punct") {
|
||||||
|
return makeSpan("mpunct", textit(group.value));
|
||||||
} else {
|
} else {
|
||||||
console.log("Unknown type:", group.type);
|
console.log("Unknown type:", group.type);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +107,8 @@ var charLookup = {
|
||||||
"\\nleq": "\u2270",
|
"\\nleq": "\u2270",
|
||||||
"\\ngeq": "\u2271",
|
"\\ngeq": "\u2271",
|
||||||
"\\ ": "\u00a0",
|
"\\ ": "\u00a0",
|
||||||
"\\space": "\u00a0"
|
"\\space": "\u00a0",
|
||||||
|
"\\colon": ":"
|
||||||
};
|
};
|
||||||
|
|
||||||
var textit = function(value) {
|
var textit = function(value) {
|
||||||
|
|
3
lexer.js
3
lexer.js
|
@ -5,6 +5,7 @@ var normals = [
|
||||||
[/^[/|a-zA-Z0-9.]/, 'ORD'],
|
[/^[/|a-zA-Z0-9.]/, 'ORD'],
|
||||||
[/^[*+-]/, 'BIN'],
|
[/^[*+-]/, 'BIN'],
|
||||||
[/^[=<>]/, 'REL'],
|
[/^[=<>]/, 'REL'],
|
||||||
|
[/^[,;]/, 'PUNCT'],
|
||||||
[/^\^/, '^'],
|
[/^\^/, '^'],
|
||||||
[/^_/, '_'],
|
[/^_/, '_'],
|
||||||
[/^{/, '{'],
|
[/^{/, '{'],
|
||||||
|
@ -20,6 +21,8 @@ var funcs = [
|
||||||
'leq', 'geq', 'neq', 'nleq', 'ngeq',
|
'leq', 'geq', 'neq', 'nleq', 'ngeq',
|
||||||
// Open/close symbols
|
// Open/close symbols
|
||||||
'lvert', 'rvert',
|
'lvert', 'rvert',
|
||||||
|
// Punct symbols
|
||||||
|
'colon',
|
||||||
// Spacing symbols
|
// Spacing symbols
|
||||||
'qquad', 'quad', ' ', 'space', ',', ':', ';',
|
'qquad', 'quad', ' ', 'space', ',', ':', ';',
|
||||||
// Colors
|
// Colors
|
||||||
|
|
|
@ -74,6 +74,8 @@ func
|
||||||
{$$ = [{type: 'spacing', value: yytext}];}
|
{$$ = [{type: 'spacing', value: yytext}];}
|
||||||
| ';'
|
| ';'
|
||||||
{$$ = [{type: 'spacing', value: yytext}];}
|
{$$ = [{type: 'spacing', value: yytext}];}
|
||||||
|
| 'colon'
|
||||||
|
{$$ = [{type: 'punct', value: yytext}];}
|
||||||
| 'blue' group
|
| 'blue' group
|
||||||
{$$ = [{type: 'color', value: {color: 'blue', value: $2}}];}
|
{$$ = [{type: 'color', value: {color: 'blue', value: $2}}];}
|
||||||
| 'orange' group
|
| 'orange' group
|
||||||
|
@ -103,6 +105,8 @@ atom
|
||||||
{$$ = [{type: 'bin', value: yytext}];}
|
{$$ = [{type: 'bin', value: yytext}];}
|
||||||
| 'REL'
|
| 'REL'
|
||||||
{$$ = [{type: 'rel', value: yytext}];}
|
{$$ = [{type: 'rel', value: yytext}];}
|
||||||
|
| 'PUNCT'
|
||||||
|
{$$ = [{type: 'punct', value: yytext}];}
|
||||||
| 'OPEN'
|
| 'OPEN'
|
||||||
{$$ = [{type: 'open', value: yytext}];}
|
{$$ = [{type: 'open', value: yytext}];}
|
||||||
| 'CLOSE'
|
| 'CLOSE'
|
||||||
|
|
|
@ -56,6 +56,30 @@ big parens
|
||||||
margin-left: 0.27778em;
|
margin-left: 0.27778em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mpunct + .mord {
|
||||||
|
margin-left: 0.16667em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpunct + .mbin {
|
||||||
|
margin-left: 0.16667em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpunct + .mrel {
|
||||||
|
margin-left: 0.16667em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpunct + .mopen {
|
||||||
|
margin-left: 0.16667em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpunct + .mclose {
|
||||||
|
margin-left: 0.16667em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mpunct + .mpunct {
|
||||||
|
margin-left: 0.16667em;
|
||||||
|
}
|
||||||
|
|
||||||
.msub {
|
.msub {
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
font-size: 70%;
|
font-size: 70%;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user