types.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Copyright (c) 2017-2021 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. import * as P from '../../mol-util/monadic-parser';
  8. import { Expression } from '../language/expression';
  9. // import Symbol from '../mini-lisp/symbol'
  10. export interface AtomGroupArgs {
  11. [index: string]: any
  12. 'entity-test'?: Expression
  13. 'chain-test'?: Expression
  14. 'residue-test'?: Expression
  15. 'atom-test'?: Expression
  16. 'groupBy'?: Expression
  17. }
  18. export interface Keyword {
  19. '@desc': string
  20. abbr?: string[]
  21. map?: () => Expression /* not given means the keyword is unsupported */
  22. }
  23. export type KeywordDict = { [name: string]: Keyword }
  24. export interface Property {
  25. '@desc': string
  26. '@examples': string[]
  27. isUnsupported?: boolean
  28. isNumeric?: boolean
  29. abbr?: string[]
  30. regex: RegExp
  31. map: (s: string) => any
  32. level: 'atom-test' | 'residue-test' | 'chain-test' | 'entity-test'
  33. property?: any /* Symbol */
  34. }
  35. export type PropertyDict = { [name: string]: Property }
  36. export interface Operator {
  37. '@desc': string
  38. '@examples': string[]
  39. name: string
  40. abbr?: string[]
  41. isUnsupported?: boolean
  42. type: (p1: P.MonadicParser<any>, p2: P.MonadicParser<any>, fn: any) => P.MonadicParser<any>
  43. rule: P.MonadicParser<any>
  44. map: (x: any, y: any, z?: any) => Expression | Expression[]
  45. }
  46. export type OperatorList = Operator[]
  47. export interface Function {
  48. '@desc': string
  49. '@examples': string[]
  50. map?: (x: any) => Expression /* not given means the keyword is unsupported */
  51. }
  52. export type FunctionDict = { [name: string]: Function }