From 4041489bb38ffe609d5f9b43b4a7637e47fc4739 Mon Sep 17 00:00:00 2001 From: Azat Alimov <32402726+mkslanc@users.noreply.github.com> Date: Fri, 26 Apr 2024 18:16:32 +0400 Subject: [PATCH] fix: wrong token type (#5535) --- demo/kitchen-sink/docs/erlang.erl | 5 ++++- src/mode/_test/tokens_erlang.json | 30 ++++++++++++++++++++++++++++++ src/mode/erlang_highlight_rules.js | 30 +++++++++++++++--------------- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/demo/kitchen-sink/docs/erlang.erl b/demo/kitchen-sink/docs/erlang.erl index 705642b3c28..b3915967a3c 100644 --- a/demo/kitchen-sink/docs/erlang.erl +++ b/demo/kitchen-sink/docs/erlang.erl @@ -17,4 +17,7 @@ % Force the use of 'codeswitch/1' from the latest MODULE version end. - codeswitch(Sum) -> loop(Sum). \ No newline at end of file + codeswitch(Sum) -> loop(Sum). + + % Print the data using the pretty print specifier + io:format("Here is the data: ~p~n", [Data]). diff --git a/src/mode/_test/tokens_erlang.json b/src/mode/_test/tokens_erlang.json index 8a8289760b2..0d585f84331 100644 --- a/src/mode/_test/tokens_erlang.json +++ b/src/mode/_test/tokens_erlang.json @@ -163,4 +163,34 @@ ["variable.other.erlang","Sum"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.terminator.function.erlang","."] +],[ + "start", + ["text"," "] +],[ + "start", + ["text"," "], + ["punctuation.definition.comment.erlang","% Print the data using the pretty print specifier"] +],[ + "start", + ["text"," "], + ["entity.name.type.class.module.erlang","io"], + ["punctuation.separator.module-function.erlang",":"], + ["entity.name.function.erlang","format"], + ["punctuation.definition.parameters.begin.erlang","("], + ["punctuation.definition.string.begin.erlang","\""], + ["string.quoted.double.erlang","Here is the data: "], + ["punctuation.definition.erlang","~"], + ["constant.other.erlang","p"], + ["punctuation.definition.erlang","~"], + ["constant.other.erlang","n"], + ["punctuation.definition.string.end.erlang","\""], + ["punctuation.separator.parameters.erlang",","], + ["text"," "], + ["punctuation.definition.list.begin.erlang","["], + ["variable.other.erlang","Data"], + ["punctuation.definition.list.end.erlang","]"], + ["punctuation.definition.parameters.end.erlang",")"], + ["text","."] +],[ + "start" ]] \ No newline at end of file diff --git a/src/mode/erlang_highlight_rules.js b/src/mode/erlang_highlight_rules.js index c90b6d9dab8..aab17398f9e 100644 --- a/src/mode/erlang_highlight_rules.js +++ b/src/mode/erlang_highlight_rules.js @@ -789,23 +789,23 @@ var ErlangHighlightRules = function() { regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, { token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' }, { token: - [ 'punctuation.definition.placeholder.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'constant.other.placeholder.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'constant.other.placeholder.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'constant.other.placeholder.erlang', - 'constant.other.placeholder.erlang' ], + [ 'punctuation.definition.erlang', + 'punctuation.separator.erlang', + 'constant.other.erlang', + 'punctuation.separator.erlang', + 'punctuation.separator.erlang', + 'constant.other.erlang', + 'punctuation.separator.erlang', + 'punctuation.separator.erlang', + 'punctuation.separator.erlang', + 'constant.other.erlang', + 'constant.other.erlang' ], regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' }, { token: - [ 'punctuation.definition.placeholder.erlang', - 'punctuation.separator.placeholder-parts.erlang', - 'constant.other.placeholder.erlang', - 'constant.other.placeholder.erlang' ], + [ 'punctuation.definition.erlang', + 'punctuation.separator.erlang', + 'constant.other.erlang', + 'constant.other.erlang' ], regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' }, { token: 'invalid.illegal.string.erlang', regex: '~.?' }, { defaultToken: 'string.quoted.double.erlang' } ] } ],