All files / src/analysis/parser BuiltinValueRules.ts

100% Statements 21/21
100% Branches 0/0
100% Functions 9/9
100% Lines 21/21

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  1x           1x   1x 7x 9x 9x 9x 9x     7x 10x     7x 68x     68x           7x 68x     7x 65x     7x 8x     7x 8x      
import {ASN1CstParser} from '../ASN1CstParser';
import {
  AFFECTATION,
  Identifier,
  NegativeNumberToken,
  NumberToken,
} from '../ASN1Lexer';
import {k} from '../lexer/ASN1Keyword';
 
export function initBuiltinValueRules(this: ASN1CstParser) {
  this.RULE('ValueAssignment', () => {
    this.SUBRULE(this.ValueReference);
    this.SUBRULE(this.Type);
    this.CONSUME(AFFECTATION);
    this.SUBRULE(this.Value);
  });
 
  this.RULE('ValueReference', () => {
    this.CONSUME(Identifier);
  });
 
  this.RULE('Value', () => {
    this.OR([
      {
        ALT: () => {
          this.SUBRULE(this.BuiltinValue);
        },
      },
    ]);
  });
 
  this.RULE('BuiltinValue', () => {
    this.addOrList(['ObjectIdentifierValue', 'IntegerValue', 'BooleanValue']);
  });
 
  this.RULE('IntegerValue', () => {
    this.addOrTokenList([Identifier, NumberToken, NegativeNumberToken]);
  });
 
  this.RULE('BooleanValue', () => {
    this.addOrTokenList([k.TRUE, k.FALSE]);
  });
 
  this.RULE('DefinedValue', () => {
    this.addOrList(['ValueReference']);
  });
}