-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
265 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { StateOp } from './stateOps'; | ||
export declare function concatMultipleStates(...states: StateOp[]): StateOp; | ||
export declare function unionMultipleStates({ states, accepted }: { | ||
states: StateOp[]; | ||
accepted?: boolean; | ||
}): StateOp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var stateOps_1 = require("./stateOps"); | ||
function concatMultipleStates() { | ||
var states = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
states[_i] = arguments[_i]; | ||
} | ||
if (states.length === 0) { | ||
throw new Error('Argument must be at least one state'); | ||
} | ||
if (states.length === 1) { | ||
return states[0]; | ||
} | ||
return states.reduce(function (stateA, stateB) { | ||
return new stateOps_1.ConcatState(stateA, stateB); | ||
}); | ||
} | ||
exports.concatMultipleStates = concatMultipleStates; | ||
function unionMultipleStates(_a) { | ||
var states = _a.states, _b = _a.accepted, accepted = _b === void 0 ? false : _b; | ||
if (states.length === 0) { | ||
throw new Error('Argument must be at least one state'); | ||
} | ||
if (states.length === 1) { | ||
return states[0]; | ||
} | ||
return states.reduce(function (stateA, stateB, currentIndex) { | ||
return new stateOps_1.UnionState(stateA, stateB, (currentIndex === states.length - 1) && accepted); | ||
}); | ||
} | ||
exports.unionMultipleStates = unionMultipleStates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export declare class Epsilon { | ||
} | ||
declare const epsilon: Epsilon; | ||
export default epsilon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Epsilon = /** @class */ (function () { | ||
function Epsilon() { | ||
} | ||
return Epsilon; | ||
}()); | ||
exports.Epsilon = Epsilon; | ||
var epsilon = new Epsilon(); | ||
exports.default = epsilon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { State, InputType } from './state'; | ||
export declare class StateOp { | ||
protected start: State | null; | ||
protected end: State | null; | ||
constructor(); | ||
getStartState(): State | null; | ||
getEndState(): State | null; | ||
setNext(input: InputType, state: StateOp): void; | ||
} | ||
export declare class SingleInputState extends StateOp { | ||
constructor(input: InputType, accepted?: boolean); | ||
} | ||
export declare class ConcatState extends StateOp { | ||
private a; | ||
private b; | ||
constructor(a: StateOp, b: StateOp); | ||
} | ||
export declare class UnionState extends StateOp { | ||
private a; | ||
private b; | ||
constructor(a: StateOp, b: StateOp, accepted?: boolean); | ||
} | ||
export declare class ClosureState extends StateOp { | ||
private a; | ||
constructor(a: StateOp, accepted?: boolean); | ||
} |
Oops, something went wrong.