diff --git a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java index 722c1ad..4172ea8 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java +++ b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java @@ -65,6 +65,7 @@ public class BSLHighlighter { private static final Set SDBL_STRINGS = createSdblStrings(); private static final Set SDBL_COMMENTS = createSdblComments(); private static final Set SDBL_PARAMETERS = createSdblParameters(); + private static final Set SDBL_EDS = createSdblEDS(); private final SensorContext context; @@ -258,6 +259,8 @@ private static TypeOfText getTypeOfTextSDBL(int tokenType) { typeOfText = TypeOfText.COMMENT; } else if (SDBL_PARAMETERS.contains(tokenType)) { typeOfText = TypeOfText.ANNOTATION; + } else if (SDBL_EDS.contains(tokenType)) { + typeOfText = TypeOfText.KEYWORD_LIGHT; } else { typeOfText = null; } @@ -525,7 +528,30 @@ private static Set createSdblFunctions() { SDBLLexer.VALUETYPE, SDBLLexer.WEEK, SDBLLexer.WEEKDAY, - SDBLLexer.YEAR + SDBLLexer.YEAR, + SDBLLexer.INT, + SDBLLexer.ACOS, + SDBLLexer.ASIN, + SDBLLexer.ATAN, + SDBLLexer.COS, + SDBLLexer.SIN, + SDBLLexer.TAN, + SDBLLexer.LOG, + SDBLLexer.LOG10, + SDBLLexer.EXP, + SDBLLexer.POW, + SDBLLexer.SQRT, + SDBLLexer.LOWER, + SDBLLexer.STRINGLENGTH, + SDBLLexer.TRIMALL, + SDBLLexer.TRIML, + SDBLLexer.TRIMR, + SDBLLexer.UPPER, + SDBLLexer.ROUND, + SDBLLexer.STOREDDATASIZE, + SDBLLexer.UUID, + SDBLLexer.STRFIND, + SDBLLexer.STRREPLACE ); } @@ -610,6 +636,14 @@ private static Set createSdblParameters() { ); } + private static Set createSdblEDS() { + return Set.of( + SDBLLexer.EDS_CUBE, + SDBLLexer.EDS_TABLE, + SDBLLexer.EDS_CUBE_DIMTABLE + ); + } + @Data @RequiredArgsConstructor @EqualsAndHashCode(exclude = "active") diff --git a/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java b/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java index a966606..6a4f98d 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java @@ -382,7 +382,30 @@ private Map getHighlightingMapSDBL(Vocabulary vocabulary) { "VALUETYPE", "WEEK", "WEEKDAY", - "YEAR" + "YEAR", + "INT", + "ACOS", + "ASIN", + "ATAN", + "COS", + "SIN", + "TAN", + "LOG", + "LOG10", + "EXP", + "POW", + "SQRT", + "LOWER", + "STRINGLENGTH", + "TRIMALL", + "TRIML", + "TRIMR", + "UPPER", + "ROUND", + "STOREDDATASIZE", + "UUID", + "STRFIND", + "STRREPLACE" ); Set metadataTypes = Set.of( @@ -460,6 +483,12 @@ private Map getHighlightingMapSDBL(Vocabulary vocabulary) { "BAR" // TODO: Убрать из лексера ); + Set eds = Set.of( + "EDS_CUBE", + "EDS_TABLE", + "EDS_CUBE_DIMTABLE" + ); + var maxTokenType = vocabulary.getMaxTokenType(); Map highlightingMap = new HashMap<>(); @@ -485,6 +514,8 @@ private Map getHighlightingMapSDBL(Vocabulary vocabulary) { typeOfText = TypeOfText.KEYWORD_LIGHT; } else if (virtualTables.contains(ruleName)) { typeOfText = TypeOfText.KEYWORD_LIGHT; + } else if (eds.contains(ruleName)) { + typeOfText = TypeOfText.KEYWORD_LIGHT; } else if (ruleName.equals("STR")) { typeOfText = TypeOfText.STRING; } else if (ruleName.contains("LINE_COMMENT")) {