All files / src/abap/nodes token_node.ts

90.9% Statements 40/44
100% Branches 7/7
77.77% Functions 7/9
90.9% Lines 40/44

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 441x 1x 1x 1x 1x 1x 1x 1x 1x 4914641x 4914641x 1x 1x     1x 1x     1x 1x 177x 177x 1x 1x 24502x 24502x 1x 1x 5025800x 5025800x 1x 1x 68222x 68222x 1x 1x 1213387x 1213387x 1x 1x 443917x 443917x 1x
import {AbstractToken} from "../1_lexer/tokens/abstract_token";
import {INode} from "./_inode";
 
const EMPTY_CHILDREN: readonly INode[] = Object.freeze([]);
 
export class TokenNode implements INode {
  private readonly token: AbstractToken;
 
  public constructor(token: AbstractToken) {
    this.token = token;
  }
 
  public addChild(_n: INode): void {
    throw new Error("TokenNode, Method not implemented.");
  }
 
  public setChildren(_children: INode[]): void {
    throw new Error("TokenNode, Method not implemented.");
  }
 
  public getChildren(): readonly INode[] {
    return EMPTY_CHILDREN;
  }
 
  public concatTokens(): string {
    return this.token.getStr();
  }
 
  public get(): AbstractToken {
    return this.token;
  }
 
  public countTokens(): number {
    return 1;
  }
 
  public getFirstToken(): AbstractToken {
    return this.token;
  }
 
  public getLastToken(): AbstractToken {
    return this.token;
  }
}