[Feature request] Additional parsing functions for the 'yue'-module
まだ誰も着手していません。
評価
調査の方向性
まず yue モジュール、その現在の parser、および issue で言及されているマクロのエントリポイントを見つけます。トークンリストと CST が、空白とコメントを含む提示された YueScript の例をどのように表現するかを定義します。モジュールが両方の parsing 関数を公開し、CST が元のソースを再構築するのに十分な情報を保持できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
It would be nice to have the following functions be added to the yue module:
yue.to_tokens(code: string): string[]: Turns a chunk of YueScript code into a list of tokens, solocal even_nums = [i for 1, 10 when (i % 2) == 0]would become something like[ "local", " ", "even_nums", " ", "=", " ", "[", "i", " ", "for", " ", "i", " ", "=", " ", "1", ",", " ", "10", " ", "when", " ", "(", "i", " ", "%", " ", "2", ")", " ", "==", " ", "0", "]" ]. This would be particularly useful for macros because the input might not make sense when parsed into a YueScript AST.yue.to_cst(code: string): yue.CstNode: A CST (concrete syntax tree) is similar to an AST, but unlike an AST, it contains all information required to reconstruct the exact source code that it was generated from. An AST would discard information like whitespace and comments, while a CST would keep them. A CST should also ideally be a strict superset of an AST, so that a node visitor for an AST can also operate on the same node when used with a CST.
As a side note: It may be worth considering replacing the current macro semantics with something more like Rust's approach of taking a single list of tokens and returning a list of tokens, instead of working with source code. Doing it this way is easier to use as well as more reliable than trying to monkey-patch some strings with Lua patterns / regular expressions.
- 主要言語
- Lua
- スター
- 620
- フォーク
- 45
- 平均マージ
- 9時間 5分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
IppClub/YueScript のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
IppClub/YueScript の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ksysoev/duet.nvim#265 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug: accuracy
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PathOfBuildingCommunity/PathOfBuilding#10649 ·
メンテナーはふだん 1 日以内に返信
-
reMarkable
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
koreader/koreader#16485 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nvim-orgmode/orgmode#1213 ·