From 818e9d7e4069d316fb27934dc81be4467df8ad58 Mon Sep 17 00:00:00 2001 From: SuperMonster003 Date: Thu, 22 May 2025 17:14:37 +0800 Subject: [PATCH] =?UTF-8?q?6.6.3=20-=20Alpha5=20-=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=94=AF=E6=8C=81=20`=3F=3F`,=20`=3F.`,=20`=3F=3F=3D`?= =?UTF-8?q?=20=E7=AD=89=E8=BF=90=E7=AE=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changelog/lang_zh-Hans.json | 1 + app/src/main/assets-app/js-beautify/beautify.js | 11 +++++++++-- version.properties | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.changelog/lang_zh-Hans.json b/.changelog/lang_zh-Hans.json index 45dd6d2f..af24f246 100644 --- a/.changelog/lang_zh-Hans.json +++ b/.changelog/lang_zh-Hans.json @@ -36,6 +36,7 @@ "关于应用与开发者页面增加水平布局及小屏布局适配", "设置页面对话框相关设置支持 \"使用默认值\" 菜单选项", "文件管理器浮动按钮展开后点击其他区域可自动隐藏", + "代码编辑器格式化代码支持 `??`, `?.`, `??=` 等运算符", "打包单文件时自动读取并勾选已安装应用的声明权限 _[`issue #362`](http://issues.autojs6.com/362)_", "意图相关操作 (编辑/查看/安装/发送/播放等) 增加操作异常提示", "ImageWrapper#saveTo 方法的路径参数支持相对路径", diff --git a/app/src/main/assets-app/js-beautify/beautify.js b/app/src/main/assets-app/js-beautify/beautify.js index 9d42fd4a..55311d80 100644 --- a/app/src/main/assets-app/js-beautify/beautify.js +++ b/app/src/main/assets-app/js-beautify/beautify.js @@ -1440,7 +1440,7 @@ function Beautifier(js_source_text, options) { return; } - if (current_token.text === '::') { + if (current_token.text === '::' || current_token.text === '?.') { // no spaces around exotic namespacing syntax operator print_token(); return; @@ -2250,7 +2250,7 @@ function Tokenizer(input_string, opts) { var digit_oct = /[01234567]/; var digit_hex = /[0123456789abcdefABCDEF]/; - this.positionable_operators = '!= !== % & && * ** + - / : < << <= == === > >= >> >>> ? ^ | ||'.split(' '); + this.positionable_operators = '!= !== % & && &&= * ** + - / : < << <= == === > >= >> >>> ? ?? ??= ^ | |> || ||='.split(' '); var punct = this.positionable_operators.concat( // non-positionable operators - these do not follow operator position settings '! %= &= *= **= ++ += , -- -= /= :: <<= = => >>= >>>= ^= |= ~ ...'.split(' ')); @@ -2457,6 +2457,13 @@ function Tokenizer(input_string, opts) { return [c, 'TK_WORD']; } + if (c === '?') { + if (input.peek() === '.' && !input.peek(1).match(/\d/)) { + c += input.next(); + return [c, 'TK_OPERATOR']; + } + } + if (c === '(' || c === '[') { return [c, 'TK_START_EXPR']; } diff --git a/version.properties b/version.properties index 793b6eef..77a44e1d 100644 --- a/version.properties +++ b/version.properties @@ -1,5 +1,5 @@ -#Thu May 22 15:43:17 CST 2025 -BUILD_TIME=1747899797441 +#Thu May 22 17:14:04 CST 2025 +BUILD_TIME=1747905244827 COMPILE_SDK_VERSION=35 IMAGE_QUANT_CMAKE_VERSION=3.22.1 IMAGE_QUANT_NDK_VERSION=26.1.10909125