Skip to content
Snippets Groups Projects
Commit 78498753 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[clike mode] Make set of identifier chars configurable

Issue #4693
parent 1e4f5b8d
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { ...@@ -64,7 +64,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/, isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
numberStart = parserConfig.numberStart || /[\d\.]/, numberStart = parserConfig.numberStart || /[\d\.]/,
number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i, number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/; isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/;
var curPunc, isDefKeyword; var curPunc, isDefKeyword;
...@@ -101,9 +102,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { ...@@ -101,9 +102,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {} while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
return "operator"; return "operator";
} }
stream.eatWhile(/[\w\$_\xa1-\uffff]/); stream.eatWhile(isIdentifierChar);
if (namespaceSeparator) while (stream.match(namespaceSeparator)) if (namespaceSeparator) while (stream.match(namespaceSeparator))
stream.eatWhile(/[\w\$_~\xa1-\uffff]/); stream.eatWhile(isIdentifierChar);
var cur = stream.current(); var cur = stream.current();
if (contains(keywords, cur)) { if (contains(keywords, cur)) {
...@@ -390,6 +391,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { ...@@ -390,6 +391,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
typeFirstDefinitions: true, typeFirstDefinitions: true,
atoms: words("true false null"), atoms: words("true false null"),
dontIndentStatements: /^template$/, dontIndentStatements: /^template$/,
isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
hooks: { hooks: {
"#": cppHook, "#": cppHook,
"*": pointerHook, "*": pointerHook,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment