Squashed commit of the following:

commit 046a216be2
Merge: 570e9db45 198f59397
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Mon Sep 8 18:27:48 2025 +0200

    Merge branch 'main' into gradle-runner

commit 570e9db457
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Fri Jul 18 21:42:08 2025 +0200

    Automatically download jdk

commit 578c287606
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Fri Jul 18 10:43:33 2025 +0200

    Build on save

commit fdc43dc7d2
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Thu Jul 17 15:49:40 2025 +0200

    Hot Reloading plugin

commit 0c674adc54
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Thu Jul 17 12:13:56 2025 +0200

    Initial Gradle Plugin configuration

commit f916d272ac
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 16 11:26:37 2025 +0200

    Adding a settings panel to the editor

    For upcoming plugin support we need a way to enable plugins based on each sketch

commit 550200cc74
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 9 09:41:40 2025 +0200

    Comments and planning

commit c55e286428
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 8 12:23:05 2025 +0200

    Speed up gradle compilations

commit b7123906b4
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 8 11:59:28 2025 +0200

    Fixed rename Windres task

commit a36c8a353b
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 8 10:31:12 2025 +0200

    Plugin tests bugfixes

commit 7379166bc4
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 8 10:26:16 2025 +0200

    Processing Plugin tests & Refactor

commit b64505d476
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Mon Jul 7 16:21:59 2025 +0200

    Gradle Service refactor

commit a11d2ffabe
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Mon Jul 7 15:22:21 2025 +0200

    Logging sketches to separate stream & small refactor

commit 5729e88118
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Mon Jul 7 11:01:58 2025 +0200

    Show error logs to the user

commit b709fe3a9d
Merge: cebc352db d7c6aeba9
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Fri Jul 4 07:36:32 2025 +0200

    Merge branch 'gradle-runner' of https://github.com/Stefterv/processing4 into gradle-runner

commit cebc352db9
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Fri Jul 4 07:36:31 2025 +0200

    Snap support

commit d7c6aeba90
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Fri Jul 4 06:54:50 2025 +0200

    Also copy Untitled sketches

commit 24cb4f4f9b
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Fri Jul 4 06:23:00 2025 +0200

    Improved Error reporting

commit e727dbf596
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 21:33:12 2025 +0200

    Support for readonly sketches

commit b165d0a511
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 21:25:52 2025 +0200

    Add all library jars

commit 772567c540
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 20:34:37 2025 +0200

    Build system indicators, Language keys and filtering SLF4J warnings

commit efd03dba54
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 15:58:02 2025 +0200

    Fixed gradle runner issues

commit 5409912c38
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 13:42:41 2025 +0200

    Improved Gradle Error logging

commit 1762b74c90
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 11:56:34 2025 +0200

    Simplified Gradle Service, improved sketch logging, fixed toolbar state

commit e6474e189f
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 10:29:20 2025 +0200

    Small tweaks and wrote motivation for Gradle Build system

commit 67de82f18d
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 09:53:14 2025 +0200

    Removed error & out streams, has been piped directly into System

commit bd5aba46e8
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 09:50:39 2025 +0200

    Allowing libraries folder to not exist, but log instead

commit fcb554a50c
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Wed Jul 2 09:42:19 2025 +0200

    Rename gradle plugin and further planning

commit 1c429618df
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 1 17:35:32 2025 +0200

    Gradle Task error printing

commit 4cca647724
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 1 17:02:03 2025 +0200

    Updated error reporting

commit 0d1fcc45a9
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 1 14:40:30 2025 +0200

    Added documentation and todo's

commit 0299209245
Author: Stef Tervelde <stef@steftervelde.nl>
Date:   Tue Jul 1 12:59:34 2025 +0200

    Squashed commit of the following:

    commit 3a1aa8e712fa7e26c6fd4f61f11c25c3d63dd1b4
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Jul 1 12:53:59 2025 +0200

        Restore welcome & Cleanup

    commit 7d94b30f60b3b2a685734d945693ab6f2c7abe55
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Jul 1 12:20:17 2025 +0200

        PR Cleanup

    commit 27764e95cbab9b59ff6a714fe82236416b0f4f6f
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Jun 23 13:33:50 2025 +0200

        Update Toolbar.kt

    commit 97fc4c2ec9dea5c8bd21caefa7e5d08b49529232
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Jun 23 13:30:47 2025 +0200

        Removed background job differentiation

    commit 85566c8434f3ded9b54377104fe374d3bfd5826d
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Jun 23 13:09:11 2025 +0200

        CLI Compatibility

    commit 7f2f2b667c63e8c255d615481355cb1878dbe9b5
    Merge: 1c8581e5c bf34adee0
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Jun 23 11:14:57 2025 +0200

        Merge branch 'main' into runner

    commit 1c8581e5cd51ecde11a5915035f143a0dcf31709
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu May 15 13:39:21 2025 +0200

        Move Gradle connection into GradleJob

    commit d7420021ceb2dc368860e1954f9f21a5a238e665
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu May 15 10:10:33 2025 +0200

        Exclude jnilib from sources

    commit 2c9ee1c77aac0e872e9ae124148d331e2dd1a6e0
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu May 15 09:51:08 2025 +0200

        Linux Platform addition

    commit 49988e9b022dcb28d23a43d134301e24072a4ae8
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu May 15 09:34:44 2025 +0200

        Use forward slashes on Windows

    commit da5092ef4c788ee3dd0b00463d9cbd0b698b9e0e
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu May 15 09:10:11 2025 +0200

        Add support for .java files & Cleanup

    commit ab7c216272444d16931bf980db25698045c178c4
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu May 15 08:15:11 2025 +0200

        Preferences in the PDE will now be read from system before looking at files

    commit 7775d016dc7b79fba3830a087b97f344dfe81658
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 18:07:50 2025 +0200

        Identified Bugs

    commit 80c48f2fc584057bb7ce8a340dbd9f7b87855597
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 17:59:07 2025 +0200

        Windows Bugfix

    commit 5ad43e0b49125f2313fa602ff1ef2038f891c64f
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 17:51:57 2025 +0200

        Set a default tab size

    commit 2f99a69a69b80d77166f17d25449e1974f20d495
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 16:14:59 2025 +0200

        Bundle necessary plugins

    commit f9b94c57018a0c0084c851a44c78d78ec73e052f
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 15:17:55 2025 +0200

        Only make parent dirs

    commit 982c1113070a944890cf9dec92d4bcde9a5fe664
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 15:11:54 2025 +0200

        Show debug on gradle tests

    commit 917d0d321356c43c247e9d7b711935802dbe88b8
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 15:08:47 2025 +0200

        Listen for folder changes

    commit 12ce4422e1bc0cd5abf7173d7a001ea0a26cb35f
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 14:25:06 2025 +0200

        Fix saved files using an old version

    commit 04ac9f2678d6308c6c8dffb68cd98bc2973e7863
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 13:47:21 2025 +0200

        Plugin rework for caching heavy work

    commit e31d37d64df6aa9ba29ecc0e5529cf91600a3b28
    Merge: df1277e58 540d299cf
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 10:43:43 2025 +0200

        Merge branch 'main' into runner

    commit df1277e58c5665acb901a3ea81088eafeccdf283
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed May 14 10:39:22 2025 +0200

        Disabled modern UI for now. Added preference instead

    commit c5c3b2f570cabdd1163405057bf8204d1a707336
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Apr 21 14:04:39 2025 +0200

        Added todos

    commit 612126a11f690ab7ec7feb7b86c9f9a786cc10cd
    Merge: 3e89bfe9a ecd219b03
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Apr 17 12:37:06 2025 +0200

        Merge branch 'main' into runner

    commit 3e89bfe9abef46ee456fabf4d7e054a8d593855f
    Merge: efa77bb8d 7489870dd
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Apr 17 12:34:57 2025 +0200

        Merge branch 'runner' of https://github.com/Stefterv/processing4 into runner

    commit efa77bb8d2b46680f13bba14b949e84586c81635
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Apr 1 18:19:58 2025 +0200

        Cleanup

        [skip ci]

    commit 7489870ddf4287adaea4b02fdc3a22b54ba3a941
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Apr 1 18:19:58 2025 +0200

        Cleanup

        [skip ci]

    commit 97ec5e4cb49eb980e87f37155fa3d8a96477e34c
    Merge: 221ee28a0 3d6a6ce1d
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Apr 1 17:54:41 2025 +0200

        Merge branch 'gradle-welcome-screen' into runner

    commit 221ee28a0fcb516b6e0d129ad1028ca4ff7a51ac
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Apr 1 17:53:48 2025 +0200

        Toolbar UI design start

    commit a870cd03fca9113952dc34bc26db5f134ce76b1c
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Apr 1 10:14:22 2025 +0200

        GradleJob Refactor

    commit 2269fd35d9f91b971a163f6b63fb288adb6f9156
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Apr 1 09:15:47 2025 +0200

        Gradle Runner, build script management

    commit 6758d684e7863c887c3b559b7b07eeb8eab32080
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 31 18:40:19 2025 +0200

        Richer console output and richer exception output

    commit 15114a192e36296796f5640874fd816c05e944b5
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 31 15:00:12 2025 +0200

        Retry vm debug connection

    commit 36ce0ab1e3853eb22a28fcd84c560123aa82ae33
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 31 12:05:58 2025 +0200

        Runner: Fixing build errors

    commit 701f9f5db84eb114721c033cd2111d16e3320147
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Mar 30 23:58:36 2025 +0200

        Gradle Runner PoC Refactor

    commit 947a90ea0c204ccd9c5b0139da5eba201dcf2320
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Mar 30 14:51:48 2025 +0200

        Toolbar functionality PoC

    commit 3d6a6ce1df
    Merge: f7f22c5f7 2222331c9
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Mar 30 08:52:37 2025 +0200

        Merge branch 'processing:main' into gradle-welcome-screen

    commit 4602ef179ea92133ca5d264d8f40aea4f40d4024
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 22:50:35 2025 +0100

        Fixes for windows

    commit 0d3795f89343c98ed23d9cadffd1445df25da7ba
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 22:31:47 2025 +0100

        Gradle Runner, more variables

    commit ab38e5f44b5e72cbace4551ecdeddc80b70b75a1
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 20:54:02 2025 +0100

        Arguments refactor

    commit 17acb01cbe30b1949c5ff60d35f5f8c59d6b567f
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 20:10:15 2025 +0100

        Copy running JDK rather than download

    commit b534c26bca8737513f9808f4e737d96a173ce7ce
    Merge: d6cb3eec4 2222331c9
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 18:17:20 2025 +0100

        Merge branch 'main' into runner

    commit d6cb3eec45cdfeac944d5bb271ebd5733f2c36fe
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 10:20:17 2025 +0100

        Fix for signing release

    commit bf82d5327f2368114e499ade3a5eb18b681a4717
    Merge: 73dfa0a6e dd823a7d6
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 10:17:06 2025 +0100

        Merge branch 'runner' of https://github.com/Stefterv/processing4 into runner

    commit 73dfa0a6e19c9318504c5a80d7295e495902041b
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Mar 29 10:17:04 2025 +0100

        Only sign with signing set up

    commit 41ef1cc9813ac6638c85ef0cabfe2121129b363c
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 28 09:00:23 2025 +0100

        Fix plugin name in tests

    commit dd823a7d6cf0f9100a3a8ee803a38e8f2c7718cd
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 28 09:00:23 2025 +0100

        Fix plugin name in tests

    commit 3a14ff40a41979ff7ad25a144f34629c0405e3a0
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 28 08:18:53 2025 +0100

        Added Stubs

    commit 00f8afaa7cd179b720bbd1246c78876295939a2a
    Merge: 700599ed8 1ab2359ca
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 28 08:13:11 2025 +0100

        Merge branch 'schema-threading' into runner

    commit 700599ed8abf775379a6d14c83d4da9b1b9a05a5
    Merge: 1fae4618c 499d200ef
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 28 08:13:06 2025 +0100

        Merge branch 'main' into runner

    commit 1fae4618c926cd27044ae1ed734930943fb8723f
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 21:37:55 2025 +0100

        UI Cleanup

    commit f762a3ee12842bea96cee8b011c3bdcb716d2d21
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 20:05:01 2025 +0100

        Added debugging

    commit c2071a0c2624dde91f70aac1be5d60955dab624c
    Merge: f453eca87 8fb9ef57b
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 18:23:23 2025 +0100

        Merge branch 'hide-scrollbars' into runner

    commit f453eca87fd77d4b2b8fc96bcc9a5574a99099c0
    Merge: 8f47d2110 694eb0cbe
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 18:03:34 2025 +0100

        Merge remote-tracking branch 'upstream/fix-jdk-requirement' into runner

    commit 8f47d211093bbd2bd41146a113b77931cb20ebf5
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 18:00:15 2025 +0100

        Scan libaries for dependencies

    commit 5d71244e0555d3d079e5b2149ba1381e524caa55
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 14:58:11 2025 +0100

        Plugin rework

    commit e164fe48bc1f7ee92029ba7a85ab6a8188fea501
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 13:01:33 2025 +0100

        Gradle variables from Processing, Group resolution

    commit 672c2ac479e6874965fac03a0398b6f68dc79f2d
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Mar 27 11:51:08 2025 +0100

        Removed the need for settings.gradle.kts & Embedding maven repo

    commit cdec594cdd57bd71b4bf0c9525af5c2921edbef0
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Mar 26 18:39:04 2025 +0100

        Added export support

    commit 3ad36547296ed0bfa2f457cf822c2105e90ef8d7
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Mar 26 17:25:51 2025 +0100

        Gradle Runner visual styling

    commit bc063e80dbda0c8f78f86b36227948954382528a
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Mar 26 14:17:25 2025 +0100

        Gradle Runner PoC

    commit 47d3428e6298f26aa8b6b951caaddc0d679a811e
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Mar 23 18:18:54 2025 +0100

        More todo's

    commit 29d76eb1d1
    Merge: ba496569d 9760a63b9
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Mar 23 17:58:39 2025 +0100

        Merge branch 'processing:main' into gradle-plugin

    commit ba496569d8
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Mar 18 10:15:40 2025 +0100

        Adding tests and direct linking

    commit e01d02a8af
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 15:31:25 2025 +0100

        Update settings.gradle.kts

    commit b0b12ddad6
    Merge: 7e6c97add ad5c27ec4
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 15:14:35 2025 +0100

        Merge branch 'gradle-preprocessor' into gradle-plugin

    commit ad5c27ec42
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 15:11:24 2025 +0100

        Apply same parser & lexer fixes from before

    commit 743ea14190
    Merge: c28a2676b 8e8f7dc5a
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 13:53:40 2025 +0100

        Merge branch 'main' into gradle-preprocessor

    commit 7e6c97add9
    Merge: f126d4b62 8e8f7dc5a
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 13:43:21 2025 +0100

        Merge branch 'main' into gradle-plugin

    commit f7f22c5f7c
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 10:40:37 2025 +0100

        Create Directory as well

    commit d17ca0cdcd
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 10:36:35 2025 +0100

        Removed PlatformStart and create new file if doesn't exist

    commit b0e7f96bdd
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Mar 17 10:28:12 2025 +0100

        Added initial tests

    commit 0df4dc076a
    Merge: 6974811be 8e8f7dc5a
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Mar 16 21:18:22 2025 +0100

        Merge branch 'main' into gradle-welcome-screen

    commit 6974811beb
    Merge: 7452d658c 145551246
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Mar 11 20:42:46 2025 +0100

        Merge branch 'test-schema' into gradle-welcome-screen

    commit 7452d658c8
    Merge: babf54e04 fe152b752
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 7 15:07:56 2025 +0100

        Merge branch 'main' into gradle-welcome-screen

    commit c28a2676bd
    Merge: e18833608 fe152b752
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 7 15:06:27 2025 +0100

        Merge branch 'processing:main' into gradle-preprocessor

    commit f126d4b628
    Merge: da852b45a fe152b752
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Mar 7 15:06:08 2025 +0100

        Merge branch 'processing:main' into gradle-plugin

    commit babf54e04d
    Merge: 0e56f895b 00c57607d
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Feb 10 17:58:35 2025 +0100

        Merge branch 'gradle-loggin' into gradle-welcome-screen

    commit 0e56f895bd
    Merge: 54944afc2 29b557a7c
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Feb 9 21:15:36 2025 +0100

        Merge branch 'main-gradle' into gradle-welcome-screen

    commit 54944afc24
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Feb 9 14:36:37 2025 +0100

        Welcome Screen: JDK Module

    commit 8d8bd01d80
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Feb 9 13:54:07 2025 +0100

        Welcome Screen: Close Functionality

    commit 3df4da9461
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Feb 9 12:57:55 2025 +0100

        Welcome Screen: Bugfixes

    commit cb184fb104
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sun Feb 9 12:19:33 2025 +0100

        Welcome Screen: Layout fixes

    commit 3d81b02ffe
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Feb 8 22:47:28 2025 +0100

        Welcome Screen: Language selection

    commit b0c61a4467
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Sat Feb 8 11:10:33 2025 +0100

        Welcome Screen: Load & Display examples

    commit 2f12d13422
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Feb 7 21:53:49 2025 +0100

        Saveable/Reactive Preferences

    commit 8ed2d1b40a
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Feb 7 16:34:23 2025 +0100

        Welcome Screen: WIP

    commit 5c020dd017
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Feb 7 15:49:25 2025 +0100

        Welcome Screen: Initial Layout

    commit bd3a77ef17
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Feb 7 12:09:58 2025 +0100

        Welcome Screen: Window Abstraction

    commit b1910de2e6
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Fri Feb 7 11:24:30 2025 +0100

        Welcome Screen: Initial Frame

    commit da852b45a1
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 20:54:32 2025 +0100

        Fullscreen support

    commit 44ab816ca9
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 20:38:27 2025 +0100

        disable full screen from settings and fixed a few bugs

    commit e18833608b
    Merge: df745bb09 3f3e7d785
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 13:03:51 2025 +0100

        Merge branch 'main-gradle' into gradle/preprocessor

    commit 031d304dbd
    Merge: 25e147eaf 3f3e7d785
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 13:03:12 2025 +0100

        Merge branch 'main-gradle' into gradle/plugin

    commit 25e147eaf1
    Merge: 7f00d5b02 3b9aea1f4
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 12:56:55 2025 +0100

        Merge branch 'main-gradle' into gradle/plugin

    commit df745bb09c
    Merge: f016cc474 3b9aea1f4
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 12:56:38 2025 +0100

        Merge branch 'main-gradle' into gradle/preprocessor

    commit 7f00d5b028
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 12:36:18 2025 +0100

        added example of plugin usage

    commit f4d7fbf99b
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 09:19:08 2025 +0100

        Changed naming

    commit 1b8a8ed461
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 09:10:42 2025 +0100

        Gradle Plugin from PoC

    commit 5468da0fd6
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Tue Feb 4 16:18:29 2025 +0100

        Removed outdated ant backwards compatibility marks

    commit 23c8a4626a
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Mon Feb 3 12:07:01 2025 +0100

        - Imports cleanup
        - Disable system look & feel on macOS for readability
        - Cleaned unnecessary space
        - Cleaned finished TODO

    commit f016cc474c
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Wed Feb 5 12:01:47 2025 +0100

        Removed core dependency from the pre-processor

    commit 971d98bba0
    Author: Stef Tervelde <stef@steftervelde.nl>
    Date:   Thu Jan 30 22:59:16 2025 +0100

        Preprocessor with antlr Plugin
This commit is contained in:
Stef Tervelde
2025-09-08 18:50:25 +02:00
parent e56e281dc3
commit 00e4243374
9 changed files with 1289 additions and 31 deletions

View File

@@ -1,7 +1,8 @@
import com.vanniktech.maven.publish.SonatypeHost
plugins{
id("java")
java
antlr
alias(libs.plugins.mavenPublish)
}
@@ -14,24 +15,44 @@ repositories{
sourceSets{
main{
java{
srcDirs("src/main/java", "../src/", "../generated/")
srcDirs("src/main/java", "../src/")
include("processing/mode/java/preproc/**/*", "processing/app/**/*")
}
}
}
afterEvaluate{
tasks.withType(Jar::class.java){
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(tasks.generateGrammarSource)
}
}
dependencies{
implementation(project(":core"))
implementation(project(":app:utils"))
implementation(libs.antlr)
implementation(libs.eclipseJDT)
implementation(project(":core"))
implementation(project(":app:utils"))
antlr(libs.antlr4)
implementation(libs.antlr4Runtime)
}
publishing{
repositories{
maven {
name = "App"
url = uri(project(":app").layout.buildDirectory.dir("resources-bundled/common/repository").get().asFile.absolutePath)
}
}
}
mavenPublishing{
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
// Only sign if signing is set up
if(project.hasProperty("signing.keyId") || project.hasProperty("signing.signingInMemoryKey"))
signAllPublications()
pom{
name.set("Processing Pre-processor")
@@ -59,13 +80,4 @@ mavenPublishing{
developerConnection.set("scm:git:ssh://git@github.com/processing/processing4.git")
}
}
}
tasks.withType<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
tasks.compileJava{
dependsOn("ant-preproc")
}
ant.importBuild("../build.xml"){ antTaskName ->
"ant-$antTaskName"
}

View File

@@ -0,0 +1,235 @@
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8)
Copyright (c) 2021 Michał Lorek (upgrade to Java 11)
Copyright (c) 2022 Michał Lorek (upgrade to Java 17)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// $antlr-format alignTrailingComments true, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine true, allowShortBlocksOnASingleLine true, minEmptyLines 0, alignSemicolons ownLine
// $antlr-format alignColons trailing, singleLineOverrulesHangingColon true, alignLexerCommands true, alignLabels true, alignTrailers true
lexer grammar JavaLexer;
// Keywords
ABSTRACT : 'abstract';
ASSERT : 'assert';
BOOLEAN : 'boolean';
BREAK : 'break';
BYTE : 'byte';
CASE : 'case';
CATCH : 'catch';
CHAR : 'char';
CLASS : 'class';
CONST : 'const';
CONTINUE : 'continue';
DEFAULT : 'default';
DO : 'do';
DOUBLE : 'double';
ELSE : 'else';
ENUM : 'enum';
EXTENDS : 'extends';
FINAL : 'final';
FINALLY : 'finally';
FLOAT : 'float';
FOR : 'for';
IF : 'if';
GOTO : 'goto';
IMPLEMENTS : 'implements';
IMPORT : 'import';
INSTANCEOF : 'instanceof';
INT : 'int';
INTERFACE : 'interface';
LONG : 'long';
NATIVE : 'native';
NEW : 'new';
PACKAGE : 'package';
PRIVATE : 'private';
PROTECTED : 'protected';
PUBLIC : 'public';
RETURN : 'return';
SHORT : 'short';
STATIC : 'static';
STRICTFP : 'strictfp';
SUPER : 'super';
SWITCH : 'switch';
SYNCHRONIZED : 'synchronized';
THIS : 'this';
THROW : 'throw';
THROWS : 'throws';
TRANSIENT : 'transient';
TRY : 'try';
VOID : 'void';
VOLATILE : 'volatile';
WHILE : 'while';
// Module related keywords
MODULE : 'module';
OPEN : 'open';
REQUIRES : 'requires';
EXPORTS : 'exports';
OPENS : 'opens';
TO : 'to';
USES : 'uses';
PROVIDES : 'provides';
WITH : 'with';
TRANSITIVE : 'transitive';
// Local Variable Type Inference
VAR: 'var'; // reserved type name
// Switch Expressions
YIELD: 'yield'; // reserved type name from Java 14
// Records
RECORD: 'record';
// Sealed Classes
SEALED : 'sealed';
PERMITS : 'permits';
NON_SEALED : 'non-sealed';
// Literals
DECIMAL_LITERAL : ('0' | [1-9] (Digits? | '_'+ Digits)) [lL]?;
HEX_LITERAL : '0' [xX] [0-9a-fA-F] ([0-9a-fA-F_]* [0-9a-fA-F])? [lL]?;
OCT_LITERAL : '0' '_'* [0-7] ([0-7_]* [0-7])? [lL]?;
BINARY_LITERAL : '0' [bB] [01] ([01_]* [01])? [lL]?;
FLOAT_LITERAL:
(Digits '.' Digits? | '.' Digits) ExponentPart? [fFdD]?
| Digits (ExponentPart [fFdD]? | [fFdD])
;
HEX_FLOAT_LITERAL: '0' [xX] (HexDigits '.'? | HexDigits? '.' HexDigits) [pP] [+-]? Digits [fFdD]?;
BOOL_LITERAL: 'true' | 'false';
CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence) '\'';
STRING_LITERAL: '"' (~["\\\r\n] | EscapeSequence)* '"';
MULTI_STRING_LIT: '"""' (~[\\] | EscapeSequence)*? '"""';
TEXT_BLOCK: '"""' [ \t]* [\r\n] (. | EscapeSequence)*? '"""';
NULL_LITERAL: 'null';
// Separators
LPAREN : '(';
RPAREN : ')';
LBRACE : '{';
RBRACE : '}';
LBRACK : '[';
RBRACK : ']';
SEMI : ';';
COMMA : ',';
DOT : '.';
// Operators
ASSIGN : '=';
GT : '>';
LT : '<';
BANG : '!';
TILDE : '~';
QUESTION : '?';
COLON : ':';
EQUAL : '==';
LE : '<=';
GE : '>=';
NOTEQUAL : '!=';
AND : '&&';
OR : '||';
INC : '++';
DEC : '--';
ADD : '+';
SUB : '-';
MUL : '*';
DIV : '/';
BITAND : '&';
BITOR : '|';
CARET : '^';
MOD : '%';
ADD_ASSIGN : '+=';
SUB_ASSIGN : '-=';
MUL_ASSIGN : '*=';
DIV_ASSIGN : '/=';
AND_ASSIGN : '&=';
OR_ASSIGN : '|=';
XOR_ASSIGN : '^=';
MOD_ASSIGN : '%=';
LSHIFT_ASSIGN : '<<=';
RSHIFT_ASSIGN : '>>=';
URSHIFT_ASSIGN : '>>>=';
// Java 8 tokens
ARROW : '->';
COLONCOLON : '::';
// Additional symbols not defined in the lexical specification
AT : '@';
ELLIPSIS : '...';
// Whitespace and comments
WS : [ \t\r\n\u000C]+ -> channel(HIDDEN);
COMMENT : '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT : '//' ~[\r\n]* -> channel(HIDDEN);
// Identifiers
IDENTIFIER: Letter LetterOrDigit*;
// Fragment rules
fragment ExponentPart: [eE] [+-]? Digits;
fragment EscapeSequence:
'\\' 'u005c'? [btnfr"'\\]
| '\\' 'u005c'? ([0-3]? [0-7])? [0-7]
| '\\' 'u'+ HexDigit HexDigit HexDigit HexDigit
;
fragment HexDigits: HexDigit ((HexDigit | '_')* HexDigit)?;
fragment HexDigit: [0-9a-fA-F];
fragment Digits: [0-9] ([0-9_]* [0-9])?;
fragment LetterOrDigit: Letter | [0-9];
fragment Letter:
[a-zA-Z$_] // these are the "java letters" below 0x7F
| ~[\u0000-\u007F\uD800-\uDBFF] // covers all characters above 0x7F which are not a surrogate
| [\uD800-\uDBFF] [\uDC00-\uDFFF] // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF
;

View File

@@ -0,0 +1,826 @@
/*
[The "BSD licence"]
Copyright (c) 2013 Terence Parr, Sam Harwell
Copyright (c) 2017 Ivan Kochurkin (upgrade to Java 8)
Copyright (c) 2021 Michał Lorek (upgrade to Java 11)
Copyright (c) 2022 Michał Lorek (upgrade to Java 17)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// $antlr-format alignTrailingComments true, columnLimit 150, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments false, useTab false
// $antlr-format allowShortRulesOnASingleLine false, allowShortBlocksOnASingleLine true, alignSemicolons hanging, alignColons hanging
parser grammar JavaParser;
options {
tokenVocab = JavaLexer;
}
compilationUnit
: packageDeclaration? (importDeclaration | ';')* (typeDeclaration | ';')* EOF
| moduleDeclaration EOF
;
packageDeclaration
: annotation* PACKAGE qualifiedName ';'
;
importDeclaration
: IMPORT STATIC? qualifiedName ('.' '*')? ';'
;
typeDeclaration
: classOrInterfaceModifier* (
classDeclaration
| enumDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| recordDeclaration
)
;
modifier
: classOrInterfaceModifier
| NATIVE
| SYNCHRONIZED
| TRANSIENT
| VOLATILE
;
classOrInterfaceModifier
: annotation
| PUBLIC
| PROTECTED
| PRIVATE
| STATIC
| ABSTRACT
| FINAL // FINAL for class only -- does not apply to interfaces
| STRICTFP
| SEALED // Java17
| NON_SEALED // Java17
;
variableModifier
: FINAL
| annotation
;
classDeclaration
: CLASS identifier typeParameters? (EXTENDS typeType)? (IMPLEMENTS typeList)? (
PERMITS typeList
)? // Java17
classBody
;
typeParameters
: '<' typeParameter (',' typeParameter)* '>'
;
typeParameter
: annotation* identifier (EXTENDS annotation* typeBound)?
;
typeBound
: typeType ('&' typeType)*
;
enumDeclaration
: ENUM identifier (IMPLEMENTS typeList)? '{' enumConstants? ','? enumBodyDeclarations? '}'
;
enumConstants
: enumConstant (',' enumConstant)*
;
enumConstant
: annotation* identifier arguments? classBody?
;
enumBodyDeclarations
: ';' classBodyDeclaration*
;
interfaceDeclaration
: INTERFACE identifier typeParameters? (EXTENDS typeList)? (PERMITS typeList)? interfaceBody
;
classBody
: '{' classBodyDeclaration* '}'
;
interfaceBody
: '{' interfaceBodyDeclaration* '}'
;
classBodyDeclaration
: ';'
| STATIC? block
| modifier* memberDeclaration
;
memberDeclaration
: recordDeclaration //Java17
| methodDeclaration
| genericMethodDeclaration
| fieldDeclaration
| constructorDeclaration
| genericConstructorDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| classDeclaration
| enumDeclaration
;
/* We use rule this even for void methods which cannot have [] after parameters.
This simplifies grammar and we can consider void to be a type, which
renders the [] matching as a context-sensitive issue or a semantic check
for invalid return type after parsing.
*/
methodDeclaration
: typeTypeOrVoid identifier formalParameters ('[' ']')* (THROWS qualifiedNameList)? methodBody
;
methodBody
: block
| ';'
;
typeTypeOrVoid
: typeType
| VOID
;
genericMethodDeclaration
: typeParameters methodDeclaration
;
genericConstructorDeclaration
: typeParameters constructorDeclaration
;
constructorDeclaration
: identifier formalParameters (THROWS qualifiedNameList)? constructorBody = block
;
compactConstructorDeclaration
: modifier* identifier constructorBody = block
;
fieldDeclaration
: typeType variableDeclarators ';'
;
interfaceBodyDeclaration
: modifier* interfaceMemberDeclaration
| ';'
;
interfaceMemberDeclaration
: recordDeclaration // Java17
| constDeclaration
| interfaceMethodDeclaration
| genericInterfaceMethodDeclaration
| interfaceDeclaration
| annotationTypeDeclaration
| classDeclaration
| enumDeclaration
;
constDeclaration
: typeType constantDeclarator (',' constantDeclarator)* ';'
;
constantDeclarator
: identifier ('[' ']')* '=' variableInitializer
;
// Early versions of Java allows brackets after the method name, eg.
// public int[] return2DArray() [] { ... }
// is the same as
// public int[][] return2DArray() { ... }
interfaceMethodDeclaration
: interfaceMethodModifier* interfaceCommonBodyDeclaration
;
// Java8
interfaceMethodModifier
: annotation
| PUBLIC
| ABSTRACT
| DEFAULT
| STATIC
| STRICTFP
;
genericInterfaceMethodDeclaration
: interfaceMethodModifier* typeParameters interfaceCommonBodyDeclaration
;
interfaceCommonBodyDeclaration
: annotation* typeTypeOrVoid identifier formalParameters ('[' ']')* (THROWS qualifiedNameList)? methodBody
;
variableDeclarators
: variableDeclarator (',' variableDeclarator)*
;
variableDeclarator
: variableDeclaratorId ('=' variableInitializer)?
;
variableDeclaratorId
: identifier ('[' ']')*
;
variableInitializer
: arrayInitializer
| expression
;
arrayInitializer
: '{' (variableInitializer (',' variableInitializer)* ','?)? '}'
;
classOrInterfaceType
: (identifier typeArguments? '.')* typeIdentifier typeArguments?
;
typeArgument
: typeType
| annotation* '?' ((EXTENDS | SUPER) typeType)?
;
qualifiedNameList
: qualifiedName (',' qualifiedName)*
;
formalParameters
: '(' (
receiverParameter?
| receiverParameter (',' formalParameterList)?
| formalParameterList?
) ')'
;
receiverParameter
: typeType (identifier '.')* THIS
;
formalParameterList
: formalParameter (',' formalParameter)* (',' lastFormalParameter)?
| lastFormalParameter
;
formalParameter
: variableModifier* typeType variableDeclaratorId
;
lastFormalParameter
: variableModifier* typeType annotation* '...' variableDeclaratorId
;
// local variable type inference
lambdaLVTIList
: lambdaLVTIParameter (',' lambdaLVTIParameter)*
;
lambdaLVTIParameter
: variableModifier* VAR identifier
;
qualifiedName
: identifier ('.' identifier)*
;
baseStringLiteral
: STRING_LITERAL
;
multilineStringLiteral
: MULTI_STRING_LIT
;
stringLiteral
: baseStringLiteral
| multilineStringLiteral
;
literal
: integerLiteral
| floatLiteral
| CHAR_LITERAL
| stringLiteral
| BOOL_LITERAL
| NULL_LITERAL
| TEXT_BLOCK // Java17
;
integerLiteral
: DECIMAL_LITERAL
| HEX_LITERAL
| OCT_LITERAL
| BINARY_LITERAL
;
floatLiteral
: FLOAT_LITERAL
| HEX_FLOAT_LITERAL
;
// ANNOTATIONS
altAnnotationQualifiedName
: (identifier DOT)* '@' identifier
;
annotation
: ('@' qualifiedName | altAnnotationQualifiedName) (
'(' ( elementValuePairs | elementValue)? ')'
)?
;
elementValuePairs
: elementValuePair (',' elementValuePair)*
;
elementValuePair
: identifier '=' elementValue
;
elementValue
: expression
| annotation
| elementValueArrayInitializer
;
elementValueArrayInitializer
: '{' (elementValue (',' elementValue)*)? ','? '}'
;
annotationTypeDeclaration
: '@' INTERFACE identifier annotationTypeBody
;
annotationTypeBody
: '{' annotationTypeElementDeclaration* '}'
;
annotationTypeElementDeclaration
: modifier* annotationTypeElementRest
| ';' // this is not allowed by the grammar, but apparently allowed by the actual compiler
;
annotationTypeElementRest
: typeType annotationMethodOrConstantRest ';'
| classDeclaration ';'?
| interfaceDeclaration ';'?
| enumDeclaration ';'?
| annotationTypeDeclaration ';'?
| recordDeclaration ';'? // Java17
;
annotationMethodOrConstantRest
: annotationMethodRest
| annotationConstantRest
;
annotationMethodRest
: identifier '(' ')' defaultValue?
;
annotationConstantRest
: variableDeclarators
;
defaultValue
: DEFAULT elementValue
;
// MODULES - Java9
moduleDeclaration
: OPEN? MODULE qualifiedName moduleBody
;
moduleBody
: '{' moduleDirective* '}'
;
moduleDirective
: REQUIRES requiresModifier* qualifiedName ';'
| EXPORTS qualifiedName (TO qualifiedName)? ';'
| OPENS qualifiedName (TO qualifiedName)? ';'
| USES qualifiedName ';'
| PROVIDES qualifiedName WITH qualifiedName ';'
;
requiresModifier
: TRANSITIVE
| STATIC
;
// RECORDS - Java 17
recordDeclaration
: RECORD identifier typeParameters? recordHeader (IMPLEMENTS typeList)? recordBody
;
recordHeader
: '(' recordComponentList? ')'
;
recordComponentList
: recordComponent (',' recordComponent)*
;
recordComponent
: typeType identifier
;
recordBody
: '{' (classBodyDeclaration | compactConstructorDeclaration)* '}'
;
// STATEMENTS / BLOCKS
block
: '{' blockStatement* '}'
;
blockStatement
: localVariableDeclaration ';'
| localTypeDeclaration
| statement
;
localVariableDeclaration
: variableModifier* (VAR identifier '=' expression | typeType variableDeclarators)
;
identifier
: IDENTIFIER
| MODULE
| OPEN
| REQUIRES
| EXPORTS
| OPENS
| TO
| USES
| PROVIDES
| WITH
| TRANSITIVE
| YIELD
| SEALED
| PERMITS
| RECORD
| VAR
;
typeIdentifier // Identifiers that are not restricted for type declarations
: IDENTIFIER
| MODULE
| OPEN
| REQUIRES
| EXPORTS
| OPENS
| TO
| USES
| PROVIDES
| WITH
| TRANSITIVE
| SEALED
| PERMITS
| RECORD
;
localTypeDeclaration
: classOrInterfaceModifier* (classDeclaration | interfaceDeclaration | recordDeclaration)
;
statement
: blockLabel = block
| ASSERT expression (':' expression)? ';'
| IF parExpression statement (ELSE statement)?
| FOR '(' forControl ')' statement
| WHILE parExpression statement
| DO statement WHILE parExpression ';'
| TRY block (catchClause+ finallyBlock? | finallyBlock)
| TRY resourceSpecification block catchClause* finallyBlock?
| SWITCH parExpression '{' switchBlockStatementGroup* switchLabel* '}'
| SYNCHRONIZED parExpression block
| RETURN expression? ';'
| THROW expression ';'
| BREAK identifier? ';'
| CONTINUE identifier? ';'
| YIELD expression ';' // Java17
| SEMI
| statementExpression = expression ';'
| switchExpression ';'? // Java17
| identifierLabel = identifier ':' statement
;
catchClause
: CATCH '(' variableModifier* catchType identifier ')' block
;
catchType
: qualifiedName ('|' qualifiedName)*
;
finallyBlock
: FINALLY block
;
resourceSpecification
: '(' resources ';'? ')'
;
resources
: resource (';' resource)*
;
resource
: variableModifier* (classOrInterfaceType variableDeclaratorId | VAR identifier) '=' expression
| qualifiedName
;
/** Matches cases then statements, both of which are mandatory.
* To handle empty cases at the end, we add switchLabel* to statement.
*/
switchBlockStatementGroup
: switchLabel+ blockStatement+
;
switchLabel
: CASE (
constantExpression = expression
| enumConstantName = IDENTIFIER
| typeType varName = identifier
) ':'
| DEFAULT ':'
;
forControl
: enhancedForControl
| forInit? ';' expression? ';' forUpdate = expressionList?
;
forInit
: localVariableDeclaration
| expressionList
;
enhancedForControl
: variableModifier* (typeType | VAR) variableDeclaratorId ':' expression
;
// EXPRESSIONS
parExpression
: '(' expression ')'
;
expressionList
: expression (',' expression)*
;
methodCall
: (identifier | THIS | SUPER) arguments
;
expression
// Expression order in accordance with https://introcs.cs.princeton.edu/java/11precedence/
// Level 16, Primary, array and member access
: primary #PrimaryExpression
| expression '[' expression ']' #SquareBracketExpression
| expression bop = '.' (
identifier
| methodCall
| THIS
| NEW nonWildcardTypeArguments? innerCreator
| SUPER superSuffix
| explicitGenericInvocation
) #MemberReferenceExpression
// Method calls and method references are part of primary, and hence level 16 precedence
| methodCall #MethodCallExpression
| expression '::' typeArguments? identifier #MethodReferenceExpression
| typeType '::' (typeArguments? identifier | NEW) #MethodReferenceExpression
| classType '::' typeArguments? NEW #MethodReferenceExpression
// Java17
| switchExpression #ExpressionSwitch
// Level 15 Post-increment/decrement operators
| expression postfix = ('++' | '--') #PostIncrementDecrementOperatorExpression
// Level 14, Unary operators
| prefix = ('+' | '-' | '++' | '--' | '~' | '!') expression #UnaryOperatorExpression
// Level 13 Cast and object creation
| '(' annotation* typeType ('&' typeType)* ')' expression #CastExpression
| NEW creator #ObjectCreationExpression
// Level 12 to 1, Remaining operators
// Level 12, Multiplicative operators
| expression bop = ('*' | '/' | '%') expression #BinaryOperatorExpression
// Level 11, Additive operators
| expression bop = ('+' | '-') expression #BinaryOperatorExpression
// Level 10, Shift operators
| expression ('<' '<' | '>' '>' '>' | '>' '>') expression #BinaryOperatorExpression
// Level 9, Relational operators
| expression bop = ('<=' | '>=' | '>' | '<') expression #BinaryOperatorExpression
| expression bop = INSTANCEOF (typeType | pattern) #InstanceOfOperatorExpression
// Level 8, Equality Operators
| expression bop = ('==' | '!=') expression #BinaryOperatorExpression
// Level 7, Bitwise AND
| expression bop = '&' expression #BinaryOperatorExpression
// Level 6, Bitwise XOR
| expression bop = '^' expression #BinaryOperatorExpression
// Level 5, Bitwise OR
| expression bop = '|' expression #BinaryOperatorExpression
// Level 4, Logic AND
| expression bop = '&&' expression #BinaryOperatorExpression
// Level 3, Logic OR
| expression bop = '||' expression #BinaryOperatorExpression
// Level 2, Ternary
| <assoc = right> expression bop = '?' expression ':' expression #TernaryExpression
// Level 1, Assignment
| <assoc = right> expression bop = (
'='
| '+='
| '-='
| '*='
| '/='
| '&='
| '|='
| '^='
| '>>='
| '>>>='
| '<<='
| '%='
) expression #BinaryOperatorExpression
// Level 0, Lambda Expression // Java8
| lambdaExpression #ExpressionLambda
;
// Java17
pattern
: variableModifier* typeType annotation* identifier
;
// Java8
lambdaExpression
: lambdaParameters '->' lambdaBody
;
// Java8
lambdaParameters
: identifier
| '(' formalParameterList? ')'
| '(' identifier (',' identifier)* ')'
| '(' lambdaLVTIList? ')'
;
// Java8
lambdaBody
: expression
| block
;
primary
: '(' expression ')'
| THIS
| SUPER
| literal
| identifier
| typeTypeOrVoid '.' CLASS
| nonWildcardTypeArguments (explicitGenericInvocationSuffix | THIS arguments)
;
// Java17
switchExpression
: SWITCH parExpression '{' switchLabeledRule* '}'
;
// Java17
switchLabeledRule
: CASE (expressionList | NULL_LITERAL | guardedPattern) (ARROW | COLON) switchRuleOutcome
| DEFAULT (ARROW | COLON) switchRuleOutcome
;
// Java17
guardedPattern
: '(' guardedPattern ')'
| variableModifier* typeType annotation* identifier ('&&' expression)*
| guardedPattern '&&' expression
;
// Java17
switchRuleOutcome
: block
| blockStatement*
;
classType
: (classOrInterfaceType '.')? annotation* identifier typeArguments?
;
creator
: nonWildcardTypeArguments? createdName classCreatorRest
| createdName arrayCreatorRest
;
createdName
: identifier typeArgumentsOrDiamond? ('.' identifier typeArgumentsOrDiamond?)*
| primitiveType
;
innerCreator
: identifier nonWildcardTypeArgumentsOrDiamond? classCreatorRest
;
arrayCreatorRest
: ('[' ']')+ arrayInitializer
| ('[' expression ']')+ ('[' ']')*
;
classCreatorRest
: arguments classBody?
;
explicitGenericInvocation
: nonWildcardTypeArguments explicitGenericInvocationSuffix
;
typeArgumentsOrDiamond
: '<' '>'
| typeArguments
;
nonWildcardTypeArgumentsOrDiamond
: '<' '>'
| nonWildcardTypeArguments
;
nonWildcardTypeArguments
: '<' typeList '>'
;
typeList
: typeType (',' typeType)*
;
typeType
: annotation* (classOrInterfaceType | primitiveType) (annotation* '[' ']')*
;
primitiveType
: BOOLEAN
| CHAR
| BYTE
| SHORT
| INT
| LONG
| FLOAT
| DOUBLE
;
typeArguments
: '<' typeArgument (',' typeArgument)* '>'
;
superSuffix
: arguments
| '.' typeArguments? identifier arguments?
;
explicitGenericInvocationSuffix
: SUPER superSuffix
| identifier arguments
;
arguments
: '(' expressionList? ')'
;

View File

@@ -0,0 +1,147 @@
/**
* Based on Java 1.7 grammar for ANTLR 4, see Java.g4
*
* - changes main entry point to reflect sketch types 'static' | 'active'
* - adds support for type converter functions like "int()"
* - adds pseudo primitive type "color"
* - adds HTML hex notation with hash symbol: #ff5522
* - allow color to appear as part of qualified names (like in imports)
*/
grammar Processing;
@lexer::members {
public static final int WHITESPACE = 1;
public static final int COMMENTS = 2;
}
@header {
package processing.mode.java.preproc;
}
// import Java grammar
import JavaParser, JavaLexer;
// main entry point, select sketch type
processingSketch
: staticProcessingSketch
| javaProcessingSketch
| activeProcessingSketch
// | warnMixedModes
;
// java mode, is a compilation unit
javaProcessingSketch
: packageDeclaration? importDeclaration* typeDeclaration+ EOF
;
// No method declarations, just statements
staticProcessingSketch
: (importDeclaration | blockStatement | typeDeclaration)* EOF
;
// active mode, has function definitions
activeProcessingSketch
: (importDeclaration | classBodyDeclaration)* EOF
;
// User incorrectly mixing modes. Included to allow for kind error message.
warnMixedModes
: (importDeclaration | classBodyDeclaration | blockStatement)* blockStatement classBodyDeclaration (importDeclaration | classBodyDeclaration | blockStatement)*
| (importDeclaration | classBodyDeclaration | blockStatement)* classBodyDeclaration blockStatement (importDeclaration | classBodyDeclaration | blockStatement)*
;
variableDeclaratorId
: warnTypeAsVariableName
| IDENTIFIER ('[' ']')*
;
// bug #93
// https://github.com/processing/processing/issues/93
// prevent from types being used as variable names
warnTypeAsVariableName
: primitiveType ('[' ']')* {
notifyErrorListeners("Type names are not allowed as variable names: "+$primitiveType.text);
}
;
// catch special API function calls that we are interested in
methodCall
: functionWithPrimitiveTypeName
| IDENTIFIER '(' expressionList? ')'
| THIS '(' expressionList? ')'
| SUPER '(' expressionList? ')'
;
// these are primitive type names plus "()"
// "color" is a special Processing primitive (== int)
functionWithPrimitiveTypeName
: ( 'boolean'
| 'byte'
| 'char'
| 'float'
| 'int'
| 'color'
) '(' expressionList? ')'
;
// adding support for "color" primitive
primitiveType
: BOOLEAN
| CHAR
| BYTE
| SHORT
| INT
| LONG
| FLOAT
| DOUBLE
| colorPrimitiveType
;
colorPrimitiveType
: 'color'
;
qualifiedName
: (IDENTIFIER | colorPrimitiveType) ('.' (IDENTIFIER | colorPrimitiveType))*
;
// added HexColorLiteral
literal
: integerLiteral
| floatLiteral
| CHAR_LITERAL
| stringLiteral
| BOOL_LITERAL
| NULL_LITERAL
| hexColorLiteral
;
// As parser rule so this produces a separate listener
// for us to alter its value.
hexColorLiteral
: HexColorLiteral
;
// add color literal notations for
// #ff5522
HexColorLiteral
: '#' (HexDigit HexDigit)? HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit
;
// hide but do not remove whitespace and comments
WS : [ \t\r\n\u000C]+ -> channel(1)
;
COMMENT
: '/*' .*? '*/' -> channel(2)
;
LINE_COMMENT
: '//' ~[\r\n]* -> channel(2)
;
CHAR_LITERAL
: '\'' (~['\\\r\n] | EscapeSequence)* '\'' // A bit nasty but let JDT tackle invalid chars
;

View File

@@ -15,7 +15,21 @@ public class Platform {
}
settingsFolder = new File(appData + "\\Processing");
} else {
settingsFolder = new File(System.getProperty("user.home") + "/.processing");
// Check to see if the user has set a different location for their config
String configHomeEnv = System.getenv("XDG_CONFIG_HOME");
if (configHomeEnv != null && !configHomeEnv.isBlank()) {
settingsFolder = new File(configHomeEnv);
if (!settingsFolder.exists()) {
settingsFolder = null; // don't use non-existent folder
}
}
String snapUserCommon = System.getenv("SNAP_USER_COMMON");
if (snapUserCommon != null && !snapUserCommon.isBlank()) {
settingsFolder = new File(snapUserCommon);
}
if (settingsFolder == null) {
settingsFolder = new File(System.getProperty("user.home"), ".config");
}
}
return settingsFolder;
}

View File

@@ -58,7 +58,7 @@ public class Preferences {
}
}
static public boolean getBoolean(String attribute) {
String value = get(attribute); //, null);
String value = get(attribute);
return Boolean.parseBoolean(value);
}
static public int getInteger(String attribute /*, int defaultValue*/) {