嵌套评论 [英] nested comments

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

问题描述

大家好,


我想知道嵌套评论以及为什么它不能接受
...

/ *

优先

/ *



* /

* /


我想任何词法分析者都很容易通过递归语法规则的帮助来识别这样的文本并忽略它们。 。

有没有人知道为什么不允许这样做?

提前致谢!!!

Hi Everyone,

I was wondering about the nested comments and the reason why it is
not acceptable...

/*
first
/*
second
*/
*/

I guess it is easy for any lexer to recognize such text with the help
of recursive grammar rule and ignore them...
does anyone have any idea about the reason why this is not allowed?
Thanks in advance!!!

推荐答案

12月26日下午4:06,Rahul< sam _... @ yahoo.co.inwrote:
On Dec 26, 4:06 pm, Rahul <sam_...@yahoo.co.inwrote:

大家好,


我想知道嵌套的评论及其原因

是不可接受的......


/ *

优先

/ *



* /

* /


我想任何词法分析者都很容易在帮助下识别这样的文字

的递归语法规则并忽略它们......

有没有人知道为什么不允许这样做?


谢谢你预先!!!
Hi Everyone,

I was wondering about the nested comments and the reason why it is
not acceptable...

/*
first
/*
second
*/
*/

I guess it is easy for any lexer to recognize such text with the help
of recursive grammar rule and ignore them...
does anyone have any idea about the reason why this is not allowed?

Thanks in advance!!!



我认为评论用于写一些有关代码的内容。如果你想暂时禁用某些代码,可以使用#if 0。更好。

I think comment is used to write something about the code. If you want
to disable some code temporarily, "#if 0" is better.


12月26日下午1:06,Rahul< sam _... @ yahoo.co.inwrote:
On Dec 26, 1:06 pm, Rahul <sam_...@yahoo.co.inwrote:

大家好,


我想知道嵌套的评论以及它为什么不能接受
...


/ *

优先

/ *



* /

* /


我想任何词法分析器都很容易通过递归语法规则的帮助来识别这样的文本和b $ b忽略他们......

有没有人知道为什么不允许这样做?


提前致谢!!!
Hi Everyone,

I was wondering about the nested comments and the reason why it is
not acceptable...

/*
first
/*
second
*/
*/

I guess it is easy for any lexer to recognize such text with the help
of recursive grammar rule and ignore them...
does anyone have any idea about the reason why this is not allowed?

Thanks in advance!!!






评论的实施就像那样,一旦评论是

开始

它会搜索对方。


你可以试试这样的巢,

/ *

first

\ / *

second

* \ /

* /


-aims

Hi,

the implementation of the comments are like that, once the comments is
started
it will search for the counterpart.

You can try nestin like that,
/*
first
\/*
second
*\/
*/

-aims


Rahul写道:
Rahul wrote:

大家好,


我想知道嵌套的评论及其原因

不可接受...
Hi Everyone,

I was wondering about the nested comments and the reason why it is
not acceptable...



主要是因为语言定义是这样说的,我想。

Mostly because the language definition says so, I guess.


>

/ *

第一个

/ *



* /

* /


我想任何词法分析器都很容易通过递归语法规则的帮助来识别这样的文本并忽略它们。 。

有没有人知道为什么不允许这样做?
>
/*
first
/*
second
*/
*/

I guess it is easy for any lexer to recognize such text with the help
of recursive grammar rule and ignore them...
does anyone have any idea about the reason why this is not allowed?



也许是因为没有必要。

Maybe because there is no need for it.


这篇关于嵌套评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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