regexper-static/src/js/parser/javascript/root.js

37 lines
725 B
JavaScript
Raw Normal View History

import _ from 'lodash';
import Base from './base.js';
export default _.extend({}, Base, {
type: 'root',
_render() {
2014-12-04 01:20:08 +00:00
this.start = this.container.circle()
.addClass('pin')
.attr({ r: 5 });
this.end = this.container.circle()
.addClass('pin')
.attr({ r: 5 });
return this.regexp.render(this.container.group())
.then(this.spaceHorizontally.bind(this, [this.start, this.regexp, this.end], {
padding: 10
}));
},
flags() {
var flags;
if (this._flags) {
flags = this._flags.textValue;
} else {
flags = '';
}
return {
global: /g/.test(flags),
ignore_case: /i/.test(flags),
multiline: /m/.test(flags)
};
}
});