You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/07/09 14:25:09 UTC
[groovy] 02/02: GROOVY-9633: Refresh the doco for the Groovy Console
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 684a8896846d1348115a35f9d537b855314f415c
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Jul 10 00:20:29 2020 +1000
GROOVY-9633: Refresh the doco for the Groovy Console
---
.../src/spec/doc/assets/img/astbrowser.png | Bin 139859 -> 0 bytes
.../spec/doc/assets/img/astbrowser_bytecode.png | Bin 0 -> 50928 bytes
.../src/spec/doc/assets/img/astbrowser_source.png | Bin 0 -> 53233 bytes
.../src/spec/doc/assets/img/cstbrowser.png | Bin 0 -> 51174 bytes
.../src/spec/doc/assets/img/gconsole-toolbar.png | Bin 7163 -> 8325 bytes
.../src/spec/doc/groovy-console.adoc | 26 +++++++++++++++++----
6 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser.png b/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser.png
deleted file mode 100644
index 2a96295..0000000
Binary files a/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser.png and /dev/null differ
diff --git a/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser_bytecode.png b/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser_bytecode.png
new file mode 100644
index 0000000..beb5c4a
Binary files /dev/null and b/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser_bytecode.png differ
diff --git a/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser_source.png b/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser_source.png
new file mode 100644
index 0000000..1d852db
Binary files /dev/null and b/subprojects/groovy-console/src/spec/doc/assets/img/astbrowser_source.png differ
diff --git a/subprojects/groovy-console/src/spec/doc/assets/img/cstbrowser.png b/subprojects/groovy-console/src/spec/doc/assets/img/cstbrowser.png
new file mode 100644
index 0000000..8c5072a
Binary files /dev/null and b/subprojects/groovy-console/src/spec/doc/assets/img/cstbrowser.png differ
diff --git a/subprojects/groovy-console/src/spec/doc/assets/img/gconsole-toolbar.png b/subprojects/groovy-console/src/spec/doc/assets/img/gconsole-toolbar.png
index c6a0cc3..c7036da 100644
Binary files a/subprojects/groovy-console/src/spec/doc/assets/img/gconsole-toolbar.png and b/subprojects/groovy-console/src/spec/doc/assets/img/gconsole-toolbar.png differ
diff --git a/subprojects/groovy-console/src/spec/doc/groovy-console.adoc b/subprojects/groovy-console/src/spec/doc/groovy-console.adoc
index a77d7df..456b1e9 100644
--- a/subprojects/groovy-console/src/spec/doc/groovy-console.adoc
+++ b/subprojects/groovy-console/src/spec/doc/groovy-console.adoc
@@ -208,17 +208,35 @@ transforms << { result ->
The Groovy Swing console will execute that script on startup, injecting
a transforms list in the binding of the script, so that you can add your
own script results representations. In our case, we transform the Map
-into a nice-looking Swing JTable. And we’re now able to visualize maps
+into a nice-looking Swing JTable. We’re now able to visualize maps
in a friendly and attractive fashion, as the screenshot below shows:
image:assets/img/gconsole-sc-with-visu.png[image]
[[GroovyConsole-ASTbrowser]]
-== AST browser
+== Advanced debugging: AST browser
Groovy Console can visualize the AST (Abstract Syntax Tree) representing
the currently edited script, as shown by the screenshot below. This is
-particularly handy when you want to develop AST transformations.
+useful when you want to understand how an AST transformation
+is working and particularly handy if you are developing your own AST transform.
+In the example below, we have annotated our class with the `@Immutable` annotation
+and the Groovy compiler has generated a lot of boilerplate code for us.
+We can see the code for the generated equals method in the `Source` tab.
-image:assets/img/astbrowser.png[AST Browser]
+image:assets/img/astbrowser_source.png[AST Browser]
+
+We can even examine the JVM bytecode generated by the compiler.
+In the image below we are looking at the bytecode for the Groovy
+expression `LocalDate.parse('2020/02/10', 'yyyy/MM/dd')`.
+
+image:assets/img/astbrowser_bytecode.png[AST Browser]
+
+[[GroovyConsole-CSTbrowser]]
+== Advanced debugging: CST browser
+
+Groovy Console can visualize the CST (Concrete Syntax Tree) representing
+the initial parsing of the script. This is mainly useful for parsing gurus.
+
+image:assets/img/cstbrowser.png[CST Browser]