public void AOneOrMoreRepeated(string input, bool expected) { string pattern = "^a+$"; var target = NFA.OneOrMany(NFA.Character('a')); Test(input, expected, target, pattern); }
public void AnyCharSequenceRepeatedTest(string input, bool expected) { string pattern = "^A.+C$"; var target = NFA.Sequence(NFA.Character('A'), NFA.OneOrMany(NFA.AnyCharacter()), NFA.Character('C')); Test(input, expected, target, pattern); }
public void JustAB(string input, bool expected) { string pattern = "^b$"; var target = NFA.Character('b'); Test(input, expected, target, pattern); }
public void JustAnAWithoutEnforcinfItBeTheEntireString(string input, bool expected) { string pattern = "^a$"; var target = NFA.Character('a'); Test(input, expected, target, pattern); }
public void StartOfStringAssertionMidPatternTest(string input, bool expected) { string pattern = "^(a|^b*|c)$"; var target = NFA.Alternation(NFA.Character('a'), NFA.Sequence(NFA.StartOfStringAssertion(), NFA.ZeroOrMany(NFA.Character('b'))), NFA.Character('c')); Test(input, expected, target, pattern); }
public void StartOfStringAssertionTest(string input, bool expected) { string pattern = "^a$"; var target = NFA.Sequence(NFA.StartOfStringAssertion(), NFA.Character('a')); Test(input, expected, target, pattern); }
public void AnyCharSequenceTest(string input, bool expected) { string pattern = "^a.c$"; var target = NFA.Sequence(NFA.Character('a'), NFA.AnyCharacter(), NFA.Character('c')); Test(input, expected, target, pattern); }
public void OptionalTest(string input, bool expected) { string pattern = "^ab?$"; var target = NFA.Sequence(NFA.Character('a'), NFA.ZeroOrOne(NFA.Character('b'))); Test(input, expected, target, pattern); }
public void SequenceExplicitTest(string input, bool expected) { string pattern = "^foo$"; var target = NFA.Sequence(NFA.Character('f'), NFA.Character('o'), NFA.Character('o')); Test(input, expected, target, pattern); }
public void MultiAlternationNoHelpersTest(string input, bool expected) { string pattern = "^(a|b|c)$"; var target = NFA.Alternation(NFA.Character('a'), NFA.Character('b'), NFA.Character('c')); Test(input, expected, target, pattern); }
public void AlternationAndRepetitionTest(string input, bool expected) { string pattern = "^(a|b*|c)$"; var target = NFA.Alternation(NFA.Character('a'), NFA.Alternation(NFA.ZeroOrMany(NFA.Character('b')), NFA.Character('c'))); Test(input, expected, target, pattern); }
public void StartAndEndOfStringAssertionMidPatternTest(string input, bool expected) { string pattern = "^ab+$"; var target = NFA.Sequence( NFA.StartOfStringAssertion(), NFA.Character('a'), NFA.OneOrMany( NFA.Character('b') ), NFA.EndOfStringAssertion() ); Test(input, expected, target, pattern); }
public void Visit(Primitive target) { stack.Push(NFA.Character(target.character)); }