diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 6274e508..7b4e2240 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -29,7 +29,7 @@ jobs: run: ./gradlew --no-daemon javadoc - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: '3.6' architecture: 'x64' @@ -123,7 +123,7 @@ jobs: cp -R temp/site/. public/dev/en - name: Deploy - uses: peaceiris/actions-gh-pages@v3.8.0 + uses: peaceiris/actions-gh-pages@v3.9.3 with: deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} publish_branch: gh-pages diff --git a/build.gradle.kts b/build.gradle.kts index f23d7ba1..420b03fd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,12 +6,12 @@ plugins { jacoco `java-library` antlr - id("org.sonarqube") version "3.3" + id("org.sonarqube") version "4.2.1.3168" id("org.cadixdev.licenser") version "0.6.1" id("com.github.gradle-git-version-calculator") version "1.1.0" - id("io.freefair.javadoc-links") version "6.4.3" - id("io.freefair.javadoc-utf-8") version "6.4.3" - id("com.github.ben-manes.versions") version "0.42.0" + id("io.freefair.javadoc-links") version "6.5.1" + id("io.freefair.javadoc-utf-8") version "6.6.1" + id("com.github.ben-manes.versions") version "0.47.0" id("me.champeau.gradle.jmh") version "0.5.3" } diff --git a/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLLexerTest.java b/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLLexerTest.java index ac38102c..a9d9f267 100644 --- a/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLLexerTest.java +++ b/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLLexerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLParserTest.java b/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLParserTest.java index 0b1fd189..335aac16 100644 --- a/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLParserTest.java +++ b/src/jmh/java/com/github/_1c_syntax/bsl/parser/JMXBSLParserTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/antlr/BSLLexer.g4 b/src/main/antlr/BSLLexer.g4 index e6b37f04..f3be374d 100644 --- a/src/main/antlr/BSLLexer.g4 +++ b/src/main/antlr/BSLLexer.g4 @@ -364,6 +364,10 @@ PREPROC_RPAREN: ')'; PREPROC_STRING: '"' (~["\n\r])* '"'; +PREPROC_NATIVE + : N A T I V E + ; + PREPROC_USE_KEYWORD : (RU_I RU_S RU_P RU_O RU_L RU_SOFT_SIGN RU_Z RU_O RU_V RU_A RU_T RU_SOFT_SIGN diff --git a/src/main/antlr/BSLParser.g4 b/src/main/antlr/BSLParser.g4 index 498b3ecf..47550281 100644 --- a/src/main/antlr/BSLParser.g4 +++ b/src/main/antlr/BSLParser.g4 @@ -27,14 +27,22 @@ options { } // ROOT -file: shebang? preprocessor* moduleVars? preprocessor* (fileCodeBlockBeforeSub subs)? fileCodeBlock EOF; +file: shebang? moduleAnnotations? preprocessor* moduleVars? preprocessor* (fileCodeBlockBeforeSub subs)? fileCodeBlock EOF; + +// moduleAnnotations +preproc_native : HASH PREPROC_NATIVE; +usedLib : (PREPROC_STRING | PREPROC_IDENTIFIER); +use : HASH PREPROC_USE_KEYWORD usedLib; + +moduleAnnotations + : + (preproc_native use*) + | (use+ preproc_native? use*) + ; // preprocessor shebang : HASH PREPROC_EXCLAMATION_MARK (PREPROC_ANY | PREPROC_IDENTIFIER)*; -usedLib : (PREPROC_STRING | PREPROC_IDENTIFIER); -use : PREPROC_USE_KEYWORD usedLib; - regionStart : PREPROC_REGION regionName; regionEnd : PREPROC_END_REGION; regionName : PREPROC_IDENTIFIER; @@ -91,7 +99,6 @@ preprocessor | preproc_elsif | preproc_else | preproc_endif - | use ) ; diff --git a/src/main/antlr/SDBLParser.g4 b/src/main/antlr/SDBLParser.g4 index 1d2d8211..02e71a1c 100644 --- a/src/main/antlr/SDBLParser.g4 +++ b/src/main/antlr/SDBLParser.g4 @@ -225,9 +225,9 @@ builtInFunctions: | (doCall=(YEAR | QUARTER | MONTH | DAYOFYEAR | DAY | WEEK | WEEKDAY | HOUR | MINUTE | SECOND) LPAREN date=expression RPAREN) | (doCall=(BEGINOFPERIOD | ENDOFPERIOD) LPAREN date=expression COMMA periodType=(MINUTE | HOUR | DAY | WEEK | MONTH | QUARTER | YEAR | TENDAYS | HALFYEAR) RPAREN) | (doCall=DATEADD LPAREN date=expression COMMA periodType=(SECOND | MINUTE | HOUR | DAY | WEEK | MONTH | QUARTER | YEAR | TENDAYS | HALFYEAR) COMMA count=expression RPAREN) - | (doCall=DATEDIFF LPAREN first=expression COMMA second=expression COMMA periodType=(SECOND | MINUTE | HOUR | DAY | MONTH | QUARTER | YEAR) RPAREN) + | (doCall=DATEDIFF LPAREN firstdate=expression COMMA seconddate=expression COMMA periodType=(SECOND | MINUTE | HOUR | DAY | MONTH | QUARTER | YEAR) RPAREN) | (doCall=(VALUETYPE | PRESENTATION | REFPRESENTATION | GROUPEDBY) LPAREN value=expression RPAREN) - | (doCall=ISNULL LPAREN first=expression COMMA second=expression RPAREN) + | (doCall=ISNULL LPAREN first=logicalExpression COMMA second=logicalExpression RPAREN) ; // агрегатные ф-ии diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionTokenizer.java b/src/main/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionTokenizer.java index b31b0ade..11a97247 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionTokenizer.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionTokenizer.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/BSLParserRuleContext.java b/src/main/java/com/github/_1c_syntax/bsl/parser/BSLParserRuleContext.java index f3ad128a..fecbe9d5 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/BSLParserRuleContext.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/BSLParserRuleContext.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/BSLTokenizer.java b/src/main/java/com/github/_1c_syntax/bsl/parser/BSLTokenizer.java index 144c2986..f3b7496f 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/BSLTokenizer.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/BSLTokenizer.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/CRAwareLexerATNSimulator.java b/src/main/java/com/github/_1c_syntax/bsl/parser/CRAwareLexerATNSimulator.java index 7e757f1c..dc008bde 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/CRAwareLexerATNSimulator.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/CRAwareLexerATNSimulator.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/CaseChangingCharStream.java b/src/main/java/com/github/_1c_syntax/bsl/parser/CaseChangingCharStream.java index b3c359b7..efb327a0 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/CaseChangingCharStream.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/CaseChangingCharStream.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizer.java b/src/main/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizer.java index ac754abc..fed1dbcd 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizer.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizer.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/Tokenizer.java b/src/main/java/com/github/_1c_syntax/bsl/parser/Tokenizer.java index 14a02bf8..d0688ffd 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/Tokenizer.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/Tokenizer.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/UnicodeBOMInputStream.java b/src/main/java/com/github/_1c_syntax/bsl/parser/UnicodeBOMInputStream.java index 38a68faa..09eeffa1 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/UnicodeBOMInputStream.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/UnicodeBOMInputStream.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReader.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReader.java index bc951c2a..cc3e618d 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReader.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReader.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/MethodDescription.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/MethodDescription.java index dd9d4295..cbb5bedd 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/MethodDescription.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/MethodDescription.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/SourceDefinedSymbolDescription.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/SourceDefinedSymbolDescription.java index 418ef100..23902ce9 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/SourceDefinedSymbolDescription.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/SourceDefinedSymbolDescription.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/VariableDescription.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/VariableDescription.java index 43b0247d..f20700ce 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/VariableDescription.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/VariableDescription.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/package-info.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/package-info.java index 2cbf0316..ca3c4a4f 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/package-info.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/package-info.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/DescriptionReader.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/DescriptionReader.java index 7d872b04..a732028d 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/DescriptionReader.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/DescriptionReader.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/ParameterDescription.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/ParameterDescription.java index 201d8609..c637d95c 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/ParameterDescription.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/ParameterDescription.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRange.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRange.java index 0be9a38f..f0fe6fbc 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRange.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRange.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/TypeDescription.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/TypeDescription.java index 8c53288c..44f1c90e 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/TypeDescription.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/TypeDescription.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/package-info.java b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/package-info.java index 14d68dca..0df1eb4e 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/package-info.java +++ b/src/main/java/com/github/_1c_syntax/bsl/parser/description/support/package-info.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractLexerTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractLexerTest.java index 34e1be53..29fba6d2 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractLexerTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractLexerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractParserTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractParserTest.java index 267a4935..9bf74e5f 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractParserTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/AbstractParserTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLLexerTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLLexerTest.java index 00edb989..d0e6aed7 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLLexerTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLLexerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later @@ -593,7 +593,8 @@ void checkAsyncModeMapping() { || BSLLexer.PREPROC_ANY == i || BSLLexer.ANNOTATION_UNKNOWN == i || BSLLexer.PREPROC_DELETE_ANY == i - || BSLLexer.UNKNOWN == i) { + || BSLLexer.UNKNOWN == i + || BSLLexer.PREPROC_NATIVE == i) { assertThat(tokenTypes).doesNotContain(i); } else { assertThat(tokenTypes).contains(i); diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionLexerTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionLexerTest.java index 99b01eb4..32b4fb4b 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionLexerTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionLexerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionParserTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionParserTest.java index b1f6f28d..da57f2db 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionParserTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLMethodDescriptionParserTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLParserTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLParserTest.java index 482835f6..c91f1242 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLParserTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLParserTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later @@ -80,18 +80,51 @@ void testShebang() { } + @Test + void testNative() { + setInput("#native"); + assertMatches(parser.preproc_native()); + + } + + @Test + void testNativeFile() { + setInput("#native\n" + + "#Использовать lib\n" + + "#Использовать \".\"\n" + + "Перем А;" + ); + + var file = parser.file(); + assertMatches(file); + } + + @Test + void testModuleAnnotations() { + + setInput("#Использовать А"); + assertMatches(parser.moduleAnnotations()); + + setInput("#Использовать \".\""); + assertMatches(parser.moduleAnnotations()); + + setInput("#native"); + assertMatches(parser.moduleAnnotations()); + + } + @Test void testUse() { - setInput("Использовать lib", BSLLexer.PREPROCESSOR_MODE); + setInput("#Использовать lib"); assertMatches(parser.use()); - setInput("Использовать \"./lib\"", BSLLexer.PREPROCESSOR_MODE); + setInput("#Использовать \"./lib\""); assertMatches(parser.use()); - setInput("Использовать lib-name", BSLLexer.PREPROCESSOR_MODE); + setInput("#Использовать lib-name"); assertMatches(parser.use()); - setInput("Использовать 1lib", BSLLexer.PREPROCESSOR_MODE); + setInput("#Использовать 1lib"); assertMatches(parser.use()); } @@ -306,9 +339,6 @@ void TestPreprocessor() { setInput("#КонецЕсли"); assertMatches(parser.preprocessor()); - setInput("#Использовать А"); - assertMatches(parser.preprocessor()); - setInput("#Просто"); assertNotMatches(parser.preprocessor()); diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLTokenizerTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLTokenizerTest.java index 021406fa..2ee85292 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/BSLTokenizerTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/BSLTokenizerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLLexerTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLLexerTest.java index 54612b28..0c5614f7 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLLexerTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLLexerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLParserTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLParserTest.java index a8680be3..c79b794c 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLParserTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLParserTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later @@ -291,6 +291,14 @@ void testSelect04() { pair(SDBLParser.RULE_refsPredicate, 0) ); } + @Test + void testSelect05() { + checkSource("src/test/resources/sdbl/select05.sdbl", + pair(SDBLParser.RULE_queries, 1), + pair(SDBLParser.RULE_selectedField, 4), + pair(SDBLParser.RULE_builtInFunctions, 4) + ); + } private void checkSource(String filePath, Pair... rules) { var exampleString = TestUtils.getSourceFromFile(filePath); diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizerTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizerTest.java index 1a60d69c..ecef5215 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizerTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/SDBLTokenizerTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReaderTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReaderTest.java index 845ac8f7..6d7ce82a 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReaderTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReaderTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRangeTest.java b/src/test/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRangeTest.java index 70553ca5..53692479 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRangeTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/parser/description/support/SimpleRangeTest.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/java/utils/TestUtils.java b/src/test/java/utils/TestUtils.java index fbefad33..74bec107 100644 --- a/src/test/java/utils/TestUtils.java +++ b/src/test/java/utils/TestUtils.java @@ -1,7 +1,7 @@ /* * This file is a part of BSL Parser. * - * Copyright (c) 2018-2022 + * Copyright (c) 2018-2023 * Alexey Sosnoviy , Nikita Fedkin , Sergey Batanov * * SPDX-License-Identifier: LGPL-3.0-or-later diff --git a/src/test/resources/sdbl/select05.sdbl b/src/test/resources/sdbl/select05.sdbl new file mode 100644 index 00000000..6af9da4a --- /dev/null +++ b/src/test/resources/sdbl/select05.sdbl @@ -0,0 +1,7 @@ +ВЫБРАТЬ + ЕСТЬNULL(Справочник1.Реквизит2 = ЗНАЧЕНИЕ(Справочник.Справочник1.Пустаяссылка), ЛОЖЬ) КАК Поле1, + ЕСТЬNULL(Справочник1.Реквизит2, ЛОЖЬ) КАК Поле2, + ЕСТЬNULL(Справочник1.Реквизит2, Справочник1.Реквизит2) КАК Поле3, + ЕСТЬNULL(Справочник1.Реквизит2, Справочник1.Реквизит2 = ЗНАЧЕНИЕ(Справочник.Справочник1.Пустаяссылка)) КАК Поле4 +ИЗ + Справочник.Справочник1 КАК Справочник1 \ No newline at end of file