Skip to content
Discussion options

You must be logged in to vote

You can write a validation rule that ensures this based on the CST:

checkWhitespace(ifStatement: IfStatement, acceptor: ValidationAcceptor): void {
  const text = (getDocument(ifStatement).parseResult.value.$cstNode as RootCstNode).fullText;
  const thenKeyword = GrammarUtils.findNodeForKeyword(ifStatement.$cstNode, 'THEN');
  if (thenKeyword) {
    const index = thenKeyword.offset;
    const previousChar = text.charAt(index - 1);
    if (previousChar !== ' ') {
      acceptor('error', ...);
    }
  }
}

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@zrwsmd
Comment options

@msujew
Comment options

Answer selected by zrwsmd
@zrwsmd
Comment options

@msujew
Comment options

@zrwsmd
Comment options

@msujew
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants