2014-12-03 02:02:48 +00:00
|
|
|
import _ from 'lodash';
|
|
|
|
|
2014-12-17 16:53:04 +00:00
|
|
|
export default {
|
2014-12-07 20:26:45 +00:00
|
|
|
type: 'escape',
|
|
|
|
|
2014-12-11 00:01:57 +00:00
|
|
|
_render() {
|
2014-12-17 19:44:48 +00:00
|
|
|
return this.renderLabel(_.result(this, this.code))
|
2014-12-13 18:42:55 +00:00
|
|
|
.then(label => {
|
|
|
|
label.select('rect').attr({
|
|
|
|
rx: 3,
|
|
|
|
ry: 3
|
|
|
|
});
|
2014-12-11 00:23:14 +00:00
|
|
|
});
|
2014-12-09 22:43:05 +00:00
|
|
|
},
|
|
|
|
|
2014-12-17 19:44:48 +00:00
|
|
|
setup() {
|
|
|
|
this.code = this.properties.esc.properties.code.textValue;
|
|
|
|
this.arg = this.properties.esc.properties.arg.textValue;
|
|
|
|
},
|
|
|
|
|
2014-12-09 22:43:05 +00:00
|
|
|
// Escape code mappings
|
|
|
|
b: 'word boundary',
|
|
|
|
B: 'non-word boundary',
|
|
|
|
d: 'digit',
|
|
|
|
D: 'non-digit',
|
|
|
|
f: 'form feed',
|
|
|
|
n: 'line feed',
|
|
|
|
r: 'carriage return',
|
|
|
|
s: 'white space',
|
|
|
|
S: 'non-white space',
|
|
|
|
t: 'tab',
|
|
|
|
v: 'vertical tab',
|
|
|
|
w: 'word',
|
|
|
|
W: 'non-word',
|
|
|
|
1: 'Back reference (group = 1)',
|
|
|
|
2: 'Back reference (group = 2)',
|
|
|
|
3: 'Back reference (group = 3)',
|
|
|
|
4: 'Back reference (group = 4)',
|
|
|
|
5: 'Back reference (group = 5)',
|
|
|
|
6: 'Back reference (group = 6)',
|
|
|
|
7: 'Back reference (group = 7)',
|
|
|
|
8: 'Back reference (group = 8)',
|
|
|
|
9: 'Back reference (group = 9)',
|
|
|
|
0() {
|
2014-12-17 19:44:48 +00:00
|
|
|
if (this.arg) {
|
|
|
|
return 'octal: ' + this.arg;
|
2014-12-09 22:43:05 +00:00
|
|
|
} else {
|
|
|
|
return 'null';
|
|
|
|
}
|
|
|
|
},
|
|
|
|
c() {
|
2014-12-17 19:44:48 +00:00
|
|
|
return 'ctrl-' + this.arg;
|
2014-12-09 22:43:05 +00:00
|
|
|
},
|
|
|
|
x() {
|
2014-12-17 19:44:48 +00:00
|
|
|
return '0x' + this.arg.toUpperCase();
|
2014-12-09 22:43:05 +00:00
|
|
|
},
|
|
|
|
u() {
|
2014-12-17 19:44:48 +00:00
|
|
|
return 'U+' + this.arg.toUpperCase();
|
2014-12-07 20:26:45 +00:00
|
|
|
}
|
2014-12-17 16:53:04 +00:00
|
|
|
};
|