isagalaev/highlight.js — pull request #640 by rla (2014-11-13 17:16:25+00:00)
Title: Add Prolog language support

Attempted to add Prolog highlighter. Uses small set of tokens: atom, string, number, variable and comment. The highlighter code was partially inspired from Erlang (which is historically based on Prolog) and Lisp (recursive rules).

Detection relevance tuning:

* Operator `:-` boosted to 10. Helps to distinguish from Erlang.
* Dot at the end of line. Gives similar boost as in the Erlang's grammar.
* Atoms demoted to 0. Helps to distinguish from languages that can have many identifiers
occur sequentially like in Applescript.
* Variables demoted to 0. Similar to atoms but for languages that tend to use identifiers starting
with a capital letter. Variables cannot occur sequentially in Prolog, neither can they occur before
opening parens `(` but I found no ways to express such constraints.

Prolog allows definition of custom operators that cannot be syntactically distinguished from atoms. This makes situation similar to C/C++ where enough preprocessor magic can make a program in language X a valid C/C++ program.