Implement Lua pattern matching for string functions
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- Go
- スター
- 3.5k
- フォーク
- 217
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/go-lua のほかの issue
-
Numeric modulo fast path disagrees with Lua 5.2 and the library fallback for negative operands対応中かも @efegokdemir が 35 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
io.write discards spaces after trailing numbers対応中かも @flynn-eye が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
State.close leaves closed upvalues in the open list, so calls get slower without bound対応中かも @efegokdemir が 17 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
-
難易度 3/5 半日 初心者へのやさしさ 18/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
limitlessprojects/Go-Hybrid#4764 ·
メンテナーはふだん 1 日以内に返信
-
[bug]: lint fails on main, generated CLI docs out of date対応中かも @bupd が今日担当しました。 オープンbug documentation
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
goharbor/harbor-cli#1180 ·
メンテナーはふだん 1 日以内に返信
-
crane: mutate --env adds duplicate PATH on Windows images when key case differs対応中かも @aad1tyaaaaa が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
google/go-containerregistry#2523 ·
メンテナーはふだん 4 日以内に返信
-
bosh_io_stemcell_type: regular does not work for noble and resolute as it adds -go_agent as suffixオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
cloudfoundry/bosh-deployment-resource#138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100