Skip to content
Snippets Groups Projects
Commit 4bccb7ab authored by yakomaxa's avatar yakomaxa
Browse files

VMD jmol rasmol parser debugged

parent fcd5b2ce
No related branches found
No related tags found
No related merge requests found
...@@ -39,12 +39,16 @@ const valueOperators: OperatorList = [ ...@@ -39,12 +39,16 @@ const valueOperators: OperatorList = [
expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e2)]); expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e2)]);
} else if (e2 === 'structure') { } else if (e2 === 'structure') {
expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e1)]); expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e1)]);
} else if (e1.head.name === 'core.type.regex') { } else if (e1.head !== undefined){
if (e1.head.name === 'core.type.regex') {
expr = B.core.str.match([e1, B.core.type.str([e2])]); expr = B.core.str.match([e1, B.core.type.str([e2])]);
} else if (e2.head.name === 'core.type.regex') { }
} else if (e2.head !== undefined){
if (e2.head.name === 'core.type.regex') {
expr = B.core.str.match([e2, B.core.type.str([e1])]); expr = B.core.str.match([e2, B.core.type.str([e1])]);
}
} else if (op.toUpperCase() === 'LIKE') { } else if (op.toUpperCase() === 'LIKE') {
if (e1.head.name) { if (e1.head) {
expr = B.core.str.match([ expr = B.core.str.match([
B.core.type.regex([`^${e2}$`, 'i']), B.core.type.regex([`^${e2}$`, 'i']),
B.core.type.str([e1]) B.core.type.str([e1])
...@@ -57,8 +61,8 @@ const valueOperators: OperatorList = [ ...@@ -57,8 +61,8 @@ const valueOperators: OperatorList = [
} }
} }
if (!expr) { if (!expr) {
if (e1.head.name) e2 = h.wrapValue(e1, e2); if (e1.head) e2 = h.wrapValue(e1, e2);
if (e2.head.name) e1 = h.wrapValue(e2, e1); if (e2.head) e1 = h.wrapValue(e2, e1);
switch (op) { switch (op) {
case '=': case '=':
expr = B.core.rel.eq([e1, e2]); expr = B.core.rel.eq([e1, e2]);
......
...@@ -39,12 +39,16 @@ const valueOperators: OperatorList = [ ...@@ -39,12 +39,16 @@ const valueOperators: OperatorList = [
expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e2)]); expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e2)]);
} else if (e2 === 'structure') { } else if (e2 === 'structure') {
expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e1)]); expr = B.core.flags.hasAny([B.ammp('secondaryStructureFlags'), structureMap(e1)]);
} else if (e1.head.name === 'core.type.regex') { } else if (e1.head !== undefined){
if (e1.head.name === 'core.type.regex') {
expr = B.core.str.match([e1, B.core.type.str([e2])]); expr = B.core.str.match([e1, B.core.type.str([e2])]);
} else if (e2.head.name === 'core.type.regex') { }
} else if (e2.head !== undefined){
if (e2.head.name === 'core.type.regex') {
expr = B.core.str.match([e2, B.core.type.str([e1])]); expr = B.core.str.match([e2, B.core.type.str([e1])]);
}
} else if (op.toUpperCase() === 'LIKE') { } else if (op.toUpperCase() === 'LIKE') {
if (e1.head.name) { if (e1.head) {
expr = B.core.str.match([ expr = B.core.str.match([
B.core.type.regex([`^${e2}$`, 'i']), B.core.type.regex([`^${e2}$`, 'i']),
B.core.type.str([e1]) B.core.type.str([e1])
...@@ -57,8 +61,8 @@ const valueOperators: OperatorList = [ ...@@ -57,8 +61,8 @@ const valueOperators: OperatorList = [
} }
} }
if (!expr) { if (!expr) {
if (e1.head.name) e2 = h.wrapValue(e1, e2); if (e1.head) e2 = h.wrapValue(e1, e2);
if (e2.head.name) e1 = h.wrapValue(e2, e1); if (e2.head) e1 = h.wrapValue(e2, e1);
switch (op) { switch (op) {
case '=': case '=':
expr = B.core.rel.eq([e1, e2]); expr = B.core.rel.eq([e1, e2]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment