Removing Terminal type and replacing with Literal, Escape, and AnyChar
This is to eventually simplify the combining of Literals together (and to actually make it work correctly, since terminals should not have been merged)
This commit is contained in:
1 parent
41c11ad5d4
commit
f5d1e734f1
7 files changed
+30
-12
No files matched your search
@@ -0,0 +1,6 @@
|
||||
import _ from 'lodash';
|
||||
import Base from './base.js';
|
||||
|
||||
export default _.extend({}, Base, {
|
||||
type: 'any_character'
|
||||
});
|
||||
@@ -32,6 +32,8 @@ export default {
|
||||
},
|
||||
|
||||
render() {
|
||||
console.log(this);
|
||||
|
||||
this.container.addClass('placeholder');
|
||||
|
||||
this.label = this.render_label(this.container, this.textValue);
|
||||
|
||||
@@ -2,5 +2,5 @@ import _ from 'lodash';
|
||||
import Base from './base.js';
|
||||
|
||||
export default _.extend({}, Base, {
|
||||
type: 'terminal'
|
||||
type: 'escape'
|
||||
});
|
||||
@@ -39,10 +39,11 @@ grammar JavascriptRegexp
|
||||
/ octal_esc
|
||||
/ hex_esc
|
||||
/ unicode_esc
|
||||
/ null_esc
|
||||
/ literal_esc )
|
||||
charset_literal <- [^\\\]]
|
||||
terminal <- any_character / escape / literal <Terminal>
|
||||
/ null_esc )
|
||||
charset_literal <- [^\\\]] / ( "\\" . )
|
||||
terminal <- any_character <AnyCharacter>
|
||||
/ escape <Escape>
|
||||
/ literal <Literal>
|
||||
any_character <- "."
|
||||
escape <- ( word_boundary_esc
|
||||
/ non_word_boundary_esc
|
||||
@@ -62,9 +63,8 @@ grammar JavascriptRegexp
|
||||
/ octal_esc
|
||||
/ hex_esc
|
||||
/ unicode_esc
|
||||
/ null_esc
|
||||
/ literal_esc )
|
||||
literal <- [^|\\/.\[\(\)?+*$^]
|
||||
/ null_esc )
|
||||
literal <- ( ""? literal:[^|\\/.\[\(\)?+*$^] ) / ( "\\" literal:. )
|
||||
back_reference <- "\\" [1-9]
|
||||
word_boundary_esc <- "\\b"
|
||||
non_word_boundary_esc <- "\\B"
|
||||
@@ -85,4 +85,3 @@ grammar JavascriptRegexp
|
||||
hex_esc <- "\\x" [0-9a-fA-F] [0-9a-fA-F]
|
||||
unicode_esc <- "\\u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F]
|
||||
null_esc <- "\\0"
|
||||
literal_esc <- "\\" .
|
||||
@@ -0,0 +1,6 @@
|
||||
import _ from 'lodash';
|
||||
import Base from './base.js';
|
||||
|
||||
export default _.extend({}, Base, {
|
||||
type: 'literal'
|
||||
});
|
||||
@@ -70,10 +70,11 @@ export default _.extend({}, Base, {
|
||||
var last = result.pop();
|
||||
|
||||
if (last) {
|
||||
if (node.elements[0].type === 'terminal' && node.elements[1].textValue === '' && last.elements[0].type === 'terminal' && last.elements[1].textValue === '') {
|
||||
if (node.elements[0].type === 'literal' && node.elements[1].textValue === '' && last.elements[0].type === 'literal' && last.elements[1].textValue === '') {
|
||||
last = _.clone(last, true);
|
||||
last.textValue += node.textValue;
|
||||
last.elements[0].textValue += node.elements[0].textValue;
|
||||
last.elements[0].literal.textValue += node.elements[0].literal.textValue;
|
||||
last.elements[1] = node.elements[1];
|
||||
node = last;
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user