23 |
23 |
24 the, the_default, |
24 the, the_default, |
25 |
25 |
26 fold, fold_rev, single, map_index, get_index, |
26 fold, fold_rev, single, map_index, get_index, |
27 |
27 |
28 quote, trim_line, clean_name) |
28 quote, space_implode, commas, commas_quote, cat_lines, |
|
29 space_explode, split_lines, trim_line, clean_name) |
29 where |
30 where |
30 |
31 |
31 import Data.Maybe |
32 import Data.Maybe |
|
33 import qualified Data.List as List |
|
34 import qualified Data.List.Split as Split |
32 |
35 |
33 |
36 |
34 {- functions -} |
37 {- functions -} |
35 |
38 |
36 (|>) :: a -> (a -> b) -> b |
39 (|>) :: a -> (a -> b) -> b |
88 |
91 |
89 {- strings -} |
92 {- strings -} |
90 |
93 |
91 quote :: String -> String |
94 quote :: String -> String |
92 quote s = "\"" ++ s ++ "\"" |
95 quote s = "\"" ++ s ++ "\"" |
|
96 |
|
97 space_implode :: String -> [String] -> String |
|
98 space_implode = List.intercalate |
|
99 |
|
100 commas, commas_quote :: [String] -> String |
|
101 commas = space_implode ", " |
|
102 commas_quote = commas . map quote |
|
103 |
|
104 cat_lines :: [String] -> String |
|
105 cat_lines = space_implode "\n" |
|
106 |
|
107 |
|
108 space_explode :: Char -> String -> [String] |
|
109 space_explode c = Split.split (Split.dropDelims (Split.whenElt (== c))) |
|
110 |
|
111 split_lines :: String -> [String] |
|
112 split_lines = space_explode '\n' |
93 |
113 |
94 trim_line :: String -> String |
114 trim_line :: String -> String |
95 trim_line line = |
115 trim_line line = |
96 case reverse line of |
116 case reverse line of |
97 '\n' : '\r' : rest -> reverse rest |
117 '\n' : '\r' : rest -> reverse rest |
1110 str, brk_indent, brk, fbrk, breaks, fbreaks, blk, block, strs, markup, mark, mark_str, marks_str, |
1130 str, brk_indent, brk, fbrk, breaks, fbreaks, blk, block, strs, markup, mark, mark_str, marks_str, |
1111 item, text_fold, keyword1, keyword2, text, paragraph, para, quote, cartouche, separate, |
1131 item, text_fold, keyword1, keyword2, text, paragraph, para, quote, cartouche, separate, |
1112 commas, enclose, enum, list, str_list, big_list) |
1132 commas, enclose, enum, list, str_list, big_list) |
1113 where |
1133 where |
1114 |
1134 |
1115 import Isabelle.Library hiding (quote) |
1135 import Isabelle.Library hiding (quote, commas) |
1116 import qualified Data.List as List |
1136 import qualified Data.List as List |
1117 import qualified Isabelle.Buffer as Buffer |
1137 import qualified Isabelle.Buffer as Buffer |
1118 import qualified Isabelle.Markup as Markup |
1138 import qualified Isabelle.Markup as Markup |
1119 import qualified Isabelle.XML as XML |
1139 import qualified Isabelle.XML as XML |
1120 import qualified Isabelle.YXML as YXML |
1140 import qualified Isabelle.YXML as YXML |