扫描antlr3中的二进制文件

发布于 2024-09-06 05:16:36 字数 135 浏览 4 评论 0原文

我想解析一个二进制文件并以十六进制格式而不是 unicode 指定字符,这可能吗?

例如: 规则: '\x7F' ;

而不是: 规则: '\u007F' ;

因为我不明白 unicode 如何映射到一个字节。

I would like to parse a binary file and specify the characters in hex format instead of unicode, is this possible?

For instance:
rule: '\x7F' ;

Instead of:
rule: '\u007F' ;

Since I do not understand how unicode maps to one byte.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无力看清 2024-09-13 05:16:36

根据定义,二进制文件不包含字符或文本。所以你不应该使用 Unicode 字符来指定格式,这是对的。然而,根本的问题是“你应该首先使用 Anltr 吗?”。毫不奇怪,SO 已经有了答案:

A binary file by definition doesn't contain characters or text. So you're right that you should not be using Unicode characters to specify the format. However, the underlying question is "should you use Anltr in the first place?". It doens't come as a surprise that SO already has an answer to that: No

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文