Skip to content

Commit 997dad2

Browse files
committed
feat: 发布 v3.66 三版体系(M轻量/R标准/X全能),HIC 内建编译 Python/C++ 为 HTML
- 引擎:新增 py:(… )end / cpp:(… )end 块解析与渲染,关键字高亮与代码片段 - 转译宿主:HIC 自包含 Python→JS / C++→JS 转译器,编译块源码输出 HTML, 全程离线,不依赖任何外部官方库/CDN/网址;由 window.HIC_EDITION 按版本门控 - 三版离线单文件:HiCode-v3.66M/R/X-offline.html 打包脚本与下载条目 - 学习中心新增第 17 章 + 示例 ch17-v366.hc - 归档旧版本 v3.01 至 old/v3.01,历史索引更新
1 parent db61a43 commit 997dad2

87 files changed

Lines changed: 26050 additions & 114 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ HiCode(简称 **HC**)的诞生源于一个朴素的愿望:**让编程真
3030

3131
## 当前版本
3232

33-
- **v3.01(原生 HTML 块)**:HiCode 当前版本。在 v2.00 能力基础上新增:
34-
- 🧩 **原生 HTML 块**`html:( … )end` 包裹任意 HTML,括号内内容 **HIC 不做编译**,而是 **原样写入最终导出的 HTML**。它与其他语句一样 **从上到下按声明顺序** 执行(先 `it` → 再 `html:(…)` → 后 `in`)。编辑器顶部带「`+ 原生 HTML`」一键插入按钮,`html` / `end` 关键字自动高亮;学习中心扩充至 16 章。
33+
- **v3.66(三版发布 + 编译 Python / C++ 为 HTML)**:HiCode 当前版本。每次发布分为三档:
34+
- `M · 轻量版`:仅含全套 HIC 内核。
35+
- `R · 标准版`:全套 HIC 内核 + **编译 Python 为 HTML**`py:(… )end`)。
36+
- `X · 全能版`:全套 HIC 内核 + **编译 Python 与 C++ 为 HTML**`py:(… )end` / `cpp:(… )end`)。
37+
- 🧩 **让 HIC 编译其他语言**:这里的“Python / C++ 能力”不是调用官方库,而是**让 HIC 支持编译这些语言并定义为 HTML**。HIC 内置自包含转译器,把块内源码编译成 HTML 输出,导出页 **不引用任何外部库 / CDN / 网址**,全程离线可用;M/R/X 按版本各自开放可编译的语言。
38+
- 🧩 编辑器新增「`+ Python`」「`+ C++`」代码片段按钮与关键字高亮;学习中心扩充至 17 章。
39+
- **v3.01(原生 HTML 块)**:上一版本。新增原生 HTML 块 `html:( … )end`、编辑器一键插入与关键字高亮;学习中心扩充至 16 章。
3540
- **v2.00(图形化前端开发)**:为 HIC 增加图形化前端开发能力。在 v1.0x 已有能力(`it` 变量、`in t/s/b/link/p` 展示、`if/orif/noif` 条件、表达式、`to/fr` 跳转、`for` 循环、`{变量}` 插值、实时转译与导出)的基础上新增:
3641
- 🧩 **触发区域色块**`cf 区域名 … cf 区域名 stop` 标记一段代码,网页转译成彩色色块,**点击或长按约 0.6 秒** 即触发 / 展开该段内容,让"简单点击也能带动一段逻辑"。
3742
- 🖼️ **图片变量支持 URL**`it 名 p 图片地址` 直接引用网络图片,无需上传。
@@ -49,8 +54,8 @@ HiCode(简称 **HC**)的诞生源于一个朴素的愿望:**让编程真
4954
## 下载
5055

5156
- 下载页:**[https://HiCodeHC.github.io/download/](https://HiCodeHC.github.io/download/)**
52-
- 可选 **安卓端(.apk)****Windows 电脑端(.exe)****网页端(在线)** 三种形态;本地端基于网页端 IDE 封装的离线运行时,编译更快、体验一致。
53-
- **GitHub Releases**:自 v3.01 起,每个新版本均基于 Git Tag 在 **[GitHub Releases](https://github.com/HiCodeHC/HiCodeHC.github.io/releases)** 默认发布(含离线单文件版 / 源码 / 原生安装包),可前往查看各版本的发布说明与附件。
57+
- 可选 **安卓端(.apk)****Windows 电脑端(.exe)****网页端(在线)** 三种形态,每版再分 **M 轻量 / R 标准 / X 全能** 三档(见下载页 / GitHub Releases);本地端基于网页端 IDE 封装的离线运行时,编译更快、体验一致。
58+
- **GitHub Releases**:自 v3.01 起,每个新版本均基于 Git Tag 在 **[GitHub Releases](https://github.com/HiCodeHC/HiCodeHC.github.io/releases)** 默认发布(含三档离线单文件版 / 源码 / 原生安装包),可前往查看各版本的发布说明与附件。
5459

5560
## 官网
5661

android/index.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>HiCode · 手机开发环境 v3.01(安卓端)</title>
6+
<title>HiCode · 手机开发环境 v3.66(安卓端)</title>
77
<link rel="icon" href="../assets/hicode-logo.jpg" type="image/jpeg" />
88
<meta name="theme-color" content="#f3eee6" />
99
<link rel="stylesheet" href="css/style.css" />
@@ -15,7 +15,7 @@
1515
<div class="brand" id="btnHome" title="返回首页">
1616
<span class="logo-dot"></span>
1717
<span class="brand-name">HiCode</span>
18-
<span class="ver">v3.01 · 手机端</span>
18+
<span class="ver" id="verTag">v3.66 · 手机端</span>
1919
</div>
2020
<div class="crumb" id="crumb" title="当前文件"></div>
2121
<div class="actions">
@@ -76,6 +76,8 @@
7676
<button type="button" class="snippet" data-snip="use" title="导入 Python 标准库模块(网页输出为标识占位,打包/原生运行时可用)">+ 标准库 use</button>
7777
<button type="button" class="snippet" data-snip="app" title="声明一个可上传文件、供用户下载的变量">+ 下载文件</button>
7878
<button type="button" class="snippet" data-snip="html" title="插入原生 HTML 块 html:( … )end,括号内内容 HIC 不编译、原样注入导出">+ 原生 HTML</button>
79+
<button type="button" class="snippet" data-snip="py" data-ed="rx" title="插入 Python 代码块 py:( … )end,HIC 将括号内 Python 编译为 HTML(R 标准版 / X 全能版)">+ Python</button>
80+
<button type="button" class="snippet" data-snip="cpp" data-ed="x" title="插入 C++ 代码块 cpp:( … )end,HIC 将括号内 C++ 编译为 HTML(X 全能版)">+ C++</button>
7981
</div>
8082
<textarea id="code" class="codearea" spellcheck="false"
8183
placeholder="在这里编写 HIC 代码…&#10;&#10;it 标题 t Hello HiCode&#10;标题 in t&#10;it 分数 int 85&#10;if 分数 &gt;= 60:&#10; 标题 in s"
@@ -143,7 +145,7 @@
143145
<div class="console-welcome">
144146
<span class="cw-logo">H</span>
145147
<div class="cw-text">
146-
<span class="cw-title">HiCode · HIC 手机开发环境 v3.01(安卓端)</span>
148+
<span class="cw-title">HiCode · HIC 手机开发环境 v3.66(安卓端)</span>
147149
<span class="cw-sub">HIC 引擎已就绪 · 正在加载编辑器…</span>
148150
</div>
149151
</div>

android/js/app.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,16 @@
811811
});
812812
// 可下载文件上传
813813
el.fileApp.onchange = onFileApp;
814-
// 快捷代码片段:触发区域 / use / 下载文件
814+
// 快捷代码片段:触发区域 / use / 下载文件 / 原生HTML / 编译语言块
815+
const _ed = (window.HIC_EDITION || "x").toLowerCase(); // m=仅HIC r=+py x=+py+cpp
815816
Array.prototype.forEach.call(document.querySelectorAll(".snippet"), function (b) {
817+
const needEd = (b.getAttribute("data-ed") || "").toLowerCase();
818+
if (needEd) {
819+
let ok = false;
820+
if (needEd === "rx") ok = (_ed === "r" || _ed === "x");
821+
else if (needEd === "x") ok = (_ed === "x");
822+
if (!ok) { b.style.display = "none"; }
823+
}
816824
b.onclick = function () {
817825
const snip = b.getAttribute("data-snip");
818826
const code = el.code, s = code.selectionStart;
@@ -824,6 +832,10 @@
824832
insertAtCursor("it 下载包 app\n下载包 in d");
825833
} else if (snip === "html") {
826834
insertAtCursor("html:(\n <div class=\"myself\" style=\"padding:16px;border:1px solid rgba(255,230,190,.2);border-radius:12px;\">\n 在此处写原生 HTML(HIC 不编译)\n </div>\n)end");
835+
} else if (snip === "py") {
836+
insertAtCursor("py:(\n # 在此处写 Python,HIC 会把括号内代码编译为 HTML\n print('你好,HIC Python')\n)end");
837+
} else if (snip === "cpp") {
838+
insertAtCursor("cpp:(\n // 在此处写 C++,HIC 会把括号内代码编译为 HTML\n #include <iostream>\n using namespace std;\n int main() {\n cout << \"你好,HIC C++\";\n return 0;\n }\n)end");
827839
}
828840
doLive(); debounceSave();
829841
};
@@ -838,9 +850,16 @@
838850
function boot() {
839851
bind();
840852
bindNoBarPref();
853+
// 三版发布:按 HIC_EDITION 设置引擎可编译语言并在顶栏显示版本号
854+
const ed = (window.HIC_EDITION || "x").toLowerCase();
855+
if (HC.setEdition) HC.setEdition(ed);
856+
const ED_NAME = { m: "M·轻量版", r: "R·标准版", x: "X·全能版" }[ed] || "X·全能版";
857+
const VT = document.getElementById("verTag");
858+
if (VT) VT.textContent = "v3.66 · " + ED_NAME;
841859
// 轻量编辑器:语法高亮 + 行号 + 自动缩进 + 括号补全
842860
if (window.HICED) window.hiced = HICED.create(el.code);
843-
logConsole("output", "HiCode IDE 已启动 · 就绪");
861+
if (typeof HC !== "undefined" && HC.APP) logConsole("output", "HiCode " + HC.APP.version + " " + ED_NAME + "(HIC " + (ed === "m" ? "仅 HIC 内核" : ed === "r" ? "内核 + Python" : "内核 + Python + C++") + ")已启动 · 就绪");
862+
else logConsole("output", "HiCode IDE 已启动 · 就绪");
844863
if (!Store.hasAnyProject()) { showHome(); return; }
845864
showHome(); // 默认先回首页引导;也可自动恢复
846865
}

android/js/editor.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
const ID_START = "A-Za-z_\\u4e00-\\u9fff";
1616
const ID_CHAR = "A-Za-z0-9_\\u4e00-\\u9fff";
17-
const KEYWORDS = new Set(["it", "in", "if", "orif", "noif", "point", "to", "fr", "and", "or", "not", "for", "fn", "global", "raw", "g", "cf", "stop", "use", "app", "d", "html", "end"]);
17+
const KEYWORDS = new Set(["it", "in", "if", "orif", "noif", "point", "to", "fr", "and", "or", "not", "for", "fn", "global", "raw", "g", "cf", "stop", "use", "app", "d", "html", "py", "py3", "cpp", "cxx", "end"]);
1818
const TYPES = new Set(["t", "p", "s", "b", "d", "text", "img", "sub", "body", "link", "app", "int", "float", "str", "bool", "list", "dict", "tuple"]);
1919

2020
function esc(s) {
@@ -33,8 +33,9 @@
3333
function p(seg, cls) { if (seg) out += cls ? '<span class="tk ' + cls + '">' + esc(seg) + "</span>" : esc(seg); }
3434
while (i < bodyEnd) {
3535
const c = text[i];
36-
// 原生 HTML 块定界符 html:( / )end —— 整体高亮为“块”语义
37-
if (text.substr(i, 7).toLowerCase() === "html:(") { p("html:(", "bl"); i += 7; continue; }
36+
// 语言块定界符 html:( / py:( / cpp:( / )end —— 整体高亮为“块”语义
37+
const blm = /^(html|py|py3|cpp|cxx):\(/.exec(text.substr(i, 9).toLowerCase());
38+
if (blm) { p(blm[1] + ":(", "bl"); i += blm[1].length + 2; continue; }
3839
if (c === ")" && text.substr(i, 4).toLowerCase() === ")end") { p(")end", "bl"); i += 4; continue; }
3940
// 字符串(内部 {变量} 插值高亮)
4041
if (c === '"' || c === "'") {

0 commit comments

Comments
 (0)