mirror of https://github.com/Wilfred/difftastic/
364 lines
7.1 KiB
Plaintext
364 lines
7.1 KiB
Plaintext
================================
|
|
Package
|
|
================================
|
|
|
|
package a.b
|
|
package c {
|
|
object A
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(package_clause (package_identifier (identifier) (identifier)))
|
|
(package_clause (package_identifier (identifier))
|
|
(template_body
|
|
(object_definition (identifier)))))
|
|
|
|
================================
|
|
Package object
|
|
================================
|
|
|
|
package object d extends A {
|
|
val hello: String = "there"
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(package_object
|
|
(identifier)
|
|
(extends_clause (type_identifier))
|
|
(template_body
|
|
(val_definition (identifier) (type_identifier) (string)))))
|
|
|
|
================================
|
|
Imports
|
|
================================
|
|
|
|
import PartialFunction.condOpt
|
|
import reflect.io.{Directory, File, Path}
|
|
import tools.nsc.classpath._
|
|
import lang.System.{lineSeparator => EOL}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(import_declaration
|
|
(stable_identifier (identifier) (identifier)))
|
|
(import_declaration
|
|
(stable_identifier (identifier) (identifier))
|
|
(import_selectors (identifier) (identifier) (identifier)))
|
|
(import_declaration
|
|
(stable_identifier (stable_identifier (identifier) (identifier)) (identifier))
|
|
(wildcard))
|
|
(import_declaration
|
|
(stable_identifier (identifier) (identifier))
|
|
(import_selectors (renamed_identifier (identifier) (identifier)))))
|
|
|
|
=================================
|
|
Object definitions
|
|
=================================
|
|
|
|
// o1
|
|
object O1 {
|
|
}
|
|
|
|
case object O2 {
|
|
}
|
|
|
|
object O3 extends A {
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(comment)
|
|
(object_definition (identifier) (template_body))
|
|
(object_definition (identifier) (template_body))
|
|
(object_definition (identifier) (extends_clause (type_identifier)) (template_body)))
|
|
|
|
=======================================
|
|
Class definitions
|
|
=======================================
|
|
|
|
class C[T, U] {
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(type_parameters (identifier) (identifier))
|
|
(template_body)))
|
|
|
|
=======================================
|
|
Subclass definitions
|
|
=======================================
|
|
|
|
class A extends B.C[D, E] {
|
|
}
|
|
|
|
class A(b: B) extends C(b || ok) {
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(extends_clause
|
|
(generic_type
|
|
(stable_type_identifier
|
|
(identifier)
|
|
(type_identifier))
|
|
(type_arguments (type_identifier) (type_identifier))))
|
|
(template_body))
|
|
(class_definition
|
|
(identifier)
|
|
(class_parameters
|
|
(class_parameter (identifier) (type_identifier)))
|
|
(extends_clause
|
|
(type_identifier)
|
|
(arguments
|
|
(infix_expression (identifier) (operator_identifier) (identifier))))
|
|
(template_body)))
|
|
|
|
=======================================
|
|
Class definitions with parameters
|
|
=======================================
|
|
|
|
class Point(val x: Int, val y: Int)
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(class_parameters
|
|
(class_parameter (identifier) (type_identifier))
|
|
(class_parameter (identifier) (type_identifier)))))
|
|
|
|
=======================================
|
|
Modifiers
|
|
=======================================
|
|
|
|
implicit final sealed class Point {
|
|
private override def getX() = 1
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(modifiers)
|
|
(identifier)
|
|
(template_body
|
|
(function_definition
|
|
(modifiers)
|
|
(identifier)
|
|
(parameters)
|
|
(number)))))
|
|
|
|
=======================================
|
|
Trait definitions
|
|
=======================================
|
|
|
|
trait T[U] {
|
|
}
|
|
|
|
trait T[U] extends V.W[U] {
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(trait_definition
|
|
(identifier)
|
|
(type_parameters (identifier))
|
|
(template_body))
|
|
(trait_definition
|
|
(identifier)
|
|
(type_parameters (identifier))
|
|
(extends_clause (generic_type
|
|
(stable_type_identifier (identifier) (type_identifier))
|
|
(type_arguments (type_identifier))))
|
|
(template_body)))
|
|
|
|
=======================================
|
|
Value declarations
|
|
=======================================
|
|
|
|
class A {
|
|
val b, c : Int
|
|
val d : String
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(val_declaration
|
|
(identifier)
|
|
(identifier)
|
|
(type_identifier))
|
|
(val_declaration
|
|
(identifier)
|
|
(type_identifier)))))
|
|
|
|
=======================================
|
|
Value definitions
|
|
=======================================
|
|
|
|
class A {
|
|
val b = 1
|
|
val c : String = "d"
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(val_definition
|
|
(identifier)
|
|
(number))
|
|
(val_definition
|
|
(identifier)
|
|
(type_identifier)
|
|
(string)))))
|
|
|
|
=======================================
|
|
Variable declarations
|
|
=======================================
|
|
|
|
class A {
|
|
var b, c : Int
|
|
var d : String
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(var_declaration
|
|
(identifier)
|
|
(identifier)
|
|
(type_identifier))
|
|
(var_declaration
|
|
(identifier)
|
|
(type_identifier)))))
|
|
|
|
=======================================
|
|
Variable definitions
|
|
=======================================
|
|
|
|
class A {
|
|
var b : Int = 1
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(var_definition
|
|
(identifier)
|
|
(type_identifier)
|
|
(number)))))
|
|
|
|
=======================================
|
|
Type definitions
|
|
=======================================
|
|
|
|
class A {
|
|
type B = C
|
|
type D[E] = F
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(type_definition
|
|
(type_identifier)
|
|
(type_identifier))
|
|
(type_definition
|
|
(type_identifier)
|
|
(type_parameters (identifier))
|
|
(type_identifier)))))
|
|
|
|
=======================================
|
|
Function declarations
|
|
=======================================
|
|
|
|
class A {
|
|
def b(c: D) : E
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(function_declaration
|
|
(identifier)
|
|
(parameters (parameter (identifier) (type_identifier)))
|
|
(type_identifier)))))
|
|
|
|
=======================================
|
|
Function definitions
|
|
=======================================
|
|
|
|
class A {
|
|
def b(c: D, e: F) = 1
|
|
def g[H](i) {
|
|
j
|
|
}
|
|
}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(class_definition
|
|
(identifier)
|
|
(template_body
|
|
(function_definition
|
|
(identifier)
|
|
(parameters
|
|
(parameter (identifier) (type_identifier))
|
|
(parameter (identifier) (type_identifier)))
|
|
(number))
|
|
(function_definition
|
|
(identifier)
|
|
(type_parameters (identifier))
|
|
(parameters (parameter (identifier)))
|
|
(block (identifier))))))
|
|
|
|
=======================================
|
|
Optional parameters
|
|
=======================================
|
|
|
|
def mkLines(header: String, indented: Boolean = false, embraced: Boolean = false): String = {}
|
|
|
|
---
|
|
|
|
(compilation_unit
|
|
(function_definition
|
|
(identifier)
|
|
(parameters
|
|
(parameter (identifier) (type_identifier))
|
|
(parameter (identifier) (type_identifier) (identifier))
|
|
(parameter (identifier) (type_identifier) (identifier)))
|
|
(type_identifier) (block)))
|