Special case of a SingleParser, but easier to write. Note that `VoidParser.then(VoidParser)` will produce a TupleParser where inner value is `[]`. Same result with `optrep()` and `rep()`

### Hierarchy

- SingleParser<MASALA_VOID_TYPE>
  - VoidParser

## Index

### Methods

- and
- chain
- debug
- drop
- eos
- filter
- flatMap
- map
- match
- occurrence
- opt
- optrep
- or
- parse
- rep
- returns
- then
- val

## Methods

### and

- and<P>(p: P): TupleParser<MASALA_VOID_TYPE>
- and<Y, P>(p: P): TupleParser<MASALA_VOID_TYPE | Y>

- Inherited from IParser.and

  - Defined in masala-parser.d.ts:583

  If all parsers are accepted, the response value will be a Tuple of these values. It's a rare case where a Tuple could contain a Tuple. Warning: still experimental

  #### Type parameters

  - #### P: IParser<MASALA_VOID_TYPE>

  #### Parameters

  - ##### p: P

  #### Returns TupleParser<MASALA_VOID_TYPE>

- Inherited from IParser.and

  - Defined in masala-parser.d.ts:584

  #### Type parameters

  - #### Y

  - #### P: IParser<Y>

  #### Parameters

  - ##### p: P

  #### Returns TupleParser<MASALA_VOID_TYPE | Y>

### chain

- chain<Y, P>(highParser: P): P

- Inherited from IParser.chain

  - Defined in masala-parser.d.ts:628

  Build a new High Leven parser that parses a ParserStream of tokens. Tokens are defined by `this` parser. It's internally used by GenLex which is more easy to work with

  highparser

    high level parser

  #### Type parameters

  - #### Y

  - #### P: IParser<Y>

  #### Parameters

  - ##### highParser: P

  #### Returns P

### debug

- debug(hint: string, showValue?: boolean): this

- Inherited from IParser.debug

  - Defined in masala-parser.d.ts:558

  Will display debug info when the previous parser is accepted.

      // 'found digit' will be displayed only if N.digit() has been accepted
      N.digit().debug('found digit', false);

  #### Parameters

  - ##### hint: string

  - ##### Optional showValue: boolean

  #### Returns this

### drop

- drop(): VoidParser

- Inherited from IParser.drop

  - Defined in masala-parser.d.ts:539

  The parser will return the Neutral element for the Tuple

  #### Returns VoidParser

### eos

- eos(): this

- Inherited from IParser.eos

  - Defined in masala-parser.d.ts:634

  Accept the end of stream. If accepted, it will not change the response

  #### Returns this

### filter

- filter(predicate: function): this

- Inherited from IParser.filter

  - Defined in masala-parser.d.ts:566

  Given an accepted parser and a response value, this parser.filter(predicate) could be rejected depending on the predicate applied on the response value. Filtering a rejected parser will always results in a rejected response.

  #### Parameters

  - ##### predicate: function

    : predicate applied on the response value

    - - (value: MASALA_VOID_TYPE): boolean

      - #### Parameters

        - ##### value: MASALA_VOID_TYPE

        #### Returns boolean

  #### Returns this

### flatMap

- flatMap<Y, P>(builder: parserBuilder<Y, P>): P

- Inherited from IParser.flatMap

  - Defined in masala-parser.d.ts:534

  Create a new parser value knowing the current parsing value

      // Next char must be the double of the previous
        function doubleNumber(param:number){
           return C.string(''+ (param*2) );
        }

       const combinator = N.digit()
           .flatMap(doubleNumber);
       let response = combinator.parse(Streams.ofString('12'));
       assertTrue(response.isAccepted());

  #### Type parameters

  - #### Y

  - #### P: IParser<Y>

  #### Parameters

  - ##### builder: parserBuilder<Y, P>

  #### Returns P

### map

- map<Y>(f: function): SingleParser<Y>

- Inherited from IParser.map

  - Defined in masala-parser.d.ts:515

  Transforms the Response value

      const parser = N.number().map (n => n*2);
      const value = parser.parse(Streams.ofString('1')).value;
      test.equal(value, 2 );

  #### Type parameters

  - #### Y

  #### Parameters

  - ##### f: function

    - - (value: MASALA_VOID_TYPE): Y

      - #### Parameters

        - ##### value: MASALA_VOID_TYPE

        #### Returns Y

  #### Returns SingleParser<Y>

### match

- match(val: MASALA_VOID_TYPE): this

- Inherited from IParser.match

  - Defined in masala-parser.d.ts:619

  Specialized version of filter using `val` equality as predicate

  #### Parameters

  - ##### val: MASALA_VOID_TYPE

    the parser is rejected if it's response value is not `val`

  #### Returns this

### occurrence

- occurrence(n: number): TupleParser<MASALA_VOID_TYPE>

- Inherited from IParser.occurrence

  - Defined in masala-parser.d.ts:613

  Search for next n occurrences. `TupleParser.occurence()` will continue to build one larger Tuple

      let parser = C.char('a').then (C.char('b')).occurrence(3);
      let resp = parser.parse(Streams.ofString('ababab'));
      // ->  Tuple { value: [ 'a', 'b', 'a', 'b', 'a', 'b' ] } }

  #### Parameters

  - ##### n: number

  #### Returns TupleParser<MASALA_VOID_TYPE>

### opt

- opt(): SingleParser<Option<MASALA_VOID_TYPE>>

- Overrides SingleParser.opt

  - Defined in masala-parser.d.ts:437

  #### Returns SingleParser<Option<MASALA_VOID_TYPE>>

### optrep

- optrep(): TupleParser<MASALA_VOID_TYPE>

- Inherited from IParser.optrep

  - Defined in masala-parser.d.ts:601

  Accepted with zero or more occurrences. Will produce a Tuple of zero or more T

  #### Returns TupleParser<MASALA_VOID_TYPE>

### or

- or(other: VoidParser): VoidParser
- or<T, P>(other: P): VoidParser | P

- Overrides SingleParser.or

  - Defined in masala-parser.d.ts:433

  #### Parameters

  - ##### other: VoidParser

  #### Returns VoidParser

- Overrides SingleParser.or

  - Defined in masala-parser.d.ts:434

  #### Type parameters

  - #### T

  - #### P: IParser<T>

  #### Parameters

  - ##### other: P

  #### Returns VoidParser | P

### parse

- parse<D>(stream: Stream<D>, index?: number): Response<MASALA_VOID_TYPE>

- Inherited from IParser.parse

  - Defined in masala-parser.d.ts:481

  Parses a stream of items (usually characters or tokens) and returns a Response

  #### Type parameters

  - #### D

  #### Parameters

  - ##### stream: Stream<D>

  - ##### Optional index: number

    optional, index start in the stream

  #### Returns Response<MASALA_VOID_TYPE>

### rep

- rep(): TupleParser<MASALA_VOID_TYPE>

- Inherited from IParser.rep

  - Defined in masala-parser.d.ts:596

  Accepted with one or more occurrences.Will produce an Tuple of at least one T

  #### Returns TupleParser<MASALA_VOID_TYPE>

### returns

- returns<Y>(value: Y): SingleParser<Y>

- Inherited from IParser.returns

  - Defined in masala-parser.d.ts:545

  If accepted, the parser will return the given value

  #### Type parameters

  - #### Y

  #### Parameters

  - ##### value: Y

  #### Returns SingleParser<Y>

### then

- then(p: VoidParser): TupleParser<MASALA_VOID_TYPE>
- then<Y>(p: TupleParser<Y>): TupleParser<Y>
- then<Y>(p: SingleParser<Y>): TupleParser<Y>
- then<Y>(p: IParser<Y>): TupleParser<Y>

- Overrides SingleParser.then

  - Defined in masala-parser.d.ts:427

  Combine two parsers for reading the stream

      const parser = C.char('a').drop()
        .then(C.char('b').drop());
        const value = parser.parse(Streams.ofString('ab')).value;
        test.ok(value.size() === 0 );

  #### Parameters

  - ##### p: VoidParser

    next parser

  #### Returns TupleParser<MASALA_VOID_TYPE>

- Overrides SingleParser.then

  - Defined in masala-parser.d.ts:428

  #### Type parameters

  - #### Y

  #### Parameters

  - ##### p: TupleParser<Y>

  #### Returns TupleParser<Y>

- Overrides SingleParser.then

  - Defined in masala-parser.d.ts:429

  #### Type parameters

  - #### Y

  #### Parameters

  - ##### p: SingleParser<Y>

  #### Returns TupleParser<Y>

- Overrides SingleParser.then

  - Defined in masala-parser.d.ts:430

  #### Type parameters

  - #### Y

  #### Parameters

  - ##### p: IParser<Y>

  #### Returns TupleParser<Y>

### val

- val(text: string): MASALA_VOID_TYPE

- Inherited from IParser.val

  - Defined in masala-parser.d.ts:488

  Mainly designed for quick debugging or unit tests Parses the text and returns the value, or undefined if parsing has failed.

  #### Parameters

  - ##### text: string

    text to parse

  #### Returns MASALA_VOID_TYPE

Generated using TypeDoc