Implement Lua pattern matching for string functions
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Start in the string library where findHelper hits the l.assert(false) placeholder, and locate the commented-out match, gsub and gmatch definitions beside it. The work is to port Lua's pattern matching engine so that string.find, string.match, string.gsub and string.gmatch accept patterns. Done means the %s+, (%d+) and %w+ examples in the issue return the expected results, with tests covering both plain and pattern modes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Currently, Lua pattern matching is not implemented in the string library. This limits the functionality of several string functions to plain text operations only.
Missing Pattern Matching Support
The following functions are either missing or have incomplete pattern matching:
string.find- Only supports plain text search, pattern matching raisesTODO implement pattern matchingstring.match- Not implemented (commented out)string.gsub- Not implemented (commented out)string.gmatch- Not implemented (commented out)
Current Implementation
In findHelper, pattern matching is explicitly unimplemented:
} else {
l.assert(false) // TODO implement pattern matching
}
Use Cases
Pattern matching is essential for:
- Text processing and validation
- String transformations (gsub)
- Data extraction from structured text
- Cleaning up command output
Example of currently failing code:
-- These would fail with current implementation:
local result = str:gsub("%s+", "") -- Remove whitespace
local match = str:match("(%d+)") -- Extract numbers
local iter = str:gmatch("%w+") -- Word iterator
Impact
This limitation forces users to work around missing functionality with manual string manipulation, reducing the utility of go-lua for text processing applications.
Would it be possible to implement Lua's standard pattern matching engine for these string functions?
- Ngôn ngữ chính
- Go
- Star
- 3.5k
- Fork
- 217
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Shopify/go-lua
-
Numeric modulo fast path disagrees with Lua 5.2 and the library fallback for negative operandsCó thể đã có người làm @efegokdemir đã nhận 35 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
io.write discards spaces after trailing numbersCó thể đã có người làm @flynn-eye đã nhận 25 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
State.close leaves closed upvalues in the open list, so calls get slower without boundCó thể đã có người làm @efegokdemir đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 18/100
Tất cả issue của Shopify/go-lua
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
docker/model-runner#1118 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Screenshot missing in READMEĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100