public SimpleSpace() : base( inp => Prim.Many(Prim.Character(' ')) .Parse(inp) ) { }
public StringParse(IEnumerable <char> str) : base( inp => str.Count() == 0 ? Prim.Return(ImmutableList.Empty <ParserChar>()).Parse(inp) : (from x in Prim.Character(str.First()) from xs in Prim.String(str.Skip(1)) select x.Cons(xs)) .Parse(inp) ) { }
public WhiteSpace() : base( inp => Prim.SkipMany( Prim.Character(' ') | Prim.Character('\t') | Prim.Character('\n') | Prim.Character('\r') ) .Parse(inp) ) { }
public Integer() : base(inp => (from minus in Prim.Try(Prim.Character('-') | Prim.Return(new ParserChar('+'))) from digits in Prim.Many1(Prim.Digit()) let v = DigitsToInt(digits) select minus.Value == '+' ? v : -v) .Parse(inp) ) { }