g_scanner_scope_add_symbol中的scope_id参数代表什么?
使用词法扫描器 GScanner 时,我想添加自己的符号进行扫描。在查找信息时,我只找到 API 文档和其他人的源代码(例如 Gimp)。除非我错过了一些明显的东西,否则没有任何地方可以解释作用域的作用。
我可以使用 g_scanner_add_symbol 并忽略该问题,但 g_scanner_add_symbol 已被弃用,唯一可以使用的是 g_scanner_scope_add_symbol。我了解如何使用此函数向自定义扫描仪添加符号,但我仍然不知道参数scope_id 的用途。我可以每次都将其设置为零而不用担心。问题是我不喜欢神秘,并且觉得scope_id可能非常有用。我想知道有多有用。
GScanner 中的scope_id 代表什么以及如何利用它?
When using the Lexical Scanner GScanner I want to add my own symbols to scan for. When looking for information I find only the API documentation and in other peoples source code like Gimp. No where is there any explanation as to what scope does, unless I've missed something obvious.
I could use g_scanner_add_symbol and ignore the problem, but g_scanner_add_symbol is deprecated and the only one left to use is g_scanner_scope_add_symbol. I understand how to add symbols to my custom scanner using this function, but I still have no idea what the parameter scope_id is used for. I could just set it to zero every-time and not worry about it. The problem is I don't like mysteries, and feel that scope_id could be very useful. I want to know how useful.
What does scope_id in GScanner represent and how can I take advantage of it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你可以使用范围来拥有不同的符号集。像这样的事情:
我对此并不完全确定,但这就是我认为范围的用途。不过,您可以轻松测试它。
I guess you can use scopes to have different sets of symbols. Something like this:
I'm not entirely sure about that, but that is what I thought scopes were for. You could easily test it, though.