types.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. * @author Panagiotis Tourlas <panagiot_tourlov@hotmail.com>
  6. *
  7. * Adapted from MolQL project
  8. */
  9. import * as P from '../../mol-util/monadic-parser';
  10. import { Expression } from '../language/expression';
  11. export interface AtomGroupArgs {
  12. [index: string]: any
  13. 'entity-test'?: Expression
  14. 'chain-test'?: Expression
  15. 'residue-test'?: Expression
  16. 'atom-test'?: Expression
  17. 'groupBy'?: Expression
  18. }
  19. export interface Keyword {
  20. '@desc': string
  21. abbr?: string[]
  22. map?: () => Expression /* not given means the keyword is unsupported */
  23. }
  24. export type KeywordDict = { [name: string]: Keyword }
  25. export interface Property {
  26. '@desc': string
  27. '@examples': string[]
  28. isUnsupported?: boolean
  29. isNumeric?: boolean
  30. abbr?: string[]
  31. regex: RegExp
  32. map: (s: string) => any
  33. level: 'atom-test' | 'residue-test' | 'chain-test' | 'entity-test'
  34. property?: Expression
  35. }
  36. export type PropertyDict = { [name: string]: Property }
  37. export interface Operator {
  38. '@desc': string
  39. '@examples': string[]
  40. name: string
  41. abbr?: string[]
  42. isUnsupported?: boolean
  43. type: (p1: P.MonadicParser<any>, p2: P.MonadicParser<any>, fn: any) => P.MonadicParser<any>
  44. rule: P.MonadicParser<any>
  45. map: (x: any, y: any, z?: any) => Expression | Expression[]
  46. }
  47. export type OperatorList = Operator[]
  48. export interface Function {
  49. '@desc': string
  50. '@examples': string[]
  51. map?: (x: any) => Expression /* not given means the keyword is unsupported */
  52. }
  53. export type FunctionDict = { [name: string]: Function }