Skip to content

Commit

Permalink
#88: better typescript support with rep() and optrep()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-zozol committed May 16, 2019
1 parent eb7398c commit 74d1d4d
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions masala-parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,16 @@ export interface TupleParser<T> extends IParser<Tuple<T>> {
*/
last(): SingleParser<T>;

/**
* Accepted with one or more occurrences.Will produce an Tuple of at least one T
*/
rep(): TupleParser<T>;

/**
* Accepted with zero or more occurrences. Will produce a Tuple of zero or more T
*/
optrep(): TupleParser<T>;


}

Expand Down Expand Up @@ -435,6 +445,16 @@ export interface VoidParser extends SingleParser<MASALA_VOID_TYPE> {


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

/**
* Accepted with one or more occurrences.Will produce an Tuple of at least one T
*/
rep(): TupleParser<MASALA_VOID_TYPE>;

/**
* Accepted with zero or more occurrences. Will produce a Tuple of zero or more T
*/
optrep(): TupleParser<MASALA_VOID_TYPE>;
}

export interface SingleParser<T> extends IParser<T> {
Expand Down Expand Up @@ -462,6 +482,16 @@ export interface SingleParser<T> extends IParser<T> {


opt(): SingleParser<Option<T>>

/**
* Accepted with one or more occurrences.Will produce an Tuple of at least one T
*/
rep(): TupleParser<T>;

/**
* Accepted with zero or more occurrences. Will produce a Tuple of zero or more T
*/
optrep(): TupleParser<T>;
}


Expand Down Expand Up @@ -593,12 +623,12 @@ export interface IParser<T> {
/**
* Accepted with one or more occurrences.Will produce an Tuple of at least one T
*/
rep(): TupleParser<T>;
rep(): TupleParser<any>;

/**
* Accepted with zero or more occurrences. Will produce a Tuple of zero or more T
*/
optrep(): TupleParser<T>;
optrep(): TupleParser<any>;


/**
Expand Down

0 comments on commit 74d1d4d

Please sign in to comment.