For faster navigation, this Iframe is preloading the Wikiwand page for 語法突顯.

語法突顯

語法高亮(英語:Syntax highlighting,台湾作語法突顯,又称语法加亮[1]),是指根據術語(關鍵字)類別來顯示不同的顏色字體以增强可读性的一种编辑器特性。

这种功能可改善人对编辑器中内容(通常为源代碼)的可讀性,進而降低因出现誤讀或誤寫而出现错误的几率。

範例

[编辑]

下面是一例C++的語法突顯范例:

// Allocate all the windows
for (int i = 0; i < max; i++) {
    pWins[i] = new Window();
}

在這個範例中,編輯器辨認出關鍵字forintnew,并辨認出變數的名字ipWinsmax,相應地將它們以高亮颜色顯示,註解则以灰色(或異於關鍵字的颜色)顯示,以避免與程式碼相混淆。

下面是一个關於Python的例子:

#Allocate all the windows
for i in range(1, 11):
   print(i)

基本上现代专业的代碼編輯器都支援語法突顯功能,並且支援重新定義語法突顯功能。亦有不少常规文本编辑器支持这种功能。

參見

[编辑]

参考资料

[编辑]
  1. ^ 【汉语推荐使用规范名词】加亮【英文等价术语】highlight 《计算机科学技术名词(第二版)》. 计算机科学技术名词审定委员会. [2013-03-06]. (原始内容存档于2016-03-04). 

外部連結

[编辑]
{{bottomLinkPreText}} {{bottomLinkText}}
語法突顯
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?