带有斜杠的表达式突出显示不正确 [英] Expressions with slashes are highlighted incorrectly

查看:106
本文介绍了带有斜杠的表达式突出显示不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先:我不是在谈论多线评论,我不这么认为。当/和*之间有空格时会出现问题,例如

First off: I'm not talking about multi line commenting, I don't think. The problem is occurring when there is a space between the / and the * such as

draw.arc(x, y, radius, Math.PI/2, Math.PI/2, true);

在Dreamweaver中,文字

In dreamweaver, the text

/2,Math.PI/

变绿。

我用谷歌搜索但无济于事。我确定这是愚蠢的但是我很难过。

I've googled but to no avail. I'm sure it's something dumb but I'm stumped.

另请注意:当Math.PI公式定义为变量

Also note: still occurs when the Math.PI formula is defined as a variable

推荐答案

Dreamweaver将其解释为语法高亮的正则表达式。

Dreamweaver is interpreting that as a regex for syntax highlighting.

正则表达式 / regex / 是解析所有Javascript中最臭名昭着的难题。

The regex notation /regex/ is the most notoriously difficult part to parse in all of Javascript.

您的代码没问题。您可以尝试在/周围添加空格。我经常看到这项工作。

Your code is fine. You could try adding spaces around the /. I've often seen that work.

这篇关于带有斜杠的表达式突出显示不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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