From c2e68ced66f75f2c99a0fa925737f2d8427a6029 Mon Sep 17 00:00:00 2001 From: yakomaxa <47655565+yakomaxa@users.noreply.github.com> Date: Mon, 15 Aug 2022 19:39:54 +0900 Subject: [PATCH] cleaning by lint --- src/mol-script/transpilers/helper.ts | 2 +- .../transpilers/rasmol/operators.ts | 19 ++++--- src/mol-script/transpilers/rasmol/parser.ts | 56 +++++++++---------- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/src/mol-script/transpilers/helper.ts b/src/mol-script/transpilers/helper.ts index f8b1585c7..62039b92b 100644 --- a/src/mol-script/transpilers/helper.ts +++ b/src/mol-script/transpilers/helper.ts @@ -31,7 +31,7 @@ export function prefix(opParser: P.MonadicParser<any>, nextParser: P.MonadicPars export function prefixRemoveKet(opParser: P.MonadicParser<any>, nextParser: P.MonadicParser<any>, mapFn: any) { const parser: P.MonadicParser<any> = P.MonadicParser.lazy(() => { - return P.MonadicParser.seq(opParser, parser.skip(P.MonadicParser.string(")"))) + return P.MonadicParser.seq(opParser, parser.skip(P.MonadicParser.string(')'))) .map(x => mapFn(...x)) .or(nextParser); }); diff --git a/src/mol-script/transpilers/rasmol/operators.ts b/src/mol-script/transpilers/rasmol/operators.ts index b6cc6486c..5aa727701 100644 --- a/src/mol-script/transpilers/rasmol/operators.ts +++ b/src/mol-script/transpilers/rasmol/operators.ts @@ -14,7 +14,7 @@ import { MolScriptBuilder } from '../../../mol-script/language/builder'; const B = MolScriptBuilder; import { OperatorList } from '../types'; import { Expression } from '../../language/expression'; -import { macroproperties } from './macroproperties' +import { macroproperties } from './macroproperties'; const propNames = Object.keys(macroproperties).sort(h.strLenSortFn) .filter(name => !macroproperties[name].isUnsupported).join('|'); @@ -34,8 +34,8 @@ export const operators: OperatorList = [ '@examples': ['ASP and .CA'], name: 'and', type: h.binaryLeft, - rule: P.MonadicParser.alt(h.infixOp(/AND|&/i), P.MonadicParser.whitespace), - //rule: h.infixOp(/AND|&/i), + rule: P.MonadicParser.alt(h.infixOp(/AND|&/i), P.MonadicParser.whitespace), + // rule: h.infixOp(/AND|&/i), map: (op, selection, by) => B.struct.modifier.intersectBy({ 0: selection, by }) }, { @@ -56,21 +56,22 @@ export const operators: OperatorList = [ console.log(x) return parseFloat(x)}), map: (radius: number, selection: Expression) => { - + return B.struct.modifier.includeSurroundings({ 0: selection, radius }); } }, */ { - '@desc':'Selects atoms in s1 that are within X Angstroms of any atom in s2.', + '@desc': 'Selects atoms in s1 that are within X Angstroms of any atom in s2.', '@examples': ['chain A WITHIN 3 OF chain B'], name: 'within', abbr: ['w2.'], - // type: h.binaryLeft, - type: h.prefixRemoveKet, + // type: h.binaryLeft, + type: h.prefixRemoveKet, rule: h.prefixOpNoWhiteSpace(/within\s*\(\s*([-+]?[0-9]*\.?[0-9]+)\s*,/i, 1).map((x: any) => { - console.log(x) - return parseFloat(x)}), + console.log(x); + return parseFloat(x); + }), map: (radius: number, target: Expression) => { return B.struct.filter.within({ 0: B.struct.generator.all(), diff --git a/src/mol-script/transpilers/rasmol/parser.ts b/src/mol-script/transpilers/rasmol/parser.ts index 74387650d..194394d26 100644 --- a/src/mol-script/transpilers/rasmol/parser.ts +++ b/src/mol-script/transpilers/rasmol/parser.ts @@ -13,8 +13,8 @@ import { MolScriptBuilder } from '../../../mol-script/language/builder'; const B = MolScriptBuilder; import { properties } from './properties'; import { macroproperties } from './macroproperties'; -//import { macrokeywords } from './macrokeywords'; -//import { macrooperators } from './macrooperators'; +// import { macrokeywords } from './macrokeywords'; +// import { macrooperators } from './macrooperators'; import { operators } from './operators'; import { keywords } from './keywords'; import { AtomGroupArgs } from '../types'; @@ -65,12 +65,12 @@ function atomSelectionQuery2(x: any) { return B.struct.generator.atomGroups(tests); } -//function atomExpressionQuery(x: any[]) { +// function atomExpressionQuery(x: any[]) { // const resname = x[0]; // if (resname){ // return B.struct.generator.atomGroups({'residue-test': B.core.rel.eq([B.ammp('label_comp_id'), resname])}) -// } -//} +// } +// } const lang = P.MonadicParser.createLanguage({ @@ -88,15 +88,15 @@ const lang = P.MonadicParser.createLanguage({ r.Keywords, r.NamedAtomProperties, r.AtomSelectionMacro.map(atomSelectionQuery2), -// r.AtomExparession.map(atomExpressionQuery), + // r.AtomExparession.map(atomExpressionQuery), r.Object, - r.Object2, + r.Object2, ); }, -// AtomExpression: function (r: any) { -// return P.MonadicParser.seq(r.Resname.or(P.MonadicParser.of(null))); -// }, + // AtomExpression: function (r: any) { + // return P.MonadicParser.seq(r.Resname.or(P.MonadicParser.of(null))); + // }, @@ -150,38 +150,38 @@ const lang = P.MonadicParser.createLanguage({ // lys:a.ca lys:a lys lys.ca // [lys]:a.ca [lys]:a [lys] [lys].ca commu.then(P.MonadicParser.alt( - P.MonadicParser.alt( + P.MonadicParser.alt( P.MonadicParser.alt( - P.MonadicParser.seq( + P.MonadicParser.seq( orNull(propertiesDict.resn).skip(tator).skip(colon), orNull(propertiesDict.chain).skip(dot), orNull(propertiesDict.name) - ).map(x => { return { resn: x[0], chain: x[1], name: x[2] }; }), - P.MonadicParser.seq( + ).map(x => { return { resn: x[0], chain: x[1], name: x[2] }; }), + P.MonadicParser.seq( orNull(propertiesDict.resn).skip(tator).skip(star), orNull(propertiesDict.chain).skip(dot), orNull(propertiesDict.name) - ).map(x => { return { resn: x[0], chain: x[1], name: x[2] }; }), - P.MonadicParser.seq( + ).map(x => { return { resn: x[0], chain: x[1], name: x[2] }; }), + P.MonadicParser.seq( orNull(propertiesDict.resn).skip(tator).skip(colon), orNull(propertiesDict.chain), - ).map(x => { return { resn: x[0], chain: x[1] }; }), - P.MonadicParser.seq( + ).map(x => { return { resn: x[0], chain: x[1] }; }), + P.MonadicParser.seq( orNull(propertiesDict.resn).skip(tator).skip(star), orNull(propertiesDict.chain), - ).map(x => { return { resn: x[0], chain: x[1] }; }), - P.MonadicParser.seq( + ).map(x => { return { resn: x[0], chain: x[1] }; }), + P.MonadicParser.seq( orNull(propertiesDict.resn).skip(tator).skip(dot), orNull(propertiesDict.name), - ).map(x => { return { resn: x[0], name: x[1] }; }), - P.MonadicParser.seq( + ).map(x => { return { resn: x[0], name: x[1] }; }), + P.MonadicParser.seq( orNull(propertiesDict.resn).skip(tator), - ).map(x => { return { resn: x[0] }; }) + ).map(x => { return { resn: x[0] }; }) ) ) ) ) - ) + ); }, ObjectProperty: () => { @@ -208,10 +208,10 @@ const lang = P.MonadicParser.createLanguage({ }, - -// Resname: () => P.MonadicParser.regexp(s/[a-zA-Z0-9]{1,4}/).desc('resname'), -// Resname: () => P.MonadicParser.regexp(/\[[A-Z0-9]{1,4}\]/).desc('resname'), - + + // Resname: () => P.MonadicParser.regexp(s/[a-zA-Z0-9]{1,4}/).desc('resname'), + // Resname: () => P.MonadicParser.regexp(/\[[A-Z0-9]{1,4}\]/).desc('resname'), + NamedAtomProperties: function () { return P.MonadicParser.alt(...h.getNamedPropertyRules(properties)); }, -- GitLab