-
Notifications
You must be signed in to change notification settings - Fork 5
/
types.ts
62 lines (51 loc) · 1.51 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright (c) 2017 MolQL contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <[email protected]>
*/
import * as P from 'parsimmon'
import Expression from '../mini-lisp/expression'
// import Symbol from '../mini-lisp/symbol'
export interface AtomGroupArgs {
[index: string]: any
'entity-test'?: Expression
'chain-test'?: Expression
'residue-test'?: Expression
'atom-test'?: Expression
'groupBy'?: Expression
}
export interface Keyword {
'@desc': string
abbr?: string[]
map?: () => Expression // not given means the keyword is unsupported
}
export type KeywordDict = { [name: string]: Keyword }
export interface Property {
'@desc': string
'@examples': string[]
isUnsupported?: boolean
isNumeric?: boolean
abbr?: string[]
regex: RegExp
map: (s: string) => any
level: 'atom-test' | 'residue-test' | 'chain-test' | 'entity-test'
property?: any // Symbol
}
export type PropertyDict = { [name: string]: Property }
export interface Operator {
'@desc': string
'@examples': string[]
name: string
abbr?: string[]
isUnsupported?: boolean
type: (p1: P.Parser<any>, p2: P.Parser<any>, fn: any) => P.Parser<any>
rule: P.Parser<any>
map: (x: any, y: any, z?: any) => Expression | Expression[]
}
export type OperatorList = Operator[]
export interface Function {
'@desc': string
'@examples': string[]
map?: (x: any) => Expression // not given means the keyword is unsupported
}
export type FunctionDict = { [name: string]: Function }