50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
|
module pp
|
||
|
|
||
|
imports
|
||
|
|
||
|
libstratego-gpp
|
||
|
libspoofax/sdf/pp
|
||
|
libspoofax/editor/refactoring/-
|
||
|
pp/Spoofax-Propositional-Language-parenthesize
|
||
|
pp/Spoofax-Propositional-Language-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-Spoofax-Propositional-Language-string =
|
||
|
parenthesize-Spoofax-Propositional-Language
|
||
|
; prettyprint-Spoofax-Propositional-Language-start-symbols
|
||
|
; !V([], <id>)
|
||
|
; box2text-string(|120)
|
||
|
|
||
|
pp-partial-Spoofax-Propositional-Language-string =
|
||
|
parenthesize-Spoofax-Propositional-Language
|
||
|
; prettyprint-Spoofax-Propositional-Language
|
||
|
; !V([], <id>)
|
||
|
; box2text-string(|120)
|
||
|
|
||
|
pp-partial-Spoofax-Propositional-Language-string(|sort) =
|
||
|
parenthesize-Spoofax-Propositional-Language
|
||
|
; prettyprint-Spoofax-Propositional-Language(|sort)
|
||
|
; !V([], <id>)
|
||
|
; box2text-string(|120)
|
||
|
|
||
|
pp-debug :
|
||
|
ast -> result
|
||
|
with
|
||
|
result := <pp-Spoofax-Propositional-Language-string> ast
|
||
|
<+ <bottomup(try(not(is-string); not(is-list); not(pp-Spoofax-Propositional-Language-string); debug(!"cannot pp ")))> ast
|
||
|
; result := ""
|
||
|
|
||
|
rules
|
||
|
|
||
|
construct-textual-change = construct-textual-change(pp-partial-Spoofax-Propositional-Language-string, parenthesize, override-reconstruction, resugar)
|