1(* 2 Copyright (c) 2009, 2016 David C.J. Matthews 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License version 2.1 as published by the Free Software Foundation. 7 8 This library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Lesser General Public License for more details. 12 13 You should have received a copy of the GNU Lesser General Public 14 License along with this library; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16*) 17 18signature EXPORTTREESIG = 19sig 20 type pretty 21 type types 22 type location = 23 { file: string, startLine: FixedInt.int, startPosition: FixedInt.int, 24 endLine: FixedInt.int, endPosition: FixedInt.int } 25 type locationProp 26 27 (* Export tree. *) 28 type ptProperties 29 type exportTree = location * ptProperties list 30 31 val PTprint: (FixedInt.int -> pretty) -> ptProperties (* Print the tree *) 32 val PTtype: types -> ptProperties (* Type of an expression *) 33 val PTdeclaredAt: location -> ptProperties (* Declaration location for id. *) 34 val PTopenedAt: location -> ptProperties (* When an identifier comes from an "open" the location of the open. *) 35 val PTstructureAt: location -> ptProperties (* When an identifier comes from open S or S.a the declaration of S. *) 36 val PTreferences: (bool * location list) -> ptProperties (* The references to the ID. The first is true if this is exported. *) 37 val PTparent: (unit -> exportTree) -> ptProperties 38 val PTpreviousSibling: (unit -> exportTree) -> ptProperties 39 val PTnextSibling: (unit -> exportTree) -> ptProperties 40 val PTfirstChild: (unit -> exportTree) -> ptProperties 41 val PTcompletions: string list -> ptProperties 42 val PTbreakPoint: bool ref -> ptProperties (* Breakpoint associated with location. *) 43 val PTdefId: FixedInt.int -> ptProperties (* Defining binding id *) 44 val PTrefId: FixedInt.int -> ptProperties (* Reference binding id *) 45 46 type navigation = 47 {parent: (unit -> exportTree) option, 48 next: (unit -> exportTree) option, 49 previous: (unit -> exportTree) option} 50 51 val exportList : 52 (navigation * 'a -> exportTree) 53 * (unit -> exportTree) option -> 'a list -> ptProperties list 54 55 val exportNavigationProps: navigation -> ptProperties list 56 57 val getStringAsTree: navigation * string * location * ptProperties list -> exportTree 58 59 val rootTreeTag: navigation Universal.tag 60 61 val mapLocationProps: locationProp list -> ptProperties list 62 and definingLocationProps: locationProp list -> ptProperties list 63 64 (* Types that can be shared. *) 65 structure Sharing: 66 sig 67 type types = types 68 and locationProp = locationProp 69 and pretty = pretty 70 and ptProperties = ptProperties 71 end 72end; 73