#
a98923f3 |
|
08-Jul-2015 |
Michael Norrish <Michael.Norrish@nicta.com.au> |
Allow pretty-printing backends to modify grammar If you know that you are targetting a particular backend, you may wish to also modify the grammars that control pretty-printing. For the moment, just use the identity update in all our backends, so that nothing changes in terms of what the user sees.
|
#
407b5983 |
|
09-Jan-2011 |
Ramana Kumar <ramana.kumar@gmail.com> |
Replace add_ann_string with a more general add_xstring Allows a custom size and/or annotation to be given to a string for pretty-printing. For code using add_ann_string, you can get add_xstring instead and define fun add_ann_string s = add_xstring {s=s,ann=SOME ann,sz=NONE} for an easy upgrade.
|
#
db504a6a |
|
19-Nov-2009 |
Thomas Tuerk <Thomas.Tuerk@cl.cam.ac.uk> |
Added styles to the pretty-printer. The recent changes to the pretty-printer use colours to convey extra information about terms and types as they are printed. This is done via annotations containing semantic information. For example, an annotation states that some string represents a variable of some type. It's then up to the backend how to use this extra information for displaying. This checkin adds a concept of "styles". In contrast to annotations, styles express formating instructions. A style states instructions like: "print the following in red and bold". There are two new function: begin_style style_list and end_style. Everything that is outputted between calls of these functions, should be formated in the given style. There are the following styles available: Setting the foreground color to c: FG c Setting the background color to c: BG c Use bold font: Bold Underline text: Underline begin_style takes a list of these styles. Thereby, the colors c can be choosen from a standard 16 color palette: Black, RedBrown, Green, BrownGreen, DarkBlue, Purple, BlueGreen, DarkGrey, LightGrey, OrangeRed, VividGreen, Yellow, Blue, PinkPurple, LightBlue, White In order to provide begin_style and end_style to user defined pretty-printers, the interface of userprinter had to be extended. Instead of getting two functions add_string and add_break, the userprinter now gets a record of a lot of different functions. Old pretty printers have to be adapted by changing fun myprint Gs (sys,str,brk) gravs d pps t = let open Portable term_pp_types ... to fun myprint Gs sys (ppfns:term_pp_types.ppstream_funs) gravs d pps t = let open Portable term_pp_types val (str,brk) = (#add_string ppfns, #add_break ppfns); ... If you want all the functions, you can use fun myprint Gs sys (ppfns:term_pp_types.ppstream_funs) gravs d pps t = let open Portable term_pp_types val {add_string,add_break,begin_block,end_block,add_ann_string,add_newline,begin_style,end_style,...} = ppfns ...
|