Export to GitHub

google-code-prettify - issue #366

FLOW_CONTROL_KEYWORDS should not contain `do`


Posted on Jan 28, 2015 by Happy Dog

What steps will reproduce the problem? Visit http://stackoverflow.com/q/28197948/1426065 and look at the code section at the bottom of the original question. After the imports, 2 variables are assigned:

do = dir_with_original_files = ... dm = dir_with_modified_files = ...

do is highlighted as a keyword, while dm is the standard black color. Python does not include a do keyword, so it should not be highlighted.

What version are you using? On what browser?

I'm not a Stack Exchange dev, so I don't know what version they're using, but looking at the current source online, the issue is still there. I'm using Firefox, but I assume this would show up in any browser.

Please provide any additional information below.

In prettify.js line 95 (https://code.google.com/p/google-code-prettify/source/browse/trunk/src/prettify.js#95), FLOW_CONTROL_KEYWORDS is defined as ["break,continue,do,else,for,if,return,while"]. One line 125, PYTHON_KEYWORDS is defined as FLOW_CONTROL_KEYWORDS plus a number of others. Many of the other languages listed are defined in a similar manner. Since not all languages (including Python) have do as a keyword, it should be removed from FLOW_CONTROL_KEYWORDS and added individually to those languages that define it.

Status: New