Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
03224f91
Commit
03224f91
authored
Sep 10, 2022
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
transpiler helper cleanup
parent
70fc1a95
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-script/transpilers/helper.ts
+5
-19
5 additions, 19 deletions
src/mol-script/transpilers/helper.ts
with
5 additions
and
19 deletions
src/mol-script/transpilers/helper.ts
+
5
−
19
View file @
03224f91
...
...
@@ -31,16 +31,6 @@ export function prefix(opParser: P.MonadicParser<any>, nextParser: P.MonadicPars
return
parser
;
}
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
.
regexp
(
/
\s
*
\)
/
)))
.
map
(
x
=>
mapFn
(...
x
))
.
or
(
nextParser
);
});
return
parser
;
}
// Ideally this function would be just like `PREFIX` but reordered like
// `P.seq(parser, opParser).or(nextParser)`, but that doesn't work. The
// reason for that is that Parsimmon will get stuck in infinite recursion, since
...
...
@@ -138,10 +128,6 @@ export function prefixOp(re: RegExp, group: number = 0) {
return
P
.
MonadicParser
.
regexp
(
re
,
group
).
skip
(
P
.
MonadicParser
.
optWhitespace
);
}
export
function
prefixOpNoWhiteSpace
(
re
:
RegExp
,
group
:
number
=
0
)
{
return
P
.
MonadicParser
.
regexp
(
re
,
group
).
skip
(
P
.
MonadicParser
.
regexp
(
/
\s
*/
));
}
export
function
postfixOp
(
re
:
RegExp
,
group
:
number
=
0
)
{
return
P
.
MonadicParser
.
optWhitespace
.
then
(
P
.
MonadicParser
.
regexp
(
re
,
group
));
}
...
...
@@ -364,18 +350,18 @@ const residueProps = ['residueKey', 'label_comp_id', 'label_seq_id', 'auth_comp_
export
function
testLevel
(
property
:
any
)
{
if
(
property
.
head
.
name
.
startsWith
(
propPrefix
))
{
const
name
=
property
.
head
.
name
.
substr
(
propPrefix
.
length
);
if
(
entityProps
.
in
dexOf
(
name
)
!==
-
1
)
return
'
entity-test
'
as
string
;
if
(
chainProps
.
in
dexOf
(
name
)
!==
-
1
)
return
'
chain-test
'
as
string
;
if
(
residueProps
.
in
dexOf
(
name
)
!==
-
1
)
return
'
residue-test
'
as
string
;
if
(
entityProps
.
in
cludes
(
name
)
)
return
'
entity-test
'
;
if
(
chainProps
.
in
cludes
(
name
)
)
return
'
chain-test
'
;
if
(
residueProps
.
in
cludes
(
name
)
)
return
'
residue-test
'
;
}
return
'
atom-test
'
as
string
;
return
'
atom-test
'
;
}
const
flagProps
=
[
'
structure-query.atom-property.macromolecular.secondary-structure-flags
'
];
export
function
valuesTest
(
property
:
any
,
values
:
any
[])
{
if
(
flagProps
.
in
dexOf
(
property
.
head
.
name
)
!==
-
1
)
{
if
(
flagProps
.
in
cludes
(
property
.
head
.
name
))
{
const
name
=
values
[
0
].
head
;
const
flags
:
any
[]
=
[];
values
.
forEach
(
v
=>
flags
.
push
(...
v
.
args
[
0
]));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment