Every error of every module, in one run
On 1C modules oscript -check nearly always meets a name OneScript does not have — Справочники, Документы, a common module — and stops. OneScript 2.x parses the whole module first, so syntax is still checked in full, but the code generator checks after that point never run: argument count of the module's own methods, a procedure used as a function, a duplicate method, labels. OneScript 1.9.4 compiles in one pass and sees nothing at all after the first unknown name. Each -check also starts the engine: about 0.7 s of 0.9 s per file.
-checkall starts the engine once for all files, collects errors instead of stopping at the first, and lists unknown names separately. -check itself is unchanged. The 2.2.0-vanteam.2 build is also published with ReadyToRun.
Checking 76 modules
Project modules of a 1C:Enterprise 8.3 configuration, wall time of one short run on a loaded machine.
Data
| Mode | Seconds |
|---|---|
| 1.9.4 -check | 49.96 |
| 2.2.0 -check | 80.41 |
| 2.2.0-vanteam.2 -check | 67.12 |
| 2.2.0-vanteam.2 -checkall | 2.38 |
One 155 KB module
Median of 7 interleaved runs. ReadyToRun makes plain -check about a third faster than the official 2.2.0.
Data
| Mode | Median, s |
|---|---|
| 1.9.4 -check | 0.513 |
| 2.2.0 -check | 0.688 |
| 2.2.0-vanteam.1 -check | 0.693 |
| 2.2.0-vanteam.2 -check | 0.477 |
| 2.2.0-vanteam.2 -checkall | 0.614 |
What each engine finds
19 hand-written modules with known error lines, each starting with a Справочники call like real 1C code; 116 real modules (76 of an УПП project, 40 common modules of УТ 10.3). 1.9.4 and 2.2.0 use -check, the fork uses -checkall.
| Found | 1.9.4 | 2.2.0 | 2.2.0-vanteam.2 |
|---|---|---|---|
| Syntax errors after an unknown 1C global | 0 / 10 | 10 / 10 | 10 / 10 |
| Code generator errors after an unknown global | 0 / 4 | 0 / 4 | 4 / 4 |
| Both errors of a module with two | 0 / 4 | 2 / 4 | 4 / 4 |
| Valid modules without a false error | 3 / 3 | 2 / 3 | 3 / 3 |
| Real modules checked to the end | 10 / 116 | 10 / 116 | 116 / 116 |
Preprocessor tests (tests/preprocessor-skipped-branch.os) | 13 / 14 | 4 / 14 | 14 / 14 |
Usage
oscript -encoding=utf-8 -checkall <file or folder> [...] <file>: Ошибка в строке: N,M / message every error of the module <file>: No errors. <file>: unknown symbols: K (...) the 1C global context, not an error Files: X, with errors: Y, not checked: Z Exit code: 0 no errors, 1 errors, 2 a file could not be checked.
OneScript defines no 1C preprocessor symbols, so code under #Если Сервер Тогда is an inactive branch and is skipped by any mode. To check it, also pass a copy of the module with the directive lines blanked out; line numbers stay the same.
A flag that never resets
When an #Если condition is false, the preprocessor skips the branch and looks for the next #. It trusted the iterator's OnNewLine, which only changes when a lexeme is read — so it stayed true for the whole skipped branch, and any # became a directive.
One line, character by character
| Character | А | ␣ | = | ␣ | " | ц | в | е | т | ␣ | # | 0 | 0 | 0 | 0 | 0 | 0 | " | ; |
| OnNewLine in 2.2.0 | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● | ● |
| Line start in the fork | ● | · | · | · | · | · | · | · | · | · | · | · | · | · | · | · | · | · | · |
● true, · false. The # is the 11th character; 2.2.0 accepts it as a directive and fails at column 12, where the lexer expects a letter.
OneScript 2.2.0
while (true)
{
if (iterator.CurrentSymbol == SpecialChars.Preprocessor)
{
if(iterator.OnNewLine)
return true;
}
if (!iterator.MoveNext())
break;
iterator.SkipSpaces();
}This fork
var lineStart = iterator.CurrentSymbol == '\n';var contentLine = iterator.CurrentLine;while (iterator.SkipSpaces()){ if (iterator.CurrentLine != contentLine) lineStart = true; if (lineStart && iterator.CurrentSymbol == SpecialChars.Preprocessor) return true; lineStart = false; contentLine = iterator.CurrentLine; if (!iterator.MoveNext()) break; }
Failing tests first
28 new tests in PreprocessorTests: 14 scenarios, each with CRLF and LF line endings. The other engine test projects pass, and the upstream script suite (tests/testrunner.os, 1,092 tests) gives the same result for every test as a control build of the same commit without the fix.
OneScript.Language.Tests
Five of the new tests also pass on upstream: four guard tests that require real errors to stay errors, and the CRLF variant of the #КонецОбласти case — that defect shows only with LF.
Upstream script suite
0 differences across 1,092 tests. The two failures are the same in both builds and come from the test environment.
19 files, four engines
oscript -check on hand-written cases. Windows is defined by OneScript on Windows (an active branch), Клиент is not (an inactive one). A red ring marks a result that differs from the expected one. The control build equals the official 2.2.0 on all 19.
| Case | Expected | 1.9.4 | 2.2.0 | 2.2.0 control | fork |
|---|---|---|---|---|---|
inactive_hash | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
inactive_hash_lf | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
directive_names_in_strings | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
multiline_string | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
comments | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
indented_directives | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
nested_else_elseif | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
solved_branch | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
region_endif_crlf | ✓ no errors | ✓ | ✓ | ✓ | ✓ |
region_endif_lf | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
unclosed_comment | ✕ error | ✕ | ✓ | ✓ | ✕ |
unclosed_string | ✕ error | ✕ | ✕ | ✕ | ✕ |
midline_endif | ✕ error | ✕ | ✓ | ✓ | ✕ |
invalid_directive_line_start | ✕ error | ✓ | ✕ | ✕ | ✕ |
active_midline_directive | ✕ error | ✕ | ✕ | ✕ | ✕ |
active_syntax_error | ✕ error | ✕ | ✕ | ✕ | ✕ |
strfind | ✓ no errors | ✓ | ✓ | ✓ | ✓ |
evidence_inactive_hash | ✓ no errors | ✓ | ✕ | ✕ | ✓ |
evidence_strfind | ✓ no errors | ✓ | ✓ | ✓ | ✓ |
11,275 modules of a 1C:Enterprise 8.3 configuration
A configuration dump, the project's own modules and its archived builds, each checked by both engines. Every difference has the same shape: 2.2.0 stops at a # inside a string literal — HTML colours, code templates, query-text placeholders.
False preprocessor errors
Data
| Module set | Files | 2.2.0 | Fork |
|---|---|---|---|
| Configuration dump | 3,667 | 29 | 0 |
| Project modules | 76 | 1 | 0 |
| Archived builds | 7,532 | 60 | 0 |
Median check time per file
Unchanged: process start-up dominates.
Data
| Module set | 2.2.0, s | Fork, s |
|---|---|---|
| Configuration dump | 0.920 | 0.920 |
| Project modules | 0.945 | 0.920 |
| Archived builds | 0.880 | 0.860 |
What the fork reports instead
On all 90 modules the result and the error line match OneScript 1.9.4. The later errors are Неизвестный символ: the 1C global context does not exist in OneScript. Since -check stops at the first error, 90 is a lower bound. No module got worse.
Build from source
git clone https://github.com/ivanbokhan84/OneScript.git cd OneScript dotnet test src/Tests/OneScript.Language.Tests/OneScript.Language.Tests.csproj -c Release -p:Platform=AnyCPU dotnet publish src/oscript/oscript.csproj -r win-x64 --self-contained -c Release -p:VersionPrefix=2.2.0 -p:VersionSuffix=vanteam.2 -p:PublishReadyToRun=true -o dist/bin