>>代币 [英] The >> token

查看:66
本文介绍了>>代币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

众所周知,由于C ++的最长匹配而规则,>>令牌原因

使用嵌套模板时头疼,例如


vector< vector< int>>


如果没有在两个>

标志之间插入空格,将无法正确解析。为什么有>>令牌?为什么不拥有>是令牌,并且

句柄>>在语法中作为两个>令牌?


这将允许代码如3> > 1,但这对我来说似乎无害。

As we know, due to C++''s "longest match" rule, the >> token causes
headaches when working with nested templates, e.g.

vector<vector<int>>

will not parse correctly without inserting a space between the two >
signs. Why have a >> token at all? Why not have > be the token, and
handle >> in the grammar as two > tokens?

This would permit code like 3 > > 1, but that seems harmless to me.

推荐答案



" Peter Ammon" < PE ********* @ rocketmail.com>在消息中写道

news:br ********** @ news.apple.com ...

"Peter Ammon" <pe*********@rocketmail.com> wrote in message
news:br**********@news.apple.com...
正如我们所知,由于C ++'' s最长匹配规则,>>使用嵌套模板时令牌会导致头痛,例如

vector< vector< int>>

如果不在两者之间插入空格将无法正确解析> ;
迹象。为什么有>>令牌?为什么不拥有>是令牌,
处理>>在语法中作为两个>令牌?

这将允许代码如3> > 1,但这对我来说似乎无害。
As we know, due to C++''s "longest match" rule, the >> token causes
headaches when working with nested templates, e.g.

vector<vector<int>>

will not parse correctly without inserting a space between the two >
signs. Why have a >> token at all? Why not have > be the token, and
handle >> in the grammar as two > tokens?

This would permit code like 3 > > 1, but that seems harmless to me.



嗯,那你用什么大于?如果它超载,那么你将获得上下文敏感性问题,这会让语法更加难以处理......


Hmmm, then what would you use for "greater than"? If it''s "overloaded", you
then end up with context sensitivity issues, which makes grammars much
harder to deal with...


Peter Ammon写道:
Peter Ammon wrote:
为什么有>>令牌?为什么不拥有>是令牌,
处理>>在语法中作为两个>令牌?
Why have a >> token at all? Why not have > be the token, and
handle >> in the grammar as two > tokens?




这会使语法比现在复杂得多。这不是值得的b $ b。


-

祝你好运,

Andrey Tarasevich



That would make the grammar much more complex than it is now. It is not
worth it.

--
Best regards,
Andrey Tarasevich


Dave写道:
Dave wrote:

Peter Ammon < PE ********* @ rocketmail.com>在消息中写道
新闻:br ********** @ news.apple.com ...

"Peter Ammon" <pe*********@rocketmail.com> wrote in message
news:br**********@news.apple.com...
正如我们所知,由于C ++的最长匹配"规则,>>使用嵌套模板时令牌会导致头痛,例如

vector< vector< int>>

如果不在两者之间插入空格将无法正确解析> ;
迹象。为什么有>>令牌?为什么不拥有>是令牌,
处理>>在语法中作为两个>令牌?

这将允许代码如3> > 1,但这对我来说似乎无害。
As we know, due to C++''s "longest match" rule, the >> token causes
headaches when working with nested templates, e.g.

vector<vector<int>>

will not parse correctly without inserting a space between the two >
signs. Why have a >> token at all? Why not have > be the token, and
handle >> in the grammar as two > tokens?

This would permit code like 3 > > 1, but that seems harmless to me.



嗯,那你用什么大于?如果它被重载,那么你最终会遇到上下文敏感问题,这会使语法更难处理......


Hmmm, then what would you use for "greater than"? If it''s
"overloaded", you then end up with context sensitivity issues, which
makes grammars much harder to deal with...




已经存在上下文敏感问题。这就是为什么你不能写b $ b不能写矢量< vector< int>>。 更大的令牌已经是

重载。



There are already context sensitivity issues. That''s the reason why you
can''t write vector<vector<int>>. The "greater" token already is
"overloaded".


这篇关于&gt;&gt;代币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆