Skip to content

Support slashes in #Использовать#365

Merged
nixel2007 merged 4 commits intodevelopfrom
copilot/support-slashes-in-usage
Mar 14, 2026
Merged

Support slashes in #Использовать#365
nixel2007 merged 4 commits intodevelopfrom
copilot/support-slashes-in-usage

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

#Использовать oint/api/grpc is valid BSL syntax but the lexer rejected it because USE_LETTER only allowed letters and hyphens.

  • Added a USE_SEGMENT fragment in BSLLexer.g4 and restructured USE_IDENTIFIER to use a segment-based pattern (USE_SEGMENT ('/' USE_SEGMENT)*), allowing / only as a separator between non-empty segments. This prevents the lexer from greedily consuming // line comments (e.g., #Использовать lib//comment correctly tokenizes lib as the identifier).
  • Added corresponding lexer and parser tests, including an edge case test for // comment handling.
#Использовать oint/api/grpc
Original prompt

This section details on the original issue you should resolve

<issue_title>Поддержка слэшей в #Использовать</issue_title>
<issue_description>```bsl
#Использовать oint/api/grpc


Это допустимый синтаксис. </issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix support for slashes in #Использовать Support slashes in #Использовать Mar 14, 2026
Copilot AI requested a review from nixel2007 March 14, 2026 10:13
@nixel2007 nixel2007 marked this pull request as ready for review March 14, 2026 10:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the BSL preprocessor #Использовать directive handling so that unquoted library identifiers may include / (e.g., oint/api/grpc), aligning the lexer behavior with valid BSL syntax and adding regression tests.

Changes:

  • Expanded the lexer USE_LETTER fragment in BSLLexer.g4 to include / in USE_MODE.
  • Added lexer test coverage to ensure Использовать oint/api/grpc tokenizes as PREPROC_IDENTIFIER.
  • Added parser match coverage to ensure #Использовать oint/api/grpc is accepted by the use rule.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/antlr/BSLLexer.g4 Allows / in unquoted #Использовать identifiers via USE_MODE rules.
src/test/java/com/github/_1c_syntax/bsl/parser/BSLLexerTest.java Adds a lexer regression test for slash-separated identifiers in Использовать.
src/test/java/com/github/_1c_syntax/bsl/parser/BSLParserMatchesTest.java Adds a parser match test for #Использовать with slash-separated identifiers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Restructure USE_MODE to use USE_SEGMENT pattern so that slashes
are only allowed as separators between segments, not consecutively.
This prevents #Использовать lib//comment from tokenizing the
comment as part of the identifier.

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 14, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/1c-syntax/bsl-parser-testing/contents/src/main/java/com/github/_1c_syntax/bsl/parser/testing
    • Triggering command: /usr/bin/curl curl -s REDACTED /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/ReaderUtils.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/VariableDescriptionReader.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/MethodDescriptionReader.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/MethodDescriptionTokenizer.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/package-info.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/VariableDescription.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/pars�� /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/SourceDefinedSymbolDescription.java /home/REDACTED/work/bsl-parser/bsl-parser/src/main/java/com/github/_1c_syntax/bsl/parser/description/ParameterDescription.java (http block)
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from nixel2007 March 14, 2026 17:16
@sonarqubecloud
Copy link

@nixel2007 nixel2007 merged commit 4e2b924 into develop Mar 14, 2026
17 checks passed
@nixel2007 nixel2007 deleted the copilot/support-slashes-in-usage branch March 14, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Поддержка слэшей в #Использовать

3 participants