improve syntaxhighlight

This commit is contained in:
thelastWallE 2021-04-12 12:42:29 +02:00
parent e00bfe0602
commit f1b4477001
1 changed files with 25 additions and 4 deletions

View File

@ -20,10 +20,13 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}], }],
"#single_line_comment": [{ "#single_line_comment": [{
token: "comment.line.number-sign", token: "comment.line.number-sign",
regex: /#.*$/ regex: /([^\*]|^)#[^\*].*/
}, { }, {
token: "comment.line.gcode", token: "comment.line.gcode",
regex: /;.*$/ regex: /;.*$/
}, {
token: "comment.line.number-sign",
regex: /(#\*#)/
}], }],
"#number": [{ "#number": [{
token: "constant.numeric", token: "constant.numeric",
@ -57,7 +60,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}], }],
"#config_block": [{ "#config_block": [{
token: "text", token: "text",
regex: /^\[/, regex: /\[/,
push: [{ push: [{
token: "text", token: "text",
regex: /\]/, regex: /\]/,
@ -102,6 +105,16 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
regex: /\b(?:watermark|pid)\b/, regex: /\b(?:watermark|pid)\b/,
caseInsensitive: true caseInsensitive: true
}], }],
"#known_kinematics_type": [{
token: "support.type",
regex: /\b(?:cartesian|delta|corexy|corexz|polar|rotary_delta|winch|none)\b/,
caseInsensitive: true
}],
"#known_algo_type": [{
token: "support.type",
regex: /\b(?:lagrange|bicubic)\b/,
caseInsensitive: true
}],
"#known_display_type": [{ "#known_display_type": [{
token: "support.type", token: "support.type",
regex: /\b(?:hd44780|st7920|uc1701|ssd1306|sh1106)\b/, regex: /\b(?:hd44780|st7920|uc1701|ssd1306|sh1106)\b/,
@ -113,7 +126,11 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}], }],
"#pin": [{ "#pin": [{
token: "support.type", token: "support.type",
regex: /[\^~!]*(?:ar|analog)\d{1,2}/, regex: /[\^~!]*(?:EXP|ar|analog)\d{1,2}/,
caseInsensitive: true
}, {
token: "support.type",
regex: /(?:(_\d{1,2}))/,
caseInsensitive: true caseInsensitive: true
}, { }, {
token: "support.type", token: "support.type",
@ -135,7 +152,7 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
}], }],
"#config_line": [{ "#config_line": [{
token: ["variable.name", "text"], token: ["variable.name", "text"],
regex: /^(?!(gcode))(\w+)(\s*[:=]\s*)/, regex: /(?!(gcode))(\w+)(\s*[:=]\s*)/,
push: [{ push: [{
token: "text", token: "text",
regex: /$/, regex: /$/,
@ -148,6 +165,10 @@ ace.define("ace/mode/klipper_config_highlight_rules",[], function(require, expor
include: "#known_control_type" include: "#known_control_type"
}, { }, {
include: "#known_display_type" include: "#known_display_type"
}, {
include: "#known_kinematics_type"
}, {
include: "#known_algo_type"
}, { }, {
include: "#pin" include: "#pin"
}, { }, {