From 00e4243374cc56e22214c3a5dc169e99960de18b Mon Sep 17 00:00:00 2001 From: Stef Tervelde Date: Mon, 8 Sep 2025 18:50:25 +0200 Subject: [PATCH] Squashed commit of the following: commit 046a216be25ee63690be773f8d6fca1f42ddfb6f Merge: 570e9db45 198f59397 Author: Stef Tervelde Date: Mon Sep 8 18:27:48 2025 +0200 Merge branch 'main' into gradle-runner commit 570e9db45767a5cd0368c819cc46eb2280462404 Author: Stef Tervelde Date: Fri Jul 18 21:42:08 2025 +0200 Automatically download jdk commit 578c2876066d07a0df415f8581a45d60cb092984 Author: Stef Tervelde Date: Fri Jul 18 10:43:33 2025 +0200 Build on save commit fdc43dc7d284fabd405acdce859e95cd3382b32d Author: Stef Tervelde Date: Thu Jul 17 15:49:40 2025 +0200 Hot Reloading plugin commit 0c674adc54adbe1b420c844989d198764086a351 Author: Stef Tervelde Date: Thu Jul 17 12:13:56 2025 +0200 Initial Gradle Plugin configuration commit f916d272acbd5297cf4865948a0500eefae99bd4 Author: Stef Tervelde 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 550200cc7437e5e3538878440b929b83de02fb50 Author: Stef Tervelde Date: Wed Jul 9 09:41:40 2025 +0200 Comments and planning commit c55e2864280013045ed0a8dbe784d022f07617d6 Author: Stef Tervelde Date: Tue Jul 8 12:23:05 2025 +0200 Speed up gradle compilations commit b7123906b4b1e698a4532da560911b7e3d6e9801 Author: Stef Tervelde Date: Tue Jul 8 11:59:28 2025 +0200 Fixed rename Windres task commit a36c8a353b4bdfef31a3089a8a1d9115e228be6a Author: Stef Tervelde Date: Tue Jul 8 10:31:12 2025 +0200 Plugin tests bugfixes commit 7379166bc482f3d17c59eeafbe272e9f6d647a32 Author: Stef Tervelde Date: Tue Jul 8 10:26:16 2025 +0200 Processing Plugin tests & Refactor commit b64505d47662419e9332a41cdf7a883b60fb2fba Author: Stef Tervelde Date: Mon Jul 7 16:21:59 2025 +0200 Gradle Service refactor commit a11d2ffabec8a1d18d1541eb1efb1d4cfd2220d7 Author: Stef Tervelde Date: Mon Jul 7 15:22:21 2025 +0200 Logging sketches to separate stream & small refactor commit 5729e8811882754e51868b7d443223870a001f3f Author: Stef Tervelde Date: Mon Jul 7 11:01:58 2025 +0200 Show error logs to the user commit b709fe3a9d0d1b40db0a970b5b728ed481e859fd Merge: cebc352db d7c6aeba9 Author: Stef Tervelde Date: Fri Jul 4 07:36:32 2025 +0200 Merge branch 'gradle-runner' of https://github.com/Stefterv/processing4 into gradle-runner commit cebc352db9fc863f12e8c3798073d27a84ab6594 Author: Stef Tervelde Date: Fri Jul 4 07:36:31 2025 +0200 Snap support commit d7c6aeba90d452727cb970b39cbdcf1b635538e0 Author: Stef Tervelde Date: Fri Jul 4 06:54:50 2025 +0200 Also copy Untitled sketches commit 24cb4f4f9b1161ec10472c11b86aee9481124162 Author: Stef Tervelde Date: Fri Jul 4 06:23:00 2025 +0200 Improved Error reporting commit e727dbf59654462b015d38cf06161d6c40a5f02a Author: Stef Tervelde Date: Wed Jul 2 21:33:12 2025 +0200 Support for readonly sketches commit b165d0a511b8e7b81327744daaf0efec7ce3c3f1 Author: Stef Tervelde Date: Wed Jul 2 21:25:52 2025 +0200 Add all library jars commit 772567c54074c59485e0c19a8ba0ffddf7c4252f Author: Stef Tervelde Date: Wed Jul 2 20:34:37 2025 +0200 Build system indicators, Language keys and filtering SLF4J warnings commit efd03dba54654775cb6c481f688776774ffe7602 Author: Stef Tervelde Date: Wed Jul 2 15:58:02 2025 +0200 Fixed gradle runner issues commit 5409912c38f2740dd165f04aa025a97dc36ff0d7 Author: Stef Tervelde Date: Wed Jul 2 13:42:41 2025 +0200 Improved Gradle Error logging commit 1762b74c90cb98d6cf28e15b944c5474882780e8 Author: Stef Tervelde Date: Wed Jul 2 11:56:34 2025 +0200 Simplified Gradle Service, improved sketch logging, fixed toolbar state commit e6474e189fa47bdffcd3cb8198095427188b3cd7 Author: Stef Tervelde Date: Wed Jul 2 10:29:20 2025 +0200 Small tweaks and wrote motivation for Gradle Build system commit 67de82f18d564555796f8184f5fddafd4b8102b5 Author: Stef Tervelde Date: Wed Jul 2 09:53:14 2025 +0200 Removed error & out streams, has been piped directly into System commit bd5aba46e8103d1546b213dabf127023b0fcabb2 Author: Stef Tervelde Date: Wed Jul 2 09:50:39 2025 +0200 Allowing libraries folder to not exist, but log instead commit fcb554a50c186a7c12e604cfe56df0bad8e2f7b1 Author: Stef Tervelde Date: Wed Jul 2 09:42:19 2025 +0200 Rename gradle plugin and further planning commit 1c429618dfc903f7050fc71bd3fbad20e9899f38 Author: Stef Tervelde Date: Tue Jul 1 17:35:32 2025 +0200 Gradle Task error printing commit 4cca647724a265d01084580676d5eb7eeeace08f Author: Stef Tervelde Date: Tue Jul 1 17:02:03 2025 +0200 Updated error reporting commit 0d1fcc45a94198a8663e8edf7986a49908a8bcf7 Author: Stef Tervelde Date: Tue Jul 1 14:40:30 2025 +0200 Added documentation and todo's commit 029920924527c6ec93614dfc397db99b3a265d2a Author: Stef Tervelde Date: Tue Jul 1 12:59:34 2025 +0200 Squashed commit of the following: commit 3a1aa8e712fa7e26c6fd4f61f11c25c3d63dd1b4 Author: Stef Tervelde Date: Tue Jul 1 12:53:59 2025 +0200 Restore welcome & Cleanup commit 7d94b30f60b3b2a685734d945693ab6f2c7abe55 Author: Stef Tervelde Date: Tue Jul 1 12:20:17 2025 +0200 PR Cleanup commit 27764e95cbab9b59ff6a714fe82236416b0f4f6f Author: Stef Tervelde Date: Mon Jun 23 13:33:50 2025 +0200 Update Toolbar.kt commit 97fc4c2ec9dea5c8bd21caefa7e5d08b49529232 Author: Stef Tervelde Date: Mon Jun 23 13:30:47 2025 +0200 Removed background job differentiation commit 85566c8434f3ded9b54377104fe374d3bfd5826d Author: Stef Tervelde Date: Mon Jun 23 13:09:11 2025 +0200 CLI Compatibility commit 7f2f2b667c63e8c255d615481355cb1878dbe9b5 Merge: 1c8581e5c bf34adee0 Author: Stef Tervelde Date: Mon Jun 23 11:14:57 2025 +0200 Merge branch 'main' into runner commit 1c8581e5cd51ecde11a5915035f143a0dcf31709 Author: Stef Tervelde Date: Thu May 15 13:39:21 2025 +0200 Move Gradle connection into GradleJob commit d7420021ceb2dc368860e1954f9f21a5a238e665 Author: Stef Tervelde Date: Thu May 15 10:10:33 2025 +0200 Exclude jnilib from sources commit 2c9ee1c77aac0e872e9ae124148d331e2dd1a6e0 Author: Stef Tervelde Date: Thu May 15 09:51:08 2025 +0200 Linux Platform addition commit 49988e9b022dcb28d23a43d134301e24072a4ae8 Author: Stef Tervelde Date: Thu May 15 09:34:44 2025 +0200 Use forward slashes on Windows commit da5092ef4c788ee3dd0b00463d9cbd0b698b9e0e Author: Stef Tervelde Date: Thu May 15 09:10:11 2025 +0200 Add support for .java files & Cleanup commit ab7c216272444d16931bf980db25698045c178c4 Author: Stef Tervelde 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 Date: Wed May 14 18:07:50 2025 +0200 Identified Bugs commit 80c48f2fc584057bb7ce8a340dbd9f7b87855597 Author: Stef Tervelde Date: Wed May 14 17:59:07 2025 +0200 Windows Bugfix commit 5ad43e0b49125f2313fa602ff1ef2038f891c64f Author: Stef Tervelde Date: Wed May 14 17:51:57 2025 +0200 Set a default tab size commit 2f99a69a69b80d77166f17d25449e1974f20d495 Author: Stef Tervelde Date: Wed May 14 16:14:59 2025 +0200 Bundle necessary plugins commit f9b94c57018a0c0084c851a44c78d78ec73e052f Author: Stef Tervelde Date: Wed May 14 15:17:55 2025 +0200 Only make parent dirs commit 982c1113070a944890cf9dec92d4bcde9a5fe664 Author: Stef Tervelde Date: Wed May 14 15:11:54 2025 +0200 Show debug on gradle tests commit 917d0d321356c43c247e9d7b711935802dbe88b8 Author: Stef Tervelde Date: Wed May 14 15:08:47 2025 +0200 Listen for folder changes commit 12ce4422e1bc0cd5abf7173d7a001ea0a26cb35f Author: Stef Tervelde Date: Wed May 14 14:25:06 2025 +0200 Fix saved files using an old version commit 04ac9f2678d6308c6c8dffb68cd98bc2973e7863 Author: Stef Tervelde Date: Wed May 14 13:47:21 2025 +0200 Plugin rework for caching heavy work commit e31d37d64df6aa9ba29ecc0e5529cf91600a3b28 Merge: df1277e58 540d299cf Author: Stef Tervelde Date: Wed May 14 10:43:43 2025 +0200 Merge branch 'main' into runner commit df1277e58c5665acb901a3ea81088eafeccdf283 Author: Stef Tervelde Date: Wed May 14 10:39:22 2025 +0200 Disabled modern UI for now. Added preference instead commit c5c3b2f570cabdd1163405057bf8204d1a707336 Author: Stef Tervelde Date: Mon Apr 21 14:04:39 2025 +0200 Added todos commit 612126a11f690ab7ec7feb7b86c9f9a786cc10cd Merge: 3e89bfe9a ecd219b03 Author: Stef Tervelde Date: Thu Apr 17 12:37:06 2025 +0200 Merge branch 'main' into runner commit 3e89bfe9abef46ee456fabf4d7e054a8d593855f Merge: efa77bb8d 7489870dd Author: Stef Tervelde 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 Date: Tue Apr 1 18:19:58 2025 +0200 Cleanup [skip ci] commit 7489870ddf4287adaea4b02fdc3a22b54ba3a941 Author: Stef Tervelde Date: Tue Apr 1 18:19:58 2025 +0200 Cleanup [skip ci] commit 97ec5e4cb49eb980e87f37155fa3d8a96477e34c Merge: 221ee28a0 3d6a6ce1d Author: Stef Tervelde Date: Tue Apr 1 17:54:41 2025 +0200 Merge branch 'gradle-welcome-screen' into runner commit 221ee28a0fcb516b6e0d129ad1028ca4ff7a51ac Author: Stef Tervelde Date: Tue Apr 1 17:53:48 2025 +0200 Toolbar UI design start commit a870cd03fca9113952dc34bc26db5f134ce76b1c Author: Stef Tervelde Date: Tue Apr 1 10:14:22 2025 +0200 GradleJob Refactor commit 2269fd35d9f91b971a163f6b63fb288adb6f9156 Author: Stef Tervelde Date: Tue Apr 1 09:15:47 2025 +0200 Gradle Runner, build script management commit 6758d684e7863c887c3b559b7b07eeb8eab32080 Author: Stef Tervelde Date: Mon Mar 31 18:40:19 2025 +0200 Richer console output and richer exception output commit 15114a192e36296796f5640874fd816c05e944b5 Author: Stef Tervelde Date: Mon Mar 31 15:00:12 2025 +0200 Retry vm debug connection commit 36ce0ab1e3853eb22a28fcd84c560123aa82ae33 Author: Stef Tervelde Date: Mon Mar 31 12:05:58 2025 +0200 Runner: Fixing build errors commit 701f9f5db84eb114721c033cd2111d16e3320147 Author: Stef Tervelde Date: Sun Mar 30 23:58:36 2025 +0200 Gradle Runner PoC Refactor commit 947a90ea0c204ccd9c5b0139da5eba201dcf2320 Author: Stef Tervelde Date: Sun Mar 30 14:51:48 2025 +0200 Toolbar functionality PoC commit 3d6a6ce1dfbb11650eeaa65de7a985f9d23f49d2 Merge: f7f22c5f7 2222331c9 Author: Stef Tervelde Date: Sun Mar 30 08:52:37 2025 +0200 Merge branch 'processing:main' into gradle-welcome-screen commit 4602ef179ea92133ca5d264d8f40aea4f40d4024 Author: Stef Tervelde Date: Sat Mar 29 22:50:35 2025 +0100 Fixes for windows commit 0d3795f89343c98ed23d9cadffd1445df25da7ba Author: Stef Tervelde Date: Sat Mar 29 22:31:47 2025 +0100 Gradle Runner, more variables commit ab38e5f44b5e72cbace4551ecdeddc80b70b75a1 Author: Stef Tervelde Date: Sat Mar 29 20:54:02 2025 +0100 Arguments refactor commit 17acb01cbe30b1949c5ff60d35f5f8c59d6b567f Author: Stef Tervelde Date: Sat Mar 29 20:10:15 2025 +0100 Copy running JDK rather than download commit b534c26bca8737513f9808f4e737d96a173ce7ce Merge: d6cb3eec4 2222331c9 Author: Stef Tervelde Date: Sat Mar 29 18:17:20 2025 +0100 Merge branch 'main' into runner commit d6cb3eec45cdfeac944d5bb271ebd5733f2c36fe Author: Stef Tervelde Date: Sat Mar 29 10:20:17 2025 +0100 Fix for signing release commit bf82d5327f2368114e499ade3a5eb18b681a4717 Merge: 73dfa0a6e dd823a7d6 Author: Stef Tervelde 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 Date: Sat Mar 29 10:17:04 2025 +0100 Only sign with signing set up commit 41ef1cc9813ac6638c85ef0cabfe2121129b363c Author: Stef Tervelde Date: Fri Mar 28 09:00:23 2025 +0100 Fix plugin name in tests commit dd823a7d6cf0f9100a3a8ee803a38e8f2c7718cd Author: Stef Tervelde Date: Fri Mar 28 09:00:23 2025 +0100 Fix plugin name in tests commit 3a14ff40a41979ff7ad25a144f34629c0405e3a0 Author: Stef Tervelde Date: Fri Mar 28 08:18:53 2025 +0100 Added Stubs commit 00f8afaa7cd179b720bbd1246c78876295939a2a Merge: 700599ed8 1ab2359ca Author: Stef Tervelde Date: Fri Mar 28 08:13:11 2025 +0100 Merge branch 'schema-threading' into runner commit 700599ed8abf775379a6d14c83d4da9b1b9a05a5 Merge: 1fae4618c 499d200ef Author: Stef Tervelde Date: Fri Mar 28 08:13:06 2025 +0100 Merge branch 'main' into runner commit 1fae4618c926cd27044ae1ed734930943fb8723f Author: Stef Tervelde Date: Thu Mar 27 21:37:55 2025 +0100 UI Cleanup commit f762a3ee12842bea96cee8b011c3bdcb716d2d21 Author: Stef Tervelde Date: Thu Mar 27 20:05:01 2025 +0100 Added debugging commit c2071a0c2624dde91f70aac1be5d60955dab624c Merge: f453eca87 8fb9ef57b Author: Stef Tervelde Date: Thu Mar 27 18:23:23 2025 +0100 Merge branch 'hide-scrollbars' into runner commit f453eca87fd77d4b2b8fc96bcc9a5574a99099c0 Merge: 8f47d2110 694eb0cbe Author: Stef Tervelde Date: Thu Mar 27 18:03:34 2025 +0100 Merge remote-tracking branch 'upstream/fix-jdk-requirement' into runner commit 8f47d211093bbd2bd41146a113b77931cb20ebf5 Author: Stef Tervelde Date: Thu Mar 27 18:00:15 2025 +0100 Scan libaries for dependencies commit 5d71244e0555d3d079e5b2149ba1381e524caa55 Author: Stef Tervelde Date: Thu Mar 27 14:58:11 2025 +0100 Plugin rework commit e164fe48bc1f7ee92029ba7a85ab6a8188fea501 Author: Stef Tervelde Date: Thu Mar 27 13:01:33 2025 +0100 Gradle variables from Processing, Group resolution commit 672c2ac479e6874965fac03a0398b6f68dc79f2d Author: Stef Tervelde Date: Thu Mar 27 11:51:08 2025 +0100 Removed the need for settings.gradle.kts & Embedding maven repo commit cdec594cdd57bd71b4bf0c9525af5c2921edbef0 Author: Stef Tervelde Date: Wed Mar 26 18:39:04 2025 +0100 Added export support commit 3ad36547296ed0bfa2f457cf822c2105e90ef8d7 Author: Stef Tervelde Date: Wed Mar 26 17:25:51 2025 +0100 Gradle Runner visual styling commit bc063e80dbda0c8f78f86b36227948954382528a Author: Stef Tervelde Date: Wed Mar 26 14:17:25 2025 +0100 Gradle Runner PoC commit 47d3428e6298f26aa8b6b951caaddc0d679a811e Author: Stef Tervelde Date: Sun Mar 23 18:18:54 2025 +0100 More todo's commit 29d76eb1d1406b81cd276ffd4ccd325edb86b930 Merge: ba496569d 9760a63b9 Author: Stef Tervelde Date: Sun Mar 23 17:58:39 2025 +0100 Merge branch 'processing:main' into gradle-plugin commit ba496569d8f048448dd6e8e92b2faaf443cf27a7 Author: Stef Tervelde Date: Tue Mar 18 10:15:40 2025 +0100 Adding tests and direct linking commit e01d02a8af6aa7ddc53e5a1900561473a2ed6a99 Author: Stef Tervelde Date: Mon Mar 17 15:31:25 2025 +0100 Update settings.gradle.kts commit b0b12ddad6676e81c2981c76b270ed745ac681bd Merge: 7e6c97add ad5c27ec4 Author: Stef Tervelde Date: Mon Mar 17 15:14:35 2025 +0100 Merge branch 'gradle-preprocessor' into gradle-plugin commit ad5c27ec42dc6f479c1c4cee2b119568ba8fa252 Author: Stef Tervelde Date: Mon Mar 17 15:11:24 2025 +0100 Apply same parser & lexer fixes from before commit 743ea141904c0d37127c4de6b52ed7d35ece3f32 Merge: c28a2676b 8e8f7dc5a Author: Stef Tervelde Date: Mon Mar 17 13:53:40 2025 +0100 Merge branch 'main' into gradle-preprocessor commit 7e6c97add90a4eb8f3ebc49faf40dcd0e61b9951 Merge: f126d4b62 8e8f7dc5a Author: Stef Tervelde Date: Mon Mar 17 13:43:21 2025 +0100 Merge branch 'main' into gradle-plugin commit f7f22c5f7ce8434a058d3cc5411f541777cc637e Author: Stef Tervelde Date: Mon Mar 17 10:40:37 2025 +0100 Create Directory as well commit d17ca0cdcda2080cf458c0352fc89e80ef4f57a7 Author: Stef Tervelde Date: Mon Mar 17 10:36:35 2025 +0100 Removed PlatformStart and create new file if doesn't exist commit b0e7f96bddafc1a40c59d47cd81ef9919632ce84 Author: Stef Tervelde Date: Mon Mar 17 10:28:12 2025 +0100 Added initial tests commit 0df4dc076ac6d50730e09348b941a39451197b33 Merge: 6974811be 8e8f7dc5a Author: Stef Tervelde Date: Sun Mar 16 21:18:22 2025 +0100 Merge branch 'main' into gradle-welcome-screen commit 6974811beb562c7c3bd6fb3ae4d94bf9831d6d3c Merge: 7452d658c 145551246 Author: Stef Tervelde Date: Tue Mar 11 20:42:46 2025 +0100 Merge branch 'test-schema' into gradle-welcome-screen commit 7452d658c8fdb53815d7e5f3ed7ddcaecef302aa Merge: babf54e04 fe152b752 Author: Stef Tervelde Date: Fri Mar 7 15:07:56 2025 +0100 Merge branch 'main' into gradle-welcome-screen commit c28a2676bd9439106800d502c856b798bd1cfc34 Merge: e18833608 fe152b752 Author: Stef Tervelde Date: Fri Mar 7 15:06:27 2025 +0100 Merge branch 'processing:main' into gradle-preprocessor commit f126d4b6286c3f7363d13cab8797702f8cadb66c Merge: da852b45a fe152b752 Author: Stef Tervelde Date: Fri Mar 7 15:06:08 2025 +0100 Merge branch 'processing:main' into gradle-plugin commit babf54e04dde6ba972139c8e5744d4a6f9b449f4 Merge: 0e56f895b 00c57607d Author: Stef Tervelde Date: Mon Feb 10 17:58:35 2025 +0100 Merge branch 'gradle-loggin' into gradle-welcome-screen commit 0e56f895bdaac2c7597d9870eba440cd6fad0997 Merge: 54944afc2 29b557a7c Author: Stef Tervelde Date: Sun Feb 9 21:15:36 2025 +0100 Merge branch 'main-gradle' into gradle-welcome-screen commit 54944afc24a1058bf6fcc5a9899bfdeaa1283229 Author: Stef Tervelde Date: Sun Feb 9 14:36:37 2025 +0100 Welcome Screen: JDK Module commit 8d8bd01d806257367b1a006f0da23b926b8f8ae3 Author: Stef Tervelde Date: Sun Feb 9 13:54:07 2025 +0100 Welcome Screen: Close Functionality commit 3df4da94618ed66d9a2b48a601b0ce7bac9a2d4e Author: Stef Tervelde Date: Sun Feb 9 12:57:55 2025 +0100 Welcome Screen: Bugfixes commit cb184fb104ac9c4ead2e6352573f726189da7b70 Author: Stef Tervelde Date: Sun Feb 9 12:19:33 2025 +0100 Welcome Screen: Layout fixes commit 3d81b02ffed2c28560bc2067f1584e05db0bad51 Author: Stef Tervelde Date: Sat Feb 8 22:47:28 2025 +0100 Welcome Screen: Language selection commit b0c61a4467e8c9f5d02bcc8c84e47908fad22d95 Author: Stef Tervelde Date: Sat Feb 8 11:10:33 2025 +0100 Welcome Screen: Load & Display examples commit 2f12d13422c0359562663d93202fe7ce80c3c949 Author: Stef Tervelde Date: Fri Feb 7 21:53:49 2025 +0100 Saveable/Reactive Preferences commit 8ed2d1b40acdc38e0ecde7a5831ef47a9ad1559b Author: Stef Tervelde Date: Fri Feb 7 16:34:23 2025 +0100 Welcome Screen: WIP commit 5c020dd0170153bd1a31ffaeed853966e66c5175 Author: Stef Tervelde Date: Fri Feb 7 15:49:25 2025 +0100 Welcome Screen: Initial Layout commit bd3a77ef17a456aa2ceb281cc2cf293f8be9d685 Author: Stef Tervelde Date: Fri Feb 7 12:09:58 2025 +0100 Welcome Screen: Window Abstraction commit b1910de2e61f6b8b2492b9847ba7f35eec67317a Author: Stef Tervelde Date: Fri Feb 7 11:24:30 2025 +0100 Welcome Screen: Initial Frame commit da852b45a109e27b3b3226fd78a0efd41b695fad Author: Stef Tervelde Date: Wed Feb 5 20:54:32 2025 +0100 Fullscreen support commit 44ab816ca9fe2113f1868c3bda3372afaa9fec5d Author: Stef Tervelde Date: Wed Feb 5 20:38:27 2025 +0100 disable full screen from settings and fixed a few bugs commit e18833608b1f66866d17dbf8f75708e409fe6022 Merge: df745bb09 3f3e7d785 Author: Stef Tervelde Date: Wed Feb 5 13:03:51 2025 +0100 Merge branch 'main-gradle' into gradle/preprocessor commit 031d304dbd6aa73998e07fa696b691e85dd9c2b1 Merge: 25e147eaf 3f3e7d785 Author: Stef Tervelde Date: Wed Feb 5 13:03:12 2025 +0100 Merge branch 'main-gradle' into gradle/plugin commit 25e147eaf1bdfa8b245e86447d2066bded147b44 Merge: 7f00d5b02 3b9aea1f4 Author: Stef Tervelde Date: Wed Feb 5 12:56:55 2025 +0100 Merge branch 'main-gradle' into gradle/plugin commit df745bb09c080929bc64d70bf90d27e9da807d8f Merge: f016cc474 3b9aea1f4 Author: Stef Tervelde Date: Wed Feb 5 12:56:38 2025 +0100 Merge branch 'main-gradle' into gradle/preprocessor commit 7f00d5b0289dda41d92b126149a81f20d1ccdc31 Author: Stef Tervelde Date: Wed Feb 5 12:36:18 2025 +0100 added example of plugin usage commit f4d7fbf99b399889de6b6d0bbafa0148dcb84782 Author: Stef Tervelde Date: Wed Feb 5 09:19:08 2025 +0100 Changed naming commit 1b8a8ed461cb39eb0489564589e144178fb1bef5 Author: Stef Tervelde Date: Wed Feb 5 09:10:42 2025 +0100 Gradle Plugin from PoC commit 5468da0fd6b42f790340acb3e2d00472ae5f42af Author: Stef Tervelde Date: Tue Feb 4 16:18:29 2025 +0100 Removed outdated ant backwards compatibility marks commit 23c8a4626ac370b560169df130d86d4b58d859e2 Author: Stef Tervelde 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 f016cc474caa637f982c8dd21078801974aabb69 Author: Stef Tervelde Date: Wed Feb 5 12:01:47 2025 +0100 Removed core dependency from the pre-processor commit 971d98bba0a8acf24a9430015a7c1508e2c9d2a3 Author: Stef Tervelde Date: Thu Jan 30 22:59:16 2025 +0100 Preprocessor with antlr Plugin --- gradle/libs.versions.toml | 9 +- java/preprocessor/build.gradle.kts | 42 +- java/preprocessor/src/main/antlr/JavaLexer.g4 | 235 +++++ .../preprocessor/src/main/antlr/JavaParser.g4 | 826 ++++++++++++++++++ .../mode/java/preproc/Processing.g4 | 147 ++++ .../main/java/processing/app/Platform.java | 16 +- .../main/java/processing/app/Preferences.java | 2 +- .../java/preproc/PdeParseTreeListener.java | 33 +- .../mode/java/preproc/TextTransform.java | 10 +- 9 files changed, 1289 insertions(+), 31 deletions(-) create mode 100644 java/preprocessor/src/main/antlr/JavaLexer.g4 create mode 100644 java/preprocessor/src/main/antlr/JavaParser.g4 create mode 100644 java/preprocessor/src/main/antlr/processing/mode/java/preproc/Processing.g4 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dfacae1ead..236949d8c7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ kotlin = "2.0.20" compose-plugin = "1.7.1" jogl = "2.5.0" +antlr = "4.13.2" jupiter = "5.12.0" [libraries] @@ -25,6 +26,11 @@ netbeansSwing = { module = "org.netbeans.api:org-netbeans-swing-outline", versio ant = { module = "org.apache.ant:ant", version = "1.10.14" } lsp4j = { module = "org.eclipse.lsp4j:org.eclipse.lsp4j", version = "0.22.0" } jsoup = { module = "org.jsoup:jsoup", version = "1.17.2" } +antlr4 = { module = "org.antlr:antlr4", version.ref = "antlr" } +antlr4Runtime = { module = "org.antlr:antlr4-runtime", version.ref = "antlr" } +composeGradlePlugin = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "compose-plugin" } +kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlinComposePlugin = { module = "org.jetbrains.kotlin.plugin.compose:org.jetbrains.kotlin.plugin.compose.gradle.plugin", version.ref = "kotlin" } markdown = { module = "com.mikepenz:multiplatform-markdown-renderer-m2", version = "0.31.0" } markdownJVM = { module = "com.mikepenz:multiplatform-markdown-renderer-jvm", version = "0.31.0" } clikt = { module = "com.github.ajalt.clikt:clikt", version = "5.0.2" } @@ -36,4 +42,5 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } download = { id = "de.undercouch.download", version = "5.6.0" } -mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } \ No newline at end of file +mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } +gradlePublish = { id = "com.gradle.plugin-publish", version = "1.2.1" } \ No newline at end of file diff --git a/java/preprocessor/build.gradle.kts b/java/preprocessor/build.gradle.kts index f2bc2a2d9f..8e4300d311 100644 --- a/java/preprocessor/build.gradle.kts +++ b/java/preprocessor/build.gradle.kts @@ -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 { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} -tasks.compileJava{ - dependsOn("ant-preproc") -} -ant.importBuild("../build.xml"){ antTaskName -> - "ant-$antTaskName" } \ No newline at end of file diff --git a/java/preprocessor/src/main/antlr/JavaLexer.g4 b/java/preprocessor/src/main/antlr/JavaLexer.g4 new file mode 100644 index 0000000000..b924864ea2 --- /dev/null +++ b/java/preprocessor/src/main/antlr/JavaLexer.g4 @@ -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 +; \ No newline at end of file diff --git a/java/preprocessor/src/main/antlr/JavaParser.g4 b/java/preprocessor/src/main/antlr/JavaParser.g4 new file mode 100644 index 0000000000..d273fa8885 --- /dev/null +++ b/java/preprocessor/src/main/antlr/JavaParser.g4 @@ -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 + | expression bop = '?' expression ':' expression #TernaryExpression + // Level 1, Assignment + | 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? ')' + ; \ No newline at end of file diff --git a/java/preprocessor/src/main/antlr/processing/mode/java/preproc/Processing.g4 b/java/preprocessor/src/main/antlr/processing/mode/java/preproc/Processing.g4 new file mode 100644 index 0000000000..2d4edc041a --- /dev/null +++ b/java/preprocessor/src/main/antlr/processing/mode/java/preproc/Processing.g4 @@ -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 + ; \ No newline at end of file diff --git a/java/preprocessor/src/main/java/processing/app/Platform.java b/java/preprocessor/src/main/java/processing/app/Platform.java index 079d9d79cd..b90974dd39 100644 --- a/java/preprocessor/src/main/java/processing/app/Platform.java +++ b/java/preprocessor/src/main/java/processing/app/Platform.java @@ -15,7 +15,21 @@ static public File getSettingsFolder() { } 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; } diff --git a/java/preprocessor/src/main/java/processing/app/Preferences.java b/java/preprocessor/src/main/java/processing/app/Preferences.java index 7ce476fdea..eab3a23974 100644 --- a/java/preprocessor/src/main/java/processing/app/Preferences.java +++ b/java/preprocessor/src/main/java/processing/app/Preferences.java @@ -58,7 +58,7 @@ static public String get(String attribute /*, String defaultValue */) { } } 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*/) { diff --git a/java/src/processing/mode/java/preproc/PdeParseTreeListener.java b/java/src/processing/mode/java/preproc/PdeParseTreeListener.java index cb4fd00010..c3edc810ad 100644 --- a/java/src/processing/mode/java/preproc/PdeParseTreeListener.java +++ b/java/src/processing/mode/java/preproc/PdeParseTreeListener.java @@ -32,7 +32,6 @@ import processing.app.Base; import processing.app.Preferences; -import processing.core.PApplet; import processing.mode.java.preproc.PdePreprocessor.Mode; /** @@ -1234,19 +1233,35 @@ protected void writeMain(PrintWriterWithEditGen footerWriter, { // assemble line with applet args StringJoiner argsJoiner = new StringJoiner(", "); - boolean shouldFullScreen = Preferences.getBoolean("export.application.present"); - shouldFullScreen = shouldFullScreen || Preferences.getBoolean("export.application.fullscreen"); + boolean shouldFullScreen; + String presentProp = System.getProperty("processing.fullscreen"); + + if (presentProp != null) { + shouldFullScreen = presentProp.equals("true"); + } else { + boolean isExportedApp = Preferences.getBoolean("export.application.present"); + boolean isFullscreenPref = Preferences.getBoolean("export.application.fullscreen"); + shouldFullScreen = isExportedApp || isFullscreenPref; + } + if (shouldFullScreen) { - argsJoiner.add("\"" + PApplet.ARGS_FULL_SCREEN + "\""); + argsJoiner.add("\"--full-screen\""); - String bgColor = Preferences.get("run.present.bgcolor"); - argsJoiner.add("\"" + PApplet.ARGS_BGCOLOR + "=" + bgColor + "\""); + String bgColor = System.getProperty("processing.window.color", Preferences.get("run.present.bgcolor")); + argsJoiner.add("\"--bgcolor=" + bgColor + "\""); - if (Preferences.getBoolean("export.application.stop")) { + boolean showStop; + var hideStop = System.getProperty("processing.stop.hide"); + if(hideStop != null){ + showStop = hideStop.equals("false"); + }else{ + showStop = Preferences.getBoolean("export.application.stop"); + } + if(showStop) { String stopColor = Preferences.get("run.present.stop.color"); - argsJoiner.add("\"" + PApplet.ARGS_STOP_COLOR + "=" + stopColor + "\""); + argsJoiner.add("\"--stop-color=" + stopColor + "\""); } else { - argsJoiner.add("\"" + PApplet.ARGS_HIDE_STOP + "\""); + argsJoiner.add("\"--hide-stop\""); } } diff --git a/java/src/processing/mode/java/preproc/TextTransform.java b/java/src/processing/mode/java/preproc/TextTransform.java index 77ae022f19..19ba8f3e53 100644 --- a/java/src/processing/mode/java/preproc/TextTransform.java +++ b/java/src/processing/mode/java/preproc/TextTransform.java @@ -8,8 +8,6 @@ import java.util.ListIterator; import java.util.stream.Collectors; -import processing.core.PApplet; - public class TextTransform { @@ -256,7 +254,7 @@ public int getInputOffset(int outputOffset) { i = -(i + 1); i -= 1; } - i = PApplet.constrain(i, 0, outMap.size()-1); + i = constrain(i, 0, outMap.size()-1); Edit edit = outMap.get(i); int diff = outputOffset - edit.toOffset; return edit.fromOffset + Math.min(diff, Math.max(0, edit.fromLength - 1)); @@ -271,7 +269,7 @@ public int getOutputOffset(int inputOffset) { i = -(i + 1); i -= 1; } - i = PApplet.constrain(i, 0, inMap.size()-1); + i = constrain(i, 0, inMap.size()-1); Edit edit = inMap.get(i); int diff = inputOffset - edit.fromOffset; return edit.toOffset + Math.min(diff, Math.max(0, edit.toLength - 1)); @@ -283,6 +281,10 @@ public OffsetMapper thenMapping(OffsetMapper mapper) { } } + static public final int constrain(int amt, int low, int high) { + return (amt < low) ? low : ((amt > high) ? high : amt); + } + private static class CompositeOffsetMapper implements OffsetMapper { private List mappers = new ArrayList<>();