Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 1x 1x 1x 315x 3x 3x 312x 312x 315x 315x 209x 209x 209x 209x 315x 15x 315x 315x 88x 315x 315x 1x 1x 74x 2x 2x 72x 74x 6x 6x 66x 74x 66x 66x 74x 1x 1x 155x 4x 4x 151x 155x 151x 155x 93x 93x 58x 155x 27x 27x 31x 31x 31x 31x 31x 31x 31x 155x 23x 23x 8x 8x 155x | import ALParser from '../parser/ALParser.js';
export function isParagraphStatement(node) {
if (!node || !node.ruleIndex) {
return false;
}
switch (node.ruleIndex) {
case ALParser.RULE_statementWithSeparator:
case ALParser.RULE_statement: {
if (!node.children || !node.children.length || node.children.length === 0) {
return false;
}
return isParagraphStatement(node.children[0]);
}
case ALParser.RULE_caseStatement:
return true;
default:
return false;
}
}
export function isCompoundStatement(node) {
if (node.ruleIndex === ALParser.RULE_compoundBlock) {
return true;
}
if (!node.children || node.children.length === 0) {
return false;
}
if (node.ruleIndex === ALParser.RULE_statementList && node.children.length > 1) {
return false;
}
return isCompoundStatement(node.children[0]);
}
export function shouldAddBlankLineAfter(node) {
if (node.ruleIndex === ALParser.RULE_compoundBlock) {
return true;
}
if (!node.children || node.children.length === 0) {
return false;
}
if (node.children.length === 1) {
return shouldAddBlankLineAfter(node.children[0]);
}
if (node.ruleIndex === ALParser.RULE_statementWithSeparator) {
return shouldAddBlankLineAfter(node.children[0]);
}
if (
![ALParser.RULE_forStatement,
ALParser.RULE_forEachStatement,
ALParser.RULE_whileStatement,
ALParser.RULE_ifStatement,
ALParser.RULE_ifElseStatement].includes(
node.ruleIndex)) {
return false;
}
return shouldAddBlankLineAfter(node.children[node.children.length - 1]);
}
|