-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New PEG-based Parser #555
base: dev
Are you sure you want to change the base?
New PEG-based Parser #555
Conversation
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.1 to 4.5.2. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v4.5.2/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.5.2/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]>
…yarn/follow-redirects-1.15.4 build(deps): bump follow-redirects from 1.15.3 to 1.15.4
…yarn/body-parser-1.20.3 build(deps): bump body-parser from 1.20.2 to 1.20.3
这里的行是逻辑的行,实际上是可能换行的。另外,也稍微修改了字体大小。
Related to OpenWebGAL#539 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/OpenWebGAL/WebGAL/issues/539?shareId=XXXX-XXXX-XXXX-XXXX).
…-say-script Fix say script to replace spaces with \u00a0
…ored in the state table when loading a save; An issue where performances with ID-based sound effects were not completely cleared after stopping playback; Deduplication of performance lists in the state table and performance controller upon insertion
Process line break: force-multiline & tests
Process line break
After review, the following issues exist in the new parser:
I have reverted the default exported
I believe these temporary imperfections are not difficult to resolve. Our primary goal is to ensure consistency between the parsing results of the new and old parsers. Once this is achieved, we can leverage the enhanced error detection capabilities of the new parser. |
由于先前的 WebGAL 项目不规范,使用 bfg 处理后需要重新同步 dev 分支并 cherry pick 这个 pr 上的提交到从 dev 新拉取的分支。这个 pr 的 commit 很多,很麻烦,所以建议: |
Summary
This PR implements a new WebGAL parser based on parsing expression grammar (PEG). This has certain advantages over the current non-standard string-based parsing and enables the possibility of optimizations, advanced grammar, better error handling, etc. The new parser aims to be fully compatible with the old one.
Features (If Implemented Correctly)
Backward compatibility
The new parser also generates a
sentenceList
with all fields available in the old parser. It may add some extra fields (e.g., recording errors and some utility command string information), but the result should work on the current engine.New Behavior for Syntax Errors
Now, if the parser encounters syntax errors when parsing a command, it will stop at the character that contains the error and skip to the next line, but the parsed command will still be effective
For example, if a script contains
it will then be parsed as
which preserves the behavior of
pixiInit
.Error Reporting and Recovery
The new parser supports error reporting and recovery. All errors in the script will be recorded in an
errors
field, which can be shown to the user after adapting the language server protocol (LSP) on this.The aforementioned new behaviors on syntax errors ensures error recovery.
Changes to Source Code
The source code of the old parser is moved to
packages/parser_legacy
. The package name is changed towebgal-parser-legacy
The source code of the new parser is put in
packages/parser
. It is distributed under MPL-2.0 license (license file attached).What's Next
parser.js
to ~100KB. Together with gzip on the web server, it may reduce the final data transmission.@MakinoharaShoko, feel free to change the merge base branch :)