All files / src/abap/2_statements/expressions user_command.ts

100% Statements 13/13
100% Branches 1/1
100% Functions 1/1
100% Lines 13/13

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 141x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 1x  
import {Expression, altPrio, seq, optPrio, tok, regex as reg} from "../combi";
import {DashW, PlusW} from "../../1_lexer/tokens";
import {Constant, TextElement} from ".";
import {IStatementRunnable} from "../statement_runnable";
 
// function code after USER-COMMAND, taken literally by the ABAP compiler, max 20 characters,
// eg. "=ente", "cli-", "cli+", "text-013", "/0"
export class UserCommand extends Expression {
  public getRunnable(): IStatementRunnable {
    const code = seq(reg(/^[\w\?\/=%\$&\*#!~]{1,20}$/), optPrio(altPrio(tok(DashW), tok(PlusW))));
    return altPrio(TextElement, Constant, code);
  }
}