@jbearak/sight 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sight-server.js +357 -42
- package/dist/sight-server.js.sha256 +1 -1
- package/package.json +1 -1
package/dist/sight-server.js
CHANGED
|
@@ -52,7 +52,7 @@ var package_default;
|
|
|
52
52
|
var init_package = __esm(() => {
|
|
53
53
|
package_default = {
|
|
54
54
|
name: "@jbearak/sight",
|
|
55
|
-
version: "0.14.
|
|
55
|
+
version: "0.14.2",
|
|
56
56
|
type: "module",
|
|
57
57
|
workspaces: [
|
|
58
58
|
"client"
|
|
@@ -17334,6 +17334,9 @@ function inline_embedded_statement_end(tokens, opener_index) {
|
|
|
17334
17334
|
const end_index = my_i < tokens.length && tokens[my_i].type === "STATEMENT_TERMINATOR" ? my_i : my_last_content_index;
|
|
17335
17335
|
return { end_index, end_line };
|
|
17336
17336
|
}
|
|
17337
|
+
function is_logical_statement_boundary(my_token) {
|
|
17338
|
+
return LOGICAL_BOUNDARY_TYPES.has(my_token.type);
|
|
17339
|
+
}
|
|
17337
17340
|
function logical_statement_start(tokens, position, min_line = 0) {
|
|
17338
17341
|
if (tokens === undefined || tokens.length === 0) {
|
|
17339
17342
|
return;
|
|
@@ -17358,7 +17361,7 @@ function logical_statement_start(tokens, position, min_line = 0) {
|
|
|
17358
17361
|
if (is_swallowed_continuation_terminator(my_token, my_i > 0 && tokens[my_i - 1].type === "CONTINUATION")) {
|
|
17359
17362
|
continue;
|
|
17360
17363
|
}
|
|
17361
|
-
if (
|
|
17364
|
+
if (is_logical_statement_boundary(my_token)) {
|
|
17362
17365
|
boundary_index = my_i;
|
|
17363
17366
|
break;
|
|
17364
17367
|
}
|
|
@@ -28281,6 +28284,236 @@ var init_diagnostic_token_stream = __esm(() => {
|
|
|
28281
28284
|
function is_invalid_operator_sequence_pair(first_value, second_value) {
|
|
28282
28285
|
return INVALID_PAIRS.has(`${first_value} ${second_value}`);
|
|
28283
28286
|
}
|
|
28287
|
+
function resolve_mixed_effects_command_head(the_significant, statement_start, statement_end) {
|
|
28288
|
+
let my_i = statement_start;
|
|
28289
|
+
while (my_i < statement_end) {
|
|
28290
|
+
const my_prefix = the_significant[my_i];
|
|
28291
|
+
if (my_prefix.type !== "WORD") {
|
|
28292
|
+
break;
|
|
28293
|
+
}
|
|
28294
|
+
if (MIXED_COLON_OPTIONAL_PREFIX_COMMANDS.has(my_prefix.value)) {
|
|
28295
|
+
my_i++;
|
|
28296
|
+
if (my_i < statement_end && the_significant[my_i].type === "COLON") {
|
|
28297
|
+
my_i++;
|
|
28298
|
+
}
|
|
28299
|
+
continue;
|
|
28300
|
+
}
|
|
28301
|
+
if (MIXED_COLON_REQUIRED_PREFIX_COMMANDS.has(my_prefix.value) && my_i + 1 < statement_end && the_significant[my_i + 1].type === "COLON") {
|
|
28302
|
+
my_i += 2;
|
|
28303
|
+
continue;
|
|
28304
|
+
}
|
|
28305
|
+
break;
|
|
28306
|
+
}
|
|
28307
|
+
const my_command = the_significant[my_i];
|
|
28308
|
+
if (my_i >= statement_end || my_command?.type !== "WORD") {
|
|
28309
|
+
return;
|
|
28310
|
+
}
|
|
28311
|
+
const my_continuation = the_significant[my_i + 1];
|
|
28312
|
+
if (my_i + 1 < statement_end && is_name_continuation_fragment(my_continuation) && is_adjacent(my_command, my_continuation)) {
|
|
28313
|
+
return;
|
|
28314
|
+
}
|
|
28315
|
+
return { token: my_command, index: my_i };
|
|
28316
|
+
}
|
|
28317
|
+
function is_matching_group_close(my_opener, close_type) {
|
|
28318
|
+
return my_opener === "LPAREN" && close_type === "RPAREN" || my_opener === "LBRACKET" && close_type === "RBRACKET";
|
|
28319
|
+
}
|
|
28320
|
+
function is_name_fragment(my_token) {
|
|
28321
|
+
return my_token !== undefined && NAME_FRAGMENT_TOKEN_TYPES.has(my_token.type);
|
|
28322
|
+
}
|
|
28323
|
+
function is_name_continuation_fragment(my_token) {
|
|
28324
|
+
return my_token !== undefined && NAME_CONTINUATION_TOKEN_TYPES.has(my_token.type);
|
|
28325
|
+
}
|
|
28326
|
+
function is_plausible_model_head(the_significant, model_head_index, statement_end) {
|
|
28327
|
+
const my_head = the_significant[model_head_index];
|
|
28328
|
+
if (is_mixed_varlist_wildcard(my_head)) {
|
|
28329
|
+
return true;
|
|
28330
|
+
}
|
|
28331
|
+
if (!is_name_fragment(my_head)) {
|
|
28332
|
+
return false;
|
|
28333
|
+
}
|
|
28334
|
+
if (my_head.type !== "WORD" || my_head.value !== "if" && my_head.value !== "in") {
|
|
28335
|
+
return true;
|
|
28336
|
+
}
|
|
28337
|
+
const my_continuation = the_significant[model_head_index + 1];
|
|
28338
|
+
return model_head_index + 1 < statement_end && is_name_continuation_fragment(my_continuation) && is_adjacent(my_head, my_continuation);
|
|
28339
|
+
}
|
|
28340
|
+
function is_mixed_varlist_wildcard(my_token) {
|
|
28341
|
+
return my_token?.type === "OPERATOR" && my_token.value === "*" || (my_token?.type === "OPERATOR" || my_token?.type === "WORD") && my_token.value === "?";
|
|
28342
|
+
}
|
|
28343
|
+
function is_mixed_constructed_name_fragment(my_token) {
|
|
28344
|
+
return is_name_continuation_fragment(my_token) || is_mixed_varlist_wildcard(my_token);
|
|
28345
|
+
}
|
|
28346
|
+
function is_standalone_mixed_qualifier(the_significant, token_index) {
|
|
28347
|
+
const my_token = the_significant[token_index];
|
|
28348
|
+
if (my_token.type !== "WORD" || my_token.value !== "if" && my_token.value !== "in") {
|
|
28349
|
+
return false;
|
|
28350
|
+
}
|
|
28351
|
+
const my_previous = the_significant[token_index - 1];
|
|
28352
|
+
const my_next = the_significant[token_index + 1];
|
|
28353
|
+
return !(is_mixed_constructed_name_fragment(my_previous) && is_adjacent(my_previous, my_token) || is_mixed_constructed_name_fragment(my_next) && is_adjacent(my_token, my_next));
|
|
28354
|
+
}
|
|
28355
|
+
function is_plausible_mixed_varlist_range_dash(the_significant, dash_index) {
|
|
28356
|
+
const my_dash = the_significant[dash_index];
|
|
28357
|
+
const my_right_fragment = the_significant[dash_index + 1];
|
|
28358
|
+
if (my_dash.type !== "OPERATOR" || my_dash.value !== "-" || !is_name_fragment(my_right_fragment) || !is_adjacent(my_dash, my_right_fragment)) {
|
|
28359
|
+
return false;
|
|
28360
|
+
}
|
|
28361
|
+
let my_right_boundary = my_dash;
|
|
28362
|
+
for (let my_i = dash_index - 1;my_i >= 0; my_i--) {
|
|
28363
|
+
const my_left_fragment = the_significant[my_i];
|
|
28364
|
+
if (!is_name_continuation_fragment(my_left_fragment) || !is_adjacent(my_left_fragment, my_right_boundary)) {
|
|
28365
|
+
return false;
|
|
28366
|
+
}
|
|
28367
|
+
if (is_name_fragment(my_left_fragment)) {
|
|
28368
|
+
return true;
|
|
28369
|
+
}
|
|
28370
|
+
my_right_boundary = my_left_fragment;
|
|
28371
|
+
}
|
|
28372
|
+
return false;
|
|
28373
|
+
}
|
|
28374
|
+
function has_dangling_operator_before_mixed_separator(the_significant, first_bar_index, mixed_varlist_is_open) {
|
|
28375
|
+
const my_previous = the_significant[first_bar_index - 1];
|
|
28376
|
+
if (!is_mixed_varlist_wildcard(my_previous)) {
|
|
28377
|
+
return my_previous?.type === "OPERATOR";
|
|
28378
|
+
}
|
|
28379
|
+
if (!mixed_varlist_is_open) {
|
|
28380
|
+
return true;
|
|
28381
|
+
}
|
|
28382
|
+
let my_i = first_bar_index - 2;
|
|
28383
|
+
while (is_mixed_varlist_wildcard(the_significant[my_i])) {
|
|
28384
|
+
my_i--;
|
|
28385
|
+
}
|
|
28386
|
+
return the_significant[my_i]?.type === "OPERATOR";
|
|
28387
|
+
}
|
|
28388
|
+
function plausible_levelvar_colon_index(the_significant, first_bar_index, statement_end) {
|
|
28389
|
+
const my_first_fragment_index = first_bar_index + 2;
|
|
28390
|
+
const my_first_fragment = the_significant[my_first_fragment_index];
|
|
28391
|
+
if (!is_name_fragment(my_first_fragment)) {
|
|
28392
|
+
return;
|
|
28393
|
+
}
|
|
28394
|
+
let my_fragment_count = 1;
|
|
28395
|
+
let my_last_fragment_index = my_first_fragment_index;
|
|
28396
|
+
while (my_last_fragment_index + 1 < statement_end) {
|
|
28397
|
+
const my_last_fragment = the_significant[my_last_fragment_index];
|
|
28398
|
+
const my_next_fragment = the_significant[my_last_fragment_index + 1];
|
|
28399
|
+
if (!is_name_continuation_fragment(my_next_fragment) || !is_adjacent(my_last_fragment, my_next_fragment)) {
|
|
28400
|
+
break;
|
|
28401
|
+
}
|
|
28402
|
+
my_fragment_count++;
|
|
28403
|
+
my_last_fragment_index++;
|
|
28404
|
+
}
|
|
28405
|
+
const my_colon_index = my_last_fragment_index + 1;
|
|
28406
|
+
const my_colon = the_significant[my_colon_index];
|
|
28407
|
+
if (my_colon?.type !== "COLON") {
|
|
28408
|
+
return;
|
|
28409
|
+
}
|
|
28410
|
+
if (my_fragment_count === 1 && my_first_fragment.type === "WORD" && (my_first_fragment.value === "if" || my_first_fragment.value === "in")) {
|
|
28411
|
+
return;
|
|
28412
|
+
}
|
|
28413
|
+
return my_colon_index;
|
|
28414
|
+
}
|
|
28415
|
+
function mark_mixed_effects_separators_in_statement(the_significant, statement_start, statement_end, the_separator_starts) {
|
|
28416
|
+
const my_command_head = resolve_mixed_effects_command_head(the_significant, statement_start, statement_end);
|
|
28417
|
+
if (my_command_head === undefined || !MIXED_EFFECTS_SEPARATOR_COMMANDS.has(my_command_head.token.value)) {
|
|
28418
|
+
return;
|
|
28419
|
+
}
|
|
28420
|
+
const my_group_stack = [];
|
|
28421
|
+
const my_has_required_model_content = OMITTED_MODEL_HEAD_COMMANDS.has(my_command_head.token.value) || is_plausible_model_head(the_significant, my_command_head.index + 1, statement_end);
|
|
28422
|
+
let my_saw_top_level_options_comma = false;
|
|
28423
|
+
let my_saw_top_level_double_bar = false;
|
|
28424
|
+
let my_has_marked_separator = false;
|
|
28425
|
+
let my_separators_are_valid = true;
|
|
28426
|
+
let my_mixed_varlist_is_open = true;
|
|
28427
|
+
for (let my_i = my_command_head.index + 1;my_i < statement_end; my_i++) {
|
|
28428
|
+
const my_token = the_significant[my_i];
|
|
28429
|
+
if (my_token.type === "LPAREN" || my_token.type === "LBRACKET") {
|
|
28430
|
+
my_group_stack.push(my_token.type);
|
|
28431
|
+
continue;
|
|
28432
|
+
}
|
|
28433
|
+
if (my_token.type === "RPAREN" || my_token.type === "RBRACKET") {
|
|
28434
|
+
if (!is_matching_group_close(my_group_stack[my_group_stack.length - 1], my_token.type)) {
|
|
28435
|
+
break;
|
|
28436
|
+
}
|
|
28437
|
+
my_group_stack.pop();
|
|
28438
|
+
continue;
|
|
28439
|
+
}
|
|
28440
|
+
if (my_group_stack.length !== 0) {
|
|
28441
|
+
continue;
|
|
28442
|
+
}
|
|
28443
|
+
if (my_token.type === "COMMA") {
|
|
28444
|
+
if (!my_has_marked_separator) {
|
|
28445
|
+
my_saw_top_level_options_comma = true;
|
|
28446
|
+
}
|
|
28447
|
+
my_mixed_varlist_is_open = false;
|
|
28448
|
+
continue;
|
|
28449
|
+
}
|
|
28450
|
+
if (is_standalone_mixed_qualifier(the_significant, my_i)) {
|
|
28451
|
+
my_mixed_varlist_is_open = false;
|
|
28452
|
+
}
|
|
28453
|
+
const my_second_bar = the_significant[my_i + 1];
|
|
28454
|
+
if (my_token.type !== "OPERATOR" || my_token.value !== "|" || my_second_bar?.type !== "OPERATOR" || my_second_bar.value !== "|" || !is_adjacent(my_token, my_second_bar)) {
|
|
28455
|
+
if (my_token.type === "OPERATOR" && !is_mixed_varlist_wildcard(my_token) && !(my_mixed_varlist_is_open && is_plausible_mixed_varlist_range_dash(the_significant, my_i))) {
|
|
28456
|
+
my_mixed_varlist_is_open = false;
|
|
28457
|
+
}
|
|
28458
|
+
continue;
|
|
28459
|
+
}
|
|
28460
|
+
if (!my_saw_top_level_double_bar) {
|
|
28461
|
+
my_saw_top_level_double_bar = true;
|
|
28462
|
+
if (!my_has_required_model_content) {
|
|
28463
|
+
my_separators_are_valid = false;
|
|
28464
|
+
}
|
|
28465
|
+
}
|
|
28466
|
+
const my_levelvar_colon_index = plausible_levelvar_colon_index(the_significant, my_i, statement_end);
|
|
28467
|
+
if (!my_separators_are_valid || !my_has_marked_separator && my_saw_top_level_options_comma || has_dangling_operator_before_mixed_separator(the_significant, my_i, my_mixed_varlist_is_open) || my_levelvar_colon_index === undefined) {
|
|
28468
|
+
my_mixed_varlist_is_open = false;
|
|
28469
|
+
continue;
|
|
28470
|
+
}
|
|
28471
|
+
the_separator_starts.add(my_token);
|
|
28472
|
+
my_has_marked_separator = true;
|
|
28473
|
+
my_mixed_varlist_is_open = true;
|
|
28474
|
+
my_i = my_levelvar_colon_index;
|
|
28475
|
+
}
|
|
28476
|
+
}
|
|
28477
|
+
function file_mentions_mixed_effects_command(tokens) {
|
|
28478
|
+
for (const my_token of tokens) {
|
|
28479
|
+
if (my_token.type === "WORD" && MIXED_EFFECTS_SEPARATOR_COMMANDS.has(my_token.value)) {
|
|
28480
|
+
return true;
|
|
28481
|
+
}
|
|
28482
|
+
}
|
|
28483
|
+
return false;
|
|
28484
|
+
}
|
|
28485
|
+
function collect_mixed_effects_separator_starts(tokens) {
|
|
28486
|
+
const my_memoized = mixed_effects_separator_starts_memo.get(tokens);
|
|
28487
|
+
if (my_memoized !== undefined) {
|
|
28488
|
+
return my_memoized;
|
|
28489
|
+
}
|
|
28490
|
+
const the_separator_starts = compute_mixed_effects_separator_starts(tokens);
|
|
28491
|
+
mixed_effects_separator_starts_memo.set(tokens, the_separator_starts);
|
|
28492
|
+
return the_separator_starts;
|
|
28493
|
+
}
|
|
28494
|
+
function compute_mixed_effects_separator_starts(tokens) {
|
|
28495
|
+
if (!file_mentions_mixed_effects_command(tokens)) {
|
|
28496
|
+
return new Set;
|
|
28497
|
+
}
|
|
28498
|
+
const the_significant = collect_significant_tokens(tokens);
|
|
28499
|
+
const the_separator_starts = new Set;
|
|
28500
|
+
let statement_start = 0;
|
|
28501
|
+
for (let my_i = 0;my_i <= the_significant.length; my_i++) {
|
|
28502
|
+
const my_token = the_significant[my_i];
|
|
28503
|
+
const at_end = my_token === undefined || my_token.type === "EOF";
|
|
28504
|
+
if (!at_end && !is_logical_statement_boundary(my_token)) {
|
|
28505
|
+
continue;
|
|
28506
|
+
}
|
|
28507
|
+
if (statement_start < my_i) {
|
|
28508
|
+
mark_mixed_effects_separators_in_statement(the_significant, statement_start, my_i, the_separator_starts);
|
|
28509
|
+
}
|
|
28510
|
+
if (at_end) {
|
|
28511
|
+
break;
|
|
28512
|
+
}
|
|
28513
|
+
statement_start = my_i + 1;
|
|
28514
|
+
}
|
|
28515
|
+
return the_separator_starts;
|
|
28516
|
+
}
|
|
28284
28517
|
|
|
28285
28518
|
class OperatorSequenceAnalyzer {
|
|
28286
28519
|
analyze(document, config) {
|
|
@@ -28297,6 +28530,7 @@ class OperatorSequenceAnalyzer {
|
|
|
28297
28530
|
}
|
|
28298
28531
|
const ignored_lines = document.ignored_lines ?? new Set;
|
|
28299
28532
|
const ast = document.ast;
|
|
28533
|
+
const the_mixed_effects_separator_starts = collect_mixed_effects_separator_starts(the_tokens);
|
|
28300
28534
|
const the_diagnostics = [];
|
|
28301
28535
|
let i = 0;
|
|
28302
28536
|
while (i < the_tokens.length) {
|
|
@@ -28311,6 +28545,10 @@ class OperatorSequenceAnalyzer {
|
|
|
28311
28545
|
continue;
|
|
28312
28546
|
}
|
|
28313
28547
|
const { second_token, next_index } = adjacency_result;
|
|
28548
|
+
if (the_mixed_effects_separator_starts.has(first_token)) {
|
|
28549
|
+
i = next_index;
|
|
28550
|
+
continue;
|
|
28551
|
+
}
|
|
28314
28552
|
const pair_result = this.classify_pair(first_token, second_token, ast ?? undefined);
|
|
28315
28553
|
if (!pair_result) {
|
|
28316
28554
|
i++;
|
|
@@ -28559,11 +28797,12 @@ class OperatorSequenceAnalyzer {
|
|
|
28559
28797
|
return resolve_diagnostic_severity(config_severity, default_severity);
|
|
28560
28798
|
}
|
|
28561
28799
|
}
|
|
28562
|
-
var import_node3, SPACED_COMPOUND_PAIRS, MALFORMED_OPERATOR_PAIRS, INVALID_PAIRS, CSTYLE_LOGICAL_PAIRS, SPECIAL_MESSAGES, CSTYLE_QUALIFIER_MESSAGES, CSTYLE_CONTROL_FLOW_MESSAGES, ARITHMETIC_OPS, COMPARISON_OPS, NEGATION_OPS, TRIVIA_TYPES, ADJACENCY_BREAKERS;
|
|
28800
|
+
var import_node3, SPACED_COMPOUND_PAIRS, MALFORMED_OPERATOR_PAIRS, INVALID_PAIRS, CSTYLE_LOGICAL_PAIRS, SPECIAL_MESSAGES, CSTYLE_QUALIFIER_MESSAGES, CSTYLE_CONTROL_FLOW_MESSAGES, ARITHMETIC_OPS, COMPARISON_OPS, NEGATION_OPS, TRIVIA_TYPES, ADJACENCY_BREAKERS, MIXED_EFFECTS_SEPARATOR_COMMANDS, OMITTED_MODEL_HEAD_COMMANDS, MIXED_COLON_OPTIONAL_PREFIX_COMMANDS, MIXED_COLON_REQUIRED_PREFIX_COMMANDS, NAME_FRAGMENT_TOKEN_TYPES, NAME_CONTINUATION_TOKEN_TYPES, mixed_effects_separator_starts_memo;
|
|
28563
28801
|
var init_operator_sequence_diagnostics = __esm(() => {
|
|
28564
28802
|
init_types();
|
|
28565
28803
|
init_diagnostic_code_description();
|
|
28566
28804
|
init_diagnostic_severity();
|
|
28805
|
+
init_statement_span();
|
|
28567
28806
|
init_diagnostic_token_stream();
|
|
28568
28807
|
import_node3 = __toESM(require_main4(), 1);
|
|
28569
28808
|
SPACED_COMPOUND_PAIRS = new Map([
|
|
@@ -28619,6 +28858,58 @@ var init_operator_sequence_diagnostics = __esm(() => {
|
|
|
28619
28858
|
ADJACENCY_BREAKERS = new Set([
|
|
28620
28859
|
"STATEMENT_TERMINATOR"
|
|
28621
28860
|
]);
|
|
28861
|
+
MIXED_EFFECTS_SEPARATOR_COMMANDS = new Set([
|
|
28862
|
+
"mixed",
|
|
28863
|
+
"mecloglog",
|
|
28864
|
+
"meglm",
|
|
28865
|
+
"meintreg",
|
|
28866
|
+
"melogit",
|
|
28867
|
+
"menbreg",
|
|
28868
|
+
"meologit",
|
|
28869
|
+
"meoprobit",
|
|
28870
|
+
"mepoisson",
|
|
28871
|
+
"meprobit",
|
|
28872
|
+
"meqrlogit",
|
|
28873
|
+
"meqrpoisson",
|
|
28874
|
+
"mestreg",
|
|
28875
|
+
"metobit",
|
|
28876
|
+
"xtmixed",
|
|
28877
|
+
"xtmelogit",
|
|
28878
|
+
"xtmepoisson"
|
|
28879
|
+
]);
|
|
28880
|
+
OMITTED_MODEL_HEAD_COMMANDS = new Set([
|
|
28881
|
+
"mestreg"
|
|
28882
|
+
]);
|
|
28883
|
+
MIXED_COLON_OPTIONAL_PREFIX_COMMANDS = new Set([
|
|
28884
|
+
"cap",
|
|
28885
|
+
"capt",
|
|
28886
|
+
"captu",
|
|
28887
|
+
"captur",
|
|
28888
|
+
"capture",
|
|
28889
|
+
"qui",
|
|
28890
|
+
"quie",
|
|
28891
|
+
"quiet",
|
|
28892
|
+
"quietl",
|
|
28893
|
+
"quietly",
|
|
28894
|
+
"noi",
|
|
28895
|
+
"nois",
|
|
28896
|
+
"noisi",
|
|
28897
|
+
"noisil",
|
|
28898
|
+
"noisily"
|
|
28899
|
+
]);
|
|
28900
|
+
MIXED_COLON_REQUIRED_PREFIX_COMMANDS = new Set([
|
|
28901
|
+
"xi"
|
|
28902
|
+
]);
|
|
28903
|
+
NAME_FRAGMENT_TOKEN_TYPES = new Set([
|
|
28904
|
+
"WORD",
|
|
28905
|
+
"MACRO_REF_LOCAL",
|
|
28906
|
+
"MACRO_REF_GLOBAL"
|
|
28907
|
+
]);
|
|
28908
|
+
NAME_CONTINUATION_TOKEN_TYPES = new Set([
|
|
28909
|
+
...NAME_FRAGMENT_TOKEN_TYPES,
|
|
28910
|
+
"NUMBER"
|
|
28911
|
+
]);
|
|
28912
|
+
mixed_effects_separator_starts_memo = new WeakMap;
|
|
28622
28913
|
});
|
|
28623
28914
|
|
|
28624
28915
|
// src/providers/mixed-logical-diagnostics.ts
|
|
@@ -28641,6 +28932,7 @@ class MixedLogicalOperatorAnalyzer {
|
|
|
28641
28932
|
}
|
|
28642
28933
|
const my_ignored_lines = document.ignored_lines ?? new Set;
|
|
28643
28934
|
const my_severity = resolve_diagnostic_severity(my_config_severity);
|
|
28935
|
+
const the_mixed_effects_separator_starts = collect_mixed_effects_separator_starts(the_tokens);
|
|
28644
28936
|
const my_diagnostics = [];
|
|
28645
28937
|
let my_state = this.fresh_state();
|
|
28646
28938
|
let my_in_continuation = false;
|
|
@@ -28650,6 +28942,13 @@ class MixedLogicalOperatorAnalyzer {
|
|
|
28650
28942
|
my_in_continuation = false;
|
|
28651
28943
|
continue;
|
|
28652
28944
|
}
|
|
28945
|
+
if (the_mixed_effects_separator_starts.has(my_token)) {
|
|
28946
|
+
my_in_continuation = false;
|
|
28947
|
+
this.flush(my_state, my_diagnostics, my_severity, my_ignored_lines);
|
|
28948
|
+
my_state = this.fresh_state();
|
|
28949
|
+
i++;
|
|
28950
|
+
continue;
|
|
28951
|
+
}
|
|
28653
28952
|
if (this.is_qualifier_breaker(my_token, my_state)) {
|
|
28654
28953
|
my_in_continuation = false;
|
|
28655
28954
|
this.flush(my_state, my_diagnostics, my_severity, my_ignored_lines);
|
|
@@ -28674,7 +28973,7 @@ class MixedLogicalOperatorAnalyzer {
|
|
|
28674
28973
|
}
|
|
28675
28974
|
continue;
|
|
28676
28975
|
}
|
|
28677
|
-
if (my_token.type === "WHITESPACE") {
|
|
28976
|
+
if (my_token.type === "WHITESPACE" || my_token.type === "COMMENT_LINE") {
|
|
28678
28977
|
continue;
|
|
28679
28978
|
}
|
|
28680
28979
|
if (my_token.type === "CONTINUATION") {
|
|
@@ -28740,11 +29039,10 @@ class MixedLogicalOperatorAnalyzer {
|
|
|
28740
29039
|
let my_in_continuation = false;
|
|
28741
29040
|
for (let my_i = start_index + 1;my_i < the_tokens.length; my_i++) {
|
|
28742
29041
|
const my_next_token = the_tokens[my_i];
|
|
28743
|
-
if (my_next_token.type
|
|
28744
|
-
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
my_in_continuation = true;
|
|
29042
|
+
if (COMPOUND_LOGICAL_TRIVIA_TYPES.has(my_next_token.type)) {
|
|
29043
|
+
if (my_next_token.type === "CONTINUATION") {
|
|
29044
|
+
my_in_continuation = true;
|
|
29045
|
+
}
|
|
28748
29046
|
continue;
|
|
28749
29047
|
}
|
|
28750
29048
|
if (is_swallowed_continuation_terminator(my_next_token, my_in_continuation)) {
|
|
@@ -28787,21 +29085,27 @@ class MixedLogicalOperatorAnalyzer {
|
|
|
28787
29085
|
}
|
|
28788
29086
|
}
|
|
28789
29087
|
}
|
|
28790
|
-
var import_node4, LOGICAL_OPS, QUALIFIER_BREAKERS, EXPRESSION_BREAKERS;
|
|
29088
|
+
var import_node4, LOGICAL_OPS, QUALIFIER_BREAKERS, EXPRESSION_BREAKERS, COMPOUND_LOGICAL_TRIVIA_TYPES;
|
|
28791
29089
|
var init_mixed_logical_diagnostics = __esm(() => {
|
|
28792
29090
|
init_types();
|
|
28793
29091
|
init_diagnostic_code_description();
|
|
28794
29092
|
init_diagnostic_severity();
|
|
28795
29093
|
init_diagnostic_token_stream();
|
|
29094
|
+
init_operator_sequence_diagnostics();
|
|
28796
29095
|
import_node4 = __toESM(require_main4(), 1);
|
|
28797
29096
|
LOGICAL_OPS = new Set(["&", "|"]);
|
|
28798
29097
|
QUALIFIER_BREAKERS = new Set(["if", "in"]);
|
|
28799
29098
|
EXPRESSION_BREAKERS = new Set([
|
|
28800
29099
|
"STATEMENT_TERMINATOR",
|
|
28801
|
-
"COMMENT_LINE",
|
|
28802
29100
|
"LBRACE",
|
|
28803
29101
|
"RBRACE"
|
|
28804
29102
|
]);
|
|
29103
|
+
COMPOUND_LOGICAL_TRIVIA_TYPES = new Set([
|
|
29104
|
+
"WHITESPACE",
|
|
29105
|
+
"CONTINUATION",
|
|
29106
|
+
"COMMENT_BLOCK",
|
|
29107
|
+
"COMMENT_LINE"
|
|
29108
|
+
]);
|
|
28805
29109
|
});
|
|
28806
29110
|
|
|
28807
29111
|
// src/providers/chained-comparison-diagnostics.ts
|
|
@@ -31362,7 +31666,7 @@ function extract_command_name(text) {
|
|
|
31362
31666
|
const text_before_colon = text.substring(0, colon_pos).trim();
|
|
31363
31667
|
const text_after_colon = text.substring(colon_pos + 1).trim();
|
|
31364
31668
|
const words_before = text_before_colon.split(/\s+/);
|
|
31365
|
-
if (words_before.length >= 2 && ["by", "bysort"].includes(words_before[0]
|
|
31669
|
+
if (words_before.length >= 2 && ["by", "bysort"].includes(words_before[0]) && text_after_colon.length > 0) {
|
|
31366
31670
|
working_text = text_after_colon;
|
|
31367
31671
|
}
|
|
31368
31672
|
}
|
|
@@ -31371,8 +31675,7 @@ function extract_command_name(text) {
|
|
|
31371
31675
|
if (my_word === ":") {
|
|
31372
31676
|
continue;
|
|
31373
31677
|
}
|
|
31374
|
-
|
|
31375
|
-
if (!PREFIX_COMMANDS2.includes(lower_word)) {
|
|
31678
|
+
if (!PREFIX_COMMANDS2.includes(my_word)) {
|
|
31376
31679
|
return my_word;
|
|
31377
31680
|
}
|
|
31378
31681
|
}
|
|
@@ -31426,40 +31729,52 @@ function detect_subcommand_context(text_before_cursor, command_db) {
|
|
|
31426
31729
|
return null;
|
|
31427
31730
|
}
|
|
31428
31731
|
const trimmed = text_before_cursor.trim();
|
|
31429
|
-
const
|
|
31430
|
-
if (
|
|
31732
|
+
const the_parts = trimmed.match(/:|[^\s:]+/g) ?? [];
|
|
31733
|
+
if (the_parts.length === 0) {
|
|
31431
31734
|
return null;
|
|
31432
31735
|
}
|
|
31433
|
-
const STANDARD_PREFIXES = [
|
|
31736
|
+
const STANDARD_PREFIXES = [
|
|
31737
|
+
"by",
|
|
31738
|
+
"bysort",
|
|
31739
|
+
"quietly",
|
|
31740
|
+
"qui",
|
|
31741
|
+
"capture",
|
|
31742
|
+
"cap",
|
|
31743
|
+
"noisily",
|
|
31744
|
+
"noi"
|
|
31745
|
+
];
|
|
31746
|
+
const BY_PREFIXES = ["by", "bysort"];
|
|
31434
31747
|
let command_index = 0;
|
|
31435
|
-
while (command_index <
|
|
31748
|
+
while (command_index < the_parts.length && STANDARD_PREFIXES.includes(the_parts[command_index])) {
|
|
31749
|
+
const my_prefix = the_parts[command_index];
|
|
31436
31750
|
command_index++;
|
|
31437
|
-
|
|
31438
|
-
|
|
31439
|
-
|
|
31440
|
-
|
|
31441
|
-
if (words_after_colon.length > 0) {
|
|
31442
|
-
const potential_prefix2 = words_after_colon[0].toLowerCase();
|
|
31443
|
-
if (command_db && command_db.has_subcommands(potential_prefix2)) {
|
|
31444
|
-
const words_after_prefix2 = words_after_colon.length - 1;
|
|
31445
|
-
if (words_after_prefix2 === 0 && text_before_cursor.endsWith(" ")) {
|
|
31446
|
-
return { type: "subcommand", prefix_command: potential_prefix2 };
|
|
31447
|
-
}
|
|
31448
|
-
if (words_after_prefix2 === 1 && !text_before_cursor.endsWith(" ")) {
|
|
31449
|
-
return { type: "subcommand", prefix_command: potential_prefix2 };
|
|
31450
|
-
}
|
|
31751
|
+
if (BY_PREFIXES.includes(my_prefix)) {
|
|
31752
|
+
const varlist_start = command_index;
|
|
31753
|
+
while (command_index < the_parts.length && the_parts[command_index] !== ":") {
|
|
31754
|
+
command_index++;
|
|
31451
31755
|
}
|
|
31756
|
+
if (command_index === varlist_start || command_index >= the_parts.length) {
|
|
31757
|
+
return null;
|
|
31758
|
+
}
|
|
31759
|
+
command_index++;
|
|
31760
|
+
continue;
|
|
31761
|
+
}
|
|
31762
|
+
if (the_parts[command_index] === ":") {
|
|
31763
|
+
command_index++;
|
|
31452
31764
|
}
|
|
31453
|
-
return null;
|
|
31454
31765
|
}
|
|
31455
|
-
if (command_index >=
|
|
31766
|
+
if (command_index >= the_parts.length) {
|
|
31456
31767
|
return null;
|
|
31457
31768
|
}
|
|
31458
|
-
const potential_prefix =
|
|
31769
|
+
const potential_prefix = the_parts[command_index].toLowerCase();
|
|
31459
31770
|
if (!command_db || !command_db.has_subcommands(potential_prefix)) {
|
|
31460
31771
|
return null;
|
|
31461
31772
|
}
|
|
31462
|
-
const
|
|
31773
|
+
const the_remaining_parts = the_parts.slice(command_index + 1);
|
|
31774
|
+
if (the_remaining_parts.includes(":")) {
|
|
31775
|
+
return null;
|
|
31776
|
+
}
|
|
31777
|
+
const words_after_prefix = the_remaining_parts.length;
|
|
31463
31778
|
if (words_after_prefix === 0 && text_before_cursor.endsWith(" ")) {
|
|
31464
31779
|
return { type: "subcommand", prefix_command: potential_prefix };
|
|
31465
31780
|
}
|
|
@@ -31479,7 +31794,7 @@ function is_command_context(text_before_cursor) {
|
|
|
31479
31794
|
const parts = trimmed.split(":");
|
|
31480
31795
|
const before_colon = parts[0].trim();
|
|
31481
31796
|
const after_colon = parts.slice(1).join(":").trim();
|
|
31482
|
-
const first_word = before_colon.split(/\s+/)[0]
|
|
31797
|
+
const first_word = before_colon.split(/\s+/)[0];
|
|
31483
31798
|
if (PREFIX_COMMANDS2.includes(first_word)) {
|
|
31484
31799
|
if (after_colon === "" || !after_colon.includes(" ")) {
|
|
31485
31800
|
return true;
|
|
@@ -31488,8 +31803,8 @@ function is_command_context(text_before_cursor) {
|
|
|
31488
31803
|
}
|
|
31489
31804
|
let all_prefixes = true;
|
|
31490
31805
|
for (const my_word of the_words) {
|
|
31491
|
-
const
|
|
31492
|
-
if (!PREFIX_COMMANDS2.includes(
|
|
31806
|
+
const prefix_word = my_word.replace(/:$/, "");
|
|
31807
|
+
if (!PREFIX_COMMANDS2.includes(prefix_word)) {
|
|
31493
31808
|
all_prefixes = false;
|
|
31494
31809
|
break;
|
|
31495
31810
|
}
|
|
@@ -31498,9 +31813,9 @@ function is_command_context(text_before_cursor) {
|
|
|
31498
31813
|
return true;
|
|
31499
31814
|
}
|
|
31500
31815
|
if (the_words.length === 1 && !text_before_cursor.endsWith(" ")) {
|
|
31501
|
-
const
|
|
31816
|
+
const prefix_fragment = the_words[0];
|
|
31502
31817
|
for (const prefix of PREFIX_COMMANDS2) {
|
|
31503
|
-
if (prefix.startsWith(
|
|
31818
|
+
if (prefix.startsWith(prefix_fragment)) {
|
|
31504
31819
|
return true;
|
|
31505
31820
|
}
|
|
31506
31821
|
}
|
|
@@ -73489,4 +73804,4 @@ export {
|
|
|
73489
73804
|
is_cli_entry_point
|
|
73490
73805
|
};
|
|
73491
73806
|
|
|
73492
|
-
//# debugId=
|
|
73807
|
+
//# debugId=87D5065082C541EF64756E2164756E21
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
151dd39330b47c8992ffedf69fa32703ddca0c1f6f1181339fcf58d5880b242f sight-server.js
|