fostr/trans/pp.str

50 lines
1.1 KiB
Plaintext
Raw Normal View History

module pp
imports
libstratego-gpp
libspoofax/sdf/pp
libspoofax/editor/refactoring/-
pp/fostr-parenthesize
pp/fostr-pp
rules
editor-format:
(node, _, ast, path, project-path) -> (filename, result)
with
ext := <get-extension> path
; filename := <guarantee-extension(|$[pp.[ext]])> path
; result := <pp-debug> node
rules
pp-fostr-string =
parenthesize-fostr
; prettyprint-fostr-start-symbols
; !V([], <id>)
; box2text-string(|120)
pp-partial-fostr-string =
parenthesize-fostr
; prettyprint-fostr
; !V([], <id>)
; box2text-string(|120)
pp-partial-fostr-string(|sort) =
parenthesize-fostr
; prettyprint-fostr(|sort)
; !V([], <id>)
; box2text-string(|120)
pp-debug :
ast -> result
with
result := <pp-fostr-string> ast
<+ <bottomup(try(not(is-string); not(is-list); not(pp-fostr-string); debug(!"cannot pp ")))> ast
; result := ""
rules
construct-textual-change = construct-textual-change(pp-partial-fostr-string, parenthesize, override-reconstruction, resugar)