public MyString() { var hex = new Choices( new Ranges('0', '9'), new Ranges('a', 'f'), new Ranges('A', 'F')); var unicodeCharacters = new Sequance( new Charact('\\'), new Charact('u'), new Sequance( hex, hex, hex, hex)); var escape = new Sequance(new Charact('\\'), new Any("rntfb/\\")); var quotes = new Charact('\u0022'); var char1 = new Ranges('\u0020', '\u0021'); var char2 = new Ranges('\u0023', '\u005B'); var char3 = new Ranges('\u005D', '\uFFFF'); var validChars = new Many( new Choices( char1, char2, char3, unicodeCharacters, escape)); pattern = new Sequance( quotes, validChars, quotes); }
public Numb() { var allDigits = new OneOrMore(new Ranges('0', '9')); var dot = new Charact('.'); var minus = new Charact('-'); var zero = new Charact('0'); var digits = new OneOrMore(new Ranges('1', '9')); var naturalNumbers = new Choices(zero, allDigits); var integerNumbers = new Sequance(new Optionals(minus), naturalNumbers); var fractionalPart = new Sequance( dot, allDigits); var exponentialOption = new Any("eE"); var optionalSign = new Any("+-"); var exponentialPart = new Sequance( exponentialOption, optionalSign, allDigits); pattern = new Sequance( integerNumbers, new Optionals(fractionalPart), new Optionals(exponentialPart)); }