equal
deleted
inserted
replaced
7 |
7 |
8 signature MARKUP = |
8 signature MARKUP = |
9 sig |
9 sig |
10 type property = string * string |
10 type property = string * string |
11 type T = string * property list |
11 type T = string * property list |
|
12 val get_string: T -> string -> string option |
|
13 val get_int: T -> string -> int option |
12 val none: T |
14 val none: T |
13 val properties: (string * string) list -> T -> T |
15 val properties: (string * string) list -> T -> T |
14 val nameN: string |
16 val nameN: string |
15 val kindN: string |
17 val kindN: string |
16 val lineN: string |
18 val lineN: string |
66 type property = string * string; |
68 type property = string * string; |
67 type T = string * property list; |
69 type T = string * property list; |
68 |
70 |
69 val none = ("", []); |
71 val none = ("", []); |
70 |
72 |
|
73 |
71 fun properties more_props ((elem, props): T) = |
74 fun properties more_props ((elem, props): T) = |
72 (elem, fold_rev (AList.update (op =)) more_props props); |
75 (elem, fold_rev (AList.update (op =)) more_props props); |
73 |
76 |
74 val nameN = "name"; |
77 fun get_string ((_, props): T) prop = AList.lookup (op =) props prop; |
75 val kindN = "kind"; |
78 fun get_int m prop = (case get_string m prop of NONE => NONE | SOME s => Int.fromString s); |
76 |
79 |
77 fun markup elem = (elem, (elem, []): T); |
80 fun markup elem = (elem, (elem, []): T); |
78 fun markup_string elem prop = (elem, fn s => (elem, [(prop, s)]): T); |
81 fun markup_string elem prop = (elem, fn s => (elem, [(prop, s)]): T); |
79 fun markup_int elem prop = (elem, fn i => (elem, [(prop, string_of_int i)]): T); |
82 fun markup_int elem prop = (elem, fn i => (elem, [(prop, Int.toString i)]): T); |
|
83 |
|
84 val nameN = "name"; |
|
85 val kindN = "kind"; |
80 |
86 |
81 |
87 |
82 (* position *) |
88 (* position *) |
83 |
89 |
84 val lineN = "line"; |
90 val lineN = "line"; |