Lines Matching refs:parse
13 $(LREF parse)
115 return new ConvException(text("Can't parse string: ", msg), fn, ln);
1810 !isExactSomeString!T && is(typeof(parse!T(value))))
1819 return parse!T(value);
1825 isIntegral!T && is(typeof(parse!T(value, radix))))
1834 return parse!T(value, radix);
1955 The $(D parse) family of functions works quite like the $(D to)
1978 to `parse` and do not require lvalues.
1980 Target parse(Target, Source)(ref Source source)
2025 bool b = parse!bool(s);
2042 assert(parse!bool(s) == true);
2044 assert(parse!bool(s) == false);
2046 assert(parse!bool(s) == true);
2048 assert(parse!bool(s) == false);
2050 assert(parse!bool(s) == true);
2052 assert(parse!bool(s) == false);
2058 assertThrown!ConvException(parse!bool(s));
2077 Target parse(Target, Source)(ref Source s)
2084 auto v = .parse!(Select!(Target.min < 0, int, uint))(s);
2185 auto a = parse!int(s);
2188 // parse only accepts lvalues
2189 static assert(!__traits(compiles, parse!int("123")));
2197 auto a = parse!uint(test);
2199 assert(test == " \t 76.14"); // parse bumps string
2202 auto b = parse!double(test);
2330 // parse!SomeUnsigned cannot parse head sign.
2409 assertCTFEable!({ string s = "1234abc"; assert(parse! int(s) == 1234 && s == "abc"); });
2410 assertCTFEable!({ string s = "-1234abc"; assert(parse! int(s) == -1234 && s == "abc"); });
2411 assertCTFEable!({ string s = "1234abc"; assert(parse!uint(s) == 1234 && s == "abc"); });
2436 assert(parse!int(input) == 777);
2440 Target parse(Target, Source)(ref Source source, uint radix)
2453 return parse!Target(source);
2455 enforce!ConvException(!source.empty, "s must not be empty in integral parse");
2506 string s; // parse doesn't accept rvalues
2509 assert(parse!int(s = "0", i) == 0);
2510 assert(parse!int(s = "1", i) == 1);
2511 assert(parse!byte(s = "10", i) == i);
2514 assert(parse!int(s = "0011001101101", 2) == 0b0011001101101);
2515 assert(parse!int(s = "765", 8) == octal!765);
2516 assert(parse!int(s = "fCDe", 16) == 0xfcde);
2519 assert(parse!int(s = "-42", 10) == -42);
2521 assert(parse!ubyte(s = "ff", 16) == 0xFF);
2528 auto u = parse!uint(r, 16);
2537 assertThrown!ConvOverflowException(s.parse!ubyte(16));
2543 assert(parse!uint(str) == 0);
2560 Target parse(Target, Source)(ref Source s)
2595 assert(parse!EnumType(str) == EnumType.a);
2626 assert(parse!A(s) == A.member111 && s == "1");
2643 Target parse(Target, Source)(ref Source source)
2927 assert(parse!double(str).approxEqual(123.456));
3025 auto x = parse!real(s);
3033 x = parse!real(s);
3041 x = parse!real(s);
3049 x = parse!real(s);
3057 x = parse!real(s);
3065 x = parse!real(s);
3073 x = parse!real(s);
3078 assertThrown!ConvException(x = parse!real(s));
3083 x = parse!real(s);
3131 ld = parse!real(s2);
3153 ld = parse!real(s2);
3167 auto x = parse!double(s);
3192 parse!double(s);
3194 assertThrown!ConvException(parse!double(s));
3210 Target parse(Target, Source)(ref Source s)
3224 // Special case: okay so parse a Char off a Char[]
3241 assert(parse!Char(s) == 'a');
3249 Target parse(Target, Source)(ref Source s)
3264 char first = parse!char(s);
3271 Tests for to!bool and parse!bool
3282 assert(parse!bool(t) == true);
3286 assert(parse!bool(f) == false);
3290 assertThrown!ConvException(parse!bool(m));
3294 auto b = parse!(const(bool))(s);
3312 Target parse(Target, Source)(ref Source s)
3334 assert(parse!NullType(s1) is null);
3338 assert(parse!NullType(s2) is null);
3342 assertThrown!ConvException(parse!NullType(m));
3346 assert(parse!(const NullType)(s) is null);
3349 //Used internally by parse Array/AA, to remove ascii whites
3380 * s = The string to parse
3388 Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar comma = ',')
3425 auto a1 = parse!(string[])(s1);
3429 auto a2 = parse!(string[])(s2);
3438 assert(s0.parse!(int[]) == [1,2]);
3439 assert(s1.parse!(int[]) == [1,2]);
3440 assert(s2.parse!(int[]) == [1,2]);
3444 assert(s3.parse!(string[]) == ["a","b"]);
3445 assert(s4.parse!(string[]) == ["a","b"]);
3450 assertThrown!ConvException(parse!(string[])(s5));
3451 assertThrown!ConvException(parse!(int[])(s6));
3488 assertThrown!ConvException(parse!(int[])(ss));
3490 int[] arr = parse!(int[])(s);
3517 assert(s2 == parse!(string[])(s1));
3522 Target parse(Target, Source)(ref Source s, dchar lbracket = '[', dchar rbracket = ']', dchar comma = ',')
3576 auto sa1 = parse!(int[4])(s1);
3580 auto sa2 = parse!(int[][3])(s2);
3584 assertThrown!ConvException(parse!(int[4])(s3));
3587 assertThrown!ConvException(parse!(int[4])(s4));
3596 * s = the string to parse
3605 Target parse(Target, Source)(ref Source s, dchar lbracket = '[',
3647 auto aa1 = parse!(int[int])(s1);
3651 auto aa2 = parse!(int[string])(s2);
3655 auto aa3 = parse!(int[][string])(s3);
3668 assertThrown!ConvException(parse!(int[int])(ss));
3670 int[int] aa = parse!(int[int])(s);
3795 // parse array of chars
3799 return parse!Target(s);
3857 return parse!Target(s);
3939 $(LREF parse) for parsing octal strings at runtime.