35 val scan_comment_body: string -> T list -> T list * T list |
35 val scan_comment_body: string -> T list -> T list * T list |
36 val recover_comment: T list -> T list * T list |
36 val recover_comment: T list -> T list * T list |
37 val source: Position.T -> (Symbol.symbol, 'a) Source.source -> |
37 val source: Position.T -> (Symbol.symbol, 'a) Source.source -> |
38 (T, Position.T * (Symbol.symbol, 'a) Source.source) Source.source |
38 (T, Position.T * (Symbol.symbol, 'a) Source.source) Source.source |
39 type text = string |
39 type text = string |
40 type source = {delimited: bool, text: text, pos: Position.T} |
|
41 val implode: T list -> text |
40 val implode: T list -> text |
42 val implode_range: Position.T -> Position.T -> T list -> text * Position.range |
41 val implode_range: Position.T -> Position.T -> T list -> text * Position.range |
43 val explode: text * Position.T -> T list |
42 val explode: text * Position.T -> T list |
|
43 type source = {delimited: bool, text: text, pos: Position.T} |
|
44 val source_content: source -> string * Position.T |
44 val scan_ident: T list -> T list * T list |
45 val scan_ident: T list -> T list * T list |
45 val is_identifier: string -> bool |
46 val is_identifier: string -> bool |
46 end; |
47 end; |
47 |
48 |
48 structure Symbol_Pos: SYMBOL_POS = |
49 structure Symbol_Pos: SYMBOL_POS = |
255 fold (fn s => fn (res, p) => ((s, p) :: res, Position.advance s p)) |
255 fold (fn s => fn (res, p) => ((s, p) :: res, Position.advance s p)) |
256 (Symbol.explode str) ([], Position.reset_range pos); |
256 (Symbol.explode str) ([], Position.reset_range pos); |
257 in fold (fn (s, p) => if s = Symbol.DEL then I else cons (s, p)) res [] end; |
257 in fold (fn (s, p) => if s = Symbol.DEL then I else cons (s, p)) res [] end; |
258 |
258 |
259 |
259 |
|
260 (* full source information *) |
|
261 |
|
262 type source = {delimited: bool, text: text, pos: Position.T}; |
|
263 |
|
264 fun source_content {delimited = _, text, pos} = |
|
265 let val syms = explode (text, pos) in (content syms, pos) end; |
|
266 |
|
267 |
260 (* identifiers *) |
268 (* identifiers *) |
261 |
269 |
262 local |
270 local |
263 |
271 |
264 val letter = Scan.one (symbol #> Symbol.is_letter); |
272 val letter = Scan.one (symbol #> Symbol.is_letter); |