Skip to content

BSL001 — Source code parse error

Summary

Source code parse error

Identifiers

Field Value
Rule code BSL001
Compatible alias ParseError
Severity ERROR
Enabled by default Yes
Implemented Yes
Tags syntax

Behavior

  • The public identifier BSL001 and alias ParseError are stable.
  • The rule reports the cases documented on this page.
  • Suppressions and project configuration are applied before publication.
  • The rule requires neither an external analyzer nor network access.

Configuration and suppression

BSL### is the primary stable identifier. The compatible alias is accepted in select, ignore, and compatible block suppression comments.

[tool.onec-hbk-bsl]
select = ["BSL001"]
ignore = ["ParseError"]

All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:

  • noqa:
Value = "example";  // noqa: BSL001
  • bsl-disable:
Value = "example";  // bsl-disable: BSL001
  • compatible BSLLS form:
Value = "example";  // BSLLS:ParseError-off

When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:

// noqa: BSL001
// code without this diagnostic
// noqa-enable: BSL001

// bsl-disable: BSL001
// code without this diagnostic
// bsl-enable: BSL001

// BSLLS:ParseError-off
// code without this diagnostic
// BSLLS:ParseError-on

To disable the rule until the end of the file, omit the closing noqa-enable, bsl-enable, or BSLLS:…-on marker.

Opening and closing markers must belong to the same family.

Description

The error occurs if the source code of the module is written in violation of the language syntax or if the preprocessor instructions are used incorrectly.

Separate grammatical constructions, expressions, as well as declarations and places for calling procedures and functions, should not be split by preprocessor instructions and regions.

Examples

Incorrect:

Procedure Example1()
  a = 1
#Region RegionName
    + 2;
#EndRegion // statement split
EndProcedure

#Region RegionName
Procedure Example2()
    // ...
#EndRegion // procedure split
EndProcedure

If <...> Then
    // ...
#If webClient Then // If-Then block split
Else
    // ...
#EndIf
EndIf;

Result = Example4(Parameter1,
#If Client Then
  Parameter2, // incorrect function call
#EndIf
  Parameter3);

Sources