equal
deleted
inserted
replaced
12 val replace_all : string -> string -> string -> string |
12 val replace_all : string -> string -> string -> string |
13 val remove_all : string -> string -> string |
13 val remove_all : string -> string -> string |
14 val timestamp : unit -> string |
14 val timestamp : unit -> string |
15 val parse_bool_option : bool -> string -> string -> bool option |
15 val parse_bool_option : bool -> string -> string -> bool option |
16 val parse_time_option : string -> string -> Time.time option |
16 val parse_time_option : string -> string -> Time.time option |
|
17 val unyxml : string -> string |
|
18 val maybe_quote : string -> string |
17 end; |
19 end; |
18 |
20 |
19 structure Sledgehammer_Util : SLEDGEHAMMER_UTIL = |
21 structure Sledgehammer_Util : SLEDGEHAMMER_UTIL = |
20 struct |
22 struct |
21 |
23 |
70 \value (e.g., \"60 s\", \"200 ms\") or \"none\".") |
72 \value (e.g., \"60 s\", \"200 ms\") or \"none\".") |
71 else |
73 else |
72 SOME (Time.fromMilliseconds msecs) |
74 SOME (Time.fromMilliseconds msecs) |
73 end |
75 end |
74 |
76 |
|
77 fun plain_string_from_xml_tree t = |
|
78 Buffer.empty |> XML.add_content t |> Buffer.content |
|
79 val unyxml = plain_string_from_xml_tree o YXML.parse |
|
80 |
|
81 val is_long_identifier = forall Syntax.is_identifier o space_explode "." |
|
82 fun maybe_quote y = |
|
83 let val s = unyxml y in |
|
84 y |> ((not (is_long_identifier (perhaps (try (unprefix "'")) s)) andalso |
|
85 not (is_long_identifier (perhaps (try (unprefix "?")) s))) orelse |
|
86 OuterKeyword.is_keyword s) ? quote |
|
87 end |
|
88 |
75 end; |
89 end; |