class BabelExporter extends PrettyPrinter
Exports lambda expressions in the Babel format. You probably do not want to use this class, use one of expression.toString, .toSigRelativeString, or .toAsciiString instead. These are all implemented using this class.
This exporter is implemented using the pretty-printing library included in Kiama.
- Source
- export.scala
- Alphabetic
- By Inheritance
- BabelExporter
- PrettyPrinter
- PrettyPrinterBase
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
BabelExporter(unicode: Boolean, sig: BabelSignature, omitTypes: Boolean = false)
- unicode
Whether to output logical connectives using Unicode symbols.
- sig
The Babel signature, to decide whether we need to escape constants because they do not fit the naming convention.
Type Members
-
type
Buffer = Seq[Entry]
- Definition Classes
- PrettyPrinter
-
class
Doc extends DocCont with org.bitbucket.inkytonik.kiama.output.PrettyPrinter.DocOps
- Definition Classes
- PrettyPrinter
-
type
DocCont = (IW) ⇒ (TreeCont) ⇒ Trampoline[TreeCont]
- Definition Classes
- PrettyPrinter
-
trait
DocOps extends AnyRef
- Definition Classes
- PrettyPrinterBase
-
type
Dq = Queue[(PPosition, OutGroup)]
- Definition Classes
- PrettyPrinter
-
type
Effect = (Buffer) ⇒ Buffer
- Definition Classes
- PrettyPrinter
-
sealed abstract
class
Entry extends AnyRef
- Definition Classes
- PrettyPrinter
-
case class
Finish extends Entry with Product with Serializable
- Definition Classes
- PrettyPrinter
-
type
Horizontal = Boolean
- Definition Classes
- PrettyPrinter
-
type
IW = (Indent, Width)
- Definition Classes
- PrettyPrinter
-
type
Out = (Remaining) ⇒ Trampoline[Buffer]
- Definition Classes
- PrettyPrinter
-
type
OutGroup = (Horizontal) ⇒ (Out) ⇒ Trampoline[Out]
- Definition Classes
- PrettyPrinter
-
type
PPosition = Int
- Definition Classes
- PrettyPrinter
-
type
Remaining = Int
- Definition Classes
- PrettyPrinter
-
case class
Start extends Entry with Product with Serializable
- Definition Classes
- PrettyPrinter
-
case class
Text extends Entry with Product with Serializable
- Definition Classes
- PrettyPrinter
-
type
TreeCont = (PPosition, Dq) ⇒ Trampoline[Out]
- Definition Classes
- PrettyPrinter
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from BabelExporter to any2stringadd[BabelExporter] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (BabelExporter, B)
- Implicit
- This member is added by an implicit conversion from BabelExporter to ArrowAssoc[BabelExporter] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
align(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
ampersand: Doc
- Definition Classes
- PrettyPrinterBase
-
def
angles(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
any(a: Any): Doc
- Definition Classes
- PrettyPrinterBase
-
def
arguments[T](l: Seq[T], elemToDoc: (T) ⇒ Doc, sep: Doc, sepfn: (Seq[Doc], Doc) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- val asciiUnquotName: Regex
-
def
asterisk: Doc
- Definition Classes
- PrettyPrinterBase
-
def
atsign: Doc
- Definition Classes
- PrettyPrinterBase
-
def
backquote: Doc
- Definition Classes
- PrettyPrinterBase
-
def
backslash: Doc
- Definition Classes
- PrettyPrinterBase
-
def
braces(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
brackets(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
caret: Doc
- Definition Classes
- PrettyPrinterBase
-
def
cat(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
implicit
def
char(c: Char): Doc
- Definition Classes
- PrettyPrinterBase
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
colon: Doc
- Definition Classes
- PrettyPrinterBase
-
def
column(f: (Int) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
comma: Doc
- Definition Classes
- PrettyPrinterBase
-
val
defaultIndent: Int
- Definition Classes
- BabelExporter → PrettyPrinterBase
-
val
defaultWidth: Int
- Definition Classes
- PrettyPrinterBase
-
def
dollar: Doc
- Definition Classes
- PrettyPrinterBase
-
def
dot: Doc
- Definition Classes
- PrettyPrinterBase
-
def
dquote: Doc
- Definition Classes
- PrettyPrinterBase
-
def
dquotes(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
emptyDoc: Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
enclose(l: Doc, d: Doc, r: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
ensuring(cond: (BabelExporter) ⇒ Boolean, msg: ⇒ Any): BabelExporter
- Implicit
- This member is added by an implicit conversion from BabelExporter to Ensuring[BabelExporter] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (BabelExporter) ⇒ Boolean): BabelExporter
- Implicit
- This member is added by an implicit conversion from BabelExporter to Ensuring[BabelExporter] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): BabelExporter
- Implicit
- This member is added by an implicit conversion from BabelExporter to Ensuring[BabelExporter] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): BabelExporter
- Implicit
- This member is added by an implicit conversion from BabelExporter to Ensuring[BabelExporter] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equal: Doc
- Definition Classes
- PrettyPrinterBase
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exclamation: Doc
- Definition Classes
- PrettyPrinterBase
- def export(ty: Ty): String
- def export(sequent: HOLSequent): String
- def export(expr: LambdaExpression): String
-
def
fillcat(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
def
fillsep(ds: Seq[Doc], sep: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
fillsep(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
folddoc(ds: Seq[Doc], f: (Doc, Doc) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from BabelExporter to StringFormat[BabelExporter] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
def
forwslash: Doc
- Definition Classes
- PrettyPrinterBase
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
group(d: Doc): Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
hang(d: Doc, i: Indent): Doc
- Definition Classes
- PrettyPrinterBase
-
def
hash: Doc
- Definition Classes
- PrettyPrinterBase
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
hcat(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
def
hsep(ds: Seq[Doc], sep: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
hsep(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
def
indent(d: Doc, i: Indent): Doc
- Definition Classes
- PrettyPrinterBase
- val infixRel: Set[String]
-
def
insert(len: Int, entry: Entry): Doc
- Definition Classes
- PrettyPrinter
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def knownConstantTypesFromSig(consts: Iterable[Const]): Iterable[(String, Const)]
-
def
langle: Doc
- Definition Classes
- PrettyPrinterBase
-
def
layout(d: Doc, w: Width): Layout
- Definition Classes
- PrettyPrinterBase
-
def
lbrace: Doc
- Definition Classes
- PrettyPrinterBase
-
def
lbracket: Doc
- Definition Classes
- PrettyPrinterBase
-
def
leave(c: TreeCont): TreeCont
- Definition Classes
- PrettyPrinter
-
def
line: Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
line(repl: Layout): Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
linebreak: Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
link(n: AnyRef, d: Doc): Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
links(d: Doc, w: Width): Links
- Definition Classes
- PrettyPrinterBase
-
def
list[T](l: List[T], prefix: String, elemToDoc: (T) ⇒ Doc, sep: Doc, sepfn: (Seq[Doc], Doc) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
lparen: Doc
- Definition Classes
- PrettyPrinterBase
-
def
lsep(ds: Seq[Doc], sep: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
lsep2(ds: Seq[Doc], sep: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
lterm(ds: Seq[Doc], term: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
minus: Doc
- Definition Classes
- PrettyPrinterBase
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
nest(doc: Doc, j: Indent = defaultIndent): Doc
- Definition Classes
- BabelExporter → PrettyPrinter → PrettyPrinterBase
-
def
nesting(f: (Int) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
output(o: Out, r: Int, entry: Entry): More[Buffer]
- Definition Classes
- PrettyPrinter
-
def
padto(p: Int, d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
padtobreak(p: Int, d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
- def parenIf(enclosingPrio: Int, currentPrio: Int, doc: Doc): Doc
-
def
parens(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
percent: Doc
- Definition Classes
- PrettyPrinterBase
-
def
plus: Doc
- Definition Classes
- PrettyPrinterBase
-
def
pretty(d: Doc, w: Width): Document
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
prune(c1: TreeCont): TreeCont
- Definition Classes
- PrettyPrinter
-
def
question: Doc
- Definition Classes
- PrettyPrinterBase
-
def
rangle: Doc
- Definition Classes
- PrettyPrinterBase
-
def
rbrace: Doc
- Definition Classes
- PrettyPrinterBase
-
def
rbracket: Doc
- Definition Classes
- PrettyPrinterBase
-
def
rparen: Doc
- Definition Classes
- PrettyPrinterBase
- val safeChars: Regex
-
def
scan(l: Width, out: OutGroup)(c: TreeCont): Trampoline[TreeCont]
- Definition Classes
- PrettyPrinter
-
def
semi: Doc
- Definition Classes
- PrettyPrinterBase
-
def
sep(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
def
seq[T](l: Seq[T], prefix: String, elemToDoc: (T) ⇒ Doc, sep: Doc, sepfn: (Seq[Doc], Doc) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinterBase
- def show(ty: Ty, needParens: Boolean): Doc
-
def
show(expr: LambdaExpression, knownType: Boolean, bound: Set[String], t0: Map[String, VarOrConst], p: Int): (Doc, Map[String, VarOrConst])
Converts a lambda expression into a document.
Converts a lambda expression into a document.
At every point in the conversion, we keep track of:
- Whether the parser will already know the type of this expression (by inference)
- What type the free identifiers have.
- What priority the enclosing operator has.
- expr
The lambda expression to convert.
- knownType
Whether we already know the type of this expression.
- bound
Names bound by enclosing binders.
- t0
Already used free identifiers, together with the variable or constant they represent.
- p
The priority of the enclosing operator.
- returns
Pretty-printed document and the free identifiers.
- def show(sequent: HOLSequent, bound: Set[String], t0: Map[String, VarOrConst]): (Doc, Map[String, VarOrConst])
- def showApps(expr: LambdaExpression, knownType: Boolean, bound: Set[String], t0: Map[String, VarOrConst], p: Int): (Doc, Map[String, VarOrConst])
- def showBin(sym: String, prio: Int, leftPrioBias: Int, rightPrioBias: Int, a: LambdaExpression, b: LambdaExpression, knownType: Boolean, bound: Set[String], t0: Map[String, VarOrConst], p: Int): (Doc, Map[String, VarOrConst])
- def showBinOp(c: Const, prio: Int, leftPrioBias: Int, rightPrioBias: Int, a: LambdaExpression, b: LambdaExpression, knownType: Boolean, bound: Set[String], t0: Map[String, VarOrConst], p: Int): (Doc, Map[String, VarOrConst])
- def showName(name: String): Doc
- def showQuant(sym: String, v: Var, e: LambdaExpression, bound: Set[String], t0: Map[String, VarOrConst], p: Int): (Doc, Map[String, VarOrConst])
-
def
softbreak: Doc
- Definition Classes
- PrettyPrinterBase
-
def
softline: Doc
- Definition Classes
- PrettyPrinterBase
-
def
space: Doc
- Definition Classes
- PrettyPrinterBase
-
def
spaces(n: Int): Doc
- Definition Classes
- PrettyPrinterBase
-
def
squote: Doc
- Definition Classes
- PrettyPrinterBase
-
def
squotes(d: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
ssep(ds: Seq[Doc], sep: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
sterm(ds: Seq[Doc], term: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
string(s: String): Doc
- Definition Classes
- PrettyPrinterBase
-
def
surround(d: Doc, b: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
implicit
def
text(t: String): Doc
- Definition Classes
- PrettyPrinter → PrettyPrinterBase
-
def
tilde: Doc
- Definition Classes
- PrettyPrinterBase
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
underscore: Doc
- Definition Classes
- PrettyPrinterBase
-
def
value(v: Any): Doc
- Definition Classes
- PrettyPrinterBase
-
def
vcat(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
def
verticalbar: Doc
- Definition Classes
- PrettyPrinterBase
-
def
vsep(ds: Seq[Doc], sep: Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
vsep(ds: Seq[Doc]): Doc
- Definition Classes
- PrettyPrinterBase
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
width(d: Doc, f: (Int) ⇒ Doc): Doc
- Definition Classes
- PrettyPrinterBase
-
def
→[B](y: B): (BabelExporter, B)
- Implicit
- This member is added by an implicit conversion from BabelExporter to ArrowAssoc[BabelExporter] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- object prio