Skip to content

Commit 7ab67ef

Browse files
authored
Merge branch 'master' into pre-commit
2 parents 812b996 + e13aa5c commit 7ab67ef

Some content is hidden

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

98 files changed

+120218
-364
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -24,59 +24,22 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
include:
27-
- { os: ubuntu-22.04, target: linux, platform: linux-x64, container: 'alpine:latest', libc: musl }
28-
- { os: ubuntu-22.04, target: linux, platform: linux-x64 }
29-
- { os: ubuntu-22.04, target: linux, platform: linux-arm64 }
30-
- { os: macos-latest, target: darwin, platform: darwin-x64 }
31-
- { os: macos-latest, target: darwin, platform: darwin-arm64 }
32-
- { os: windows-latest, target: windows, platform: win32-ia32 }
33-
- { os: windows-latest, target: windows, platform: win32-x64 }
27+
- { os: ubuntu-22.04, target: linux, platform: linux-x64 }
28+
- { os: ubuntu-24.04-arm, target: linux, platform: linux-arm64 }
29+
- { os: macos-latest, target: darwin, platform: darwin-x64 }
30+
- { os: macos-latest, target: darwin, platform: darwin-arm64 }
31+
- { os: windows-latest, target: windows, platform: win32-ia32 }
32+
- { os: windows-latest, target: windows, platform: win32-x64 }
3433
runs-on: ${{ matrix.os }}
35-
container:
36-
image: ${{ matrix.container }}
3734
steps:
38-
- name: Install aarch64-linux-gnu
39-
if: ${{ matrix.platform == 'linux-arm64' && matrix.libc != 'musl' }}
40-
run: |
41-
sudo apt-get update
42-
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
43-
44-
- name: Prepare container for musl
45-
if: ${{ matrix.target == 'linux' && matrix.libc == 'musl' }}
46-
run: |
47-
apk update
48-
apk add git ninja bash build-base nodejs linux-headers
49-
50-
- name: Prepare for Linux
51-
if: ${{ matrix.target == 'linux' && matrix.libc != 'musl' }}
52-
run: |
53-
sudo apt update
54-
sudo apt install ninja-build
55-
5635
- uses: actions/checkout@v4
5736
with:
5837
submodules: recursive
5938

60-
- name: Build for Windows
61-
if: ${{ matrix.target == 'windows' }}
62-
run: .\make.bat ${{ matrix.platform }}
39+
- uses: actboy168/setup-luamake@master
6340

64-
- name: Build for Linux
65-
if: ${{ matrix.target == 'linux' }}
66-
run: |
67-
./make.sh ${{ matrix.platform }}
68-
69-
- name: Build for macOS
70-
if: ${{ matrix.target == 'darwin' }}
71-
run: |
72-
brew install ninja
73-
./make.sh ${{ matrix.platform }}
74-
75-
- name: Build for x64 glibc
76-
if: ${{ matrix.platform == 'linux-x64' && matrix.libc != 'musl' }}
77-
run: |
78-
docker build -t ubuntu-18.04 .
79-
docker run --rm -v $(pwd):$(pwd) -w $(pwd) ubuntu-18.04 bash -c './make.sh'
41+
- name: Build
42+
run: luamake -platform ${{ matrix.platform }}
8043

8144
- name: Setting up workflow variables
8245
id: vars
@@ -98,9 +61,6 @@ jobs:
9861
9962
# Package name w/ version
10063
PKG_BASENAME="${{ env.PROJECT }}-${PKG_VERSION}-${{ matrix.platform }}"
101-
if [[ "${{ matrix.libc }}" = musl ]]; then
102-
PKG_BASENAME="${PKG_BASENAME}-${{matrix.libc}}"
103-
fi
10464
10565
# Full name of the tarball asset
10666
PKG_NAME="${PKG_BASENAME}.${PKG_SUFFIX}"

.github/workflows/test.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,8 @@ jobs:
1414
- uses: actions/checkout@v4
1515
with:
1616
submodules: recursive
17-
- name: Build for Windows
18-
if: ${{ matrix.target == 'windows' }}
19-
run: .\make.bat
20-
- name: Build for Linux
21-
if: ${{ matrix.target == 'linux' }}
22-
run: |
23-
sudo apt update
24-
sudo apt install ninja-build
25-
./make.sh
26-
- name: Build for macOS
27-
if: ${{ matrix.target == 'darwin' }}
28-
run: |
29-
brew install ninja
30-
./make.sh
17+
18+
- uses: actboy168/setup-luamake@master
19+
20+
- name: Build
21+
run: luamake -platform ${{ matrix.platform }}

.vscode/c_cpp_properties.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"defines": [
9+
"_DEBUG",
10+
"UNICODE",
11+
"_UNICODE"
12+
],
13+
"windowsSdkVersion": "10.0.26100.0",
14+
"compilerPath": "cl.exe",
15+
"cStandard": "c17",
16+
"cppStandard": "c++17",
17+
"intelliSenseMode": "windows-msvc-x64"
18+
}
19+
],
20+
"version": 4
21+
}

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"type": "lua",
2727
"request": "attach",
2828
"stopOnEntry": false,
29-
"address": "127.0.0.1:11413",
29+
"address": "127.0.0.1:11414",
3030
"outputCapture": [
3131
],
3232
"sourceFormat": "string",

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
//"--shownode",
99
//"--lazy",
1010
],
11+
"files.associations": {
12+
"thread": "cpp"
13+
},
1114
}

3rd/bee.lua

Submodule bee.lua updated 286 files

3rd/luamake

GLOBAL_KEYWORD_CHANGES.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Lua 5.5 `global` 关键字语法支持 - 变更摘要
2+
3+
## 概述
4+
为 Lua Language Server 添加了对 Lua 5.5 新增的 `global` 关键字的完整语法解析支持。
5+
6+
## 修改的文件
7+
- `script/parser/compile.lua`
8+
9+
## 主要变更
10+
11+
### 1. 关键字识别 (第 1391-1420 行)
12+
`isKeyWord` 函数中添加了对 `global` 关键字的处理:
13+
- 仅在 Lua 5.5 中将 `global` 视为关键字
14+
- 其他版本中可作为普通标识符使用
15+
-`goto` 关键字的处理方式一致
16+
17+
### 2. 解析函数 (第 3130-3274 行)
18+
新增 `parseGlobal` 函数,支持三种语法形式:
19+
20+
**a) 全局函数声明**
21+
```lua
22+
global function funcName() end
23+
```
24+
25+
**b) 全局变量声明(带属性)**
26+
```lua
27+
global x -- 单个变量
28+
global <const> y -- 带属性
29+
global a, b, c -- 多个变量
30+
global <const> x, <close> y, z -- 混合属性
31+
```
32+
33+
**c) 全局所有变量**
34+
```lua
35+
global * -- 所有后续变量为全局
36+
global <const> * -- 带属性的全局所有
37+
```
38+
39+
### 3. 语法分发 (第 4117-4119 行)
40+
`parseAction` 函数中添加了 global 关键字的检查和分发:
41+
```lua
42+
if token == 'global' and isKeyWord('global', Tokens[Index + 3]) then
43+
return parseGlobal()
44+
end
45+
```
46+
47+
## 生成的 AST 节点
48+
49+
### setglobal 节点
50+
用于全局变量和函数声明:
51+
```lua
52+
{
53+
type = 'setglobal',
54+
start = <position>,
55+
finish = <position>,
56+
[1] = <variable_name>,
57+
attrs = <optional_attributes>, -- 可选的属性列表
58+
value = <optional_value> -- 对于函数声明
59+
}
60+
```
61+
62+
### globalall 节点
63+
用于 `global *` 声明:
64+
```lua
65+
{
66+
type = 'globalall',
67+
start = <position>,
68+
finish = <position>,
69+
attrs = <optional_attributes>
70+
}
71+
```
72+
73+
## 兼容性
74+
75+
- **Lua 5.5**: `global` 是保留关键字
76+
- **Lua 5.4 及以下**: `global` 可用作标识符
77+
78+
## 测试
79+
80+
要测试此功能:
81+
1. 设置 Lua 版本为 5.5
82+
2. 使用包含 global 声明的代码
83+
3. 验证语法高亮和解析正确性
84+
85+
## 下一步
86+
87+
此实现仅完成了语法解析。完整的功能还需要:
88+
- 语义分析(作用域、引用)
89+
- 类型推断
90+
- 代码补全
91+
- 诊断检查
92+
- 文档生成
93+
94+
详见 `GLOBAL_KEYWORD_IMPLEMENTATION.md`

0 commit comments

Comments
 (0)