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

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

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 201x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import {seq, Expression, regex as reg} from "../combi";
import {IStatementRunnable} from "../statement_runnable";
 
const TYPED_LITERAL_TYPES = [
  "CHAR", "CLNT", "CUKY", "CURR", "DATN", "DATS", "DEC",
  "DECFLOAT16", "DECFLOAT34",
  "D16N", "D34N", "D16D", "D34D", "D16R", "D34R",
  "FLTP",
  "INT1", "INT2", "INT4", "INT8",
  "LANG", "NUMC", "QUAN", "RAW", "RAWSTRING",
  "SSTRING", "STRING", "TIMN", "TIMS", "UNIT", "UTCLONG",
];
 
export class SQLTypedLiteral extends Expression {
  public getRunnable(): IStatementRunnable {
    const typeName = reg(new RegExp("^(" + TYPED_LITERAL_TYPES.join("|") + ")$", "i"));
    return seq(typeName, reg(/^`.*`$/));
  }
}