| 398 | |
| 399 | |
| 400 | CppiaExpr *createStringBuiltin(CppiaExpr *inSrc, CppiaExpr *inThisExpr, String field, Expressions &ioExpressions ) |
| 401 | { |
| 402 | if (field==HX_CSTRING("toString")) |
| 403 | { |
| 404 | if (ioExpressions.size()!=0) throw "Bad arg count"; |
| 405 | return inThisExpr; |
| 406 | } |
| 407 | else if (field==HX_CSTRING("toUpperCase")) |
| 408 | { |
| 409 | if (ioExpressions.size()!=0) throw "Bad arg count"; |
| 410 | return new ToCaseExpr<true>(inSrc,inThisExpr); |
| 411 | } |
| 412 | else if (field==HX_CSTRING("toLowerCase")) |
| 413 | { |
| 414 | if (ioExpressions.size()!=0) throw "Bad arg count"; |
| 415 | return new ToCaseExpr<false>(inSrc,inThisExpr); |
| 416 | } |
| 417 | else if (field==HX_CSTRING("charAt")) |
| 418 | { |
| 419 | if (ioExpressions.size()!=1) throw "Bad arg count"; |
| 420 | return new CharAtExpr<false,false>(inSrc,inThisExpr,ioExpressions[0]); |
| 421 | } |
| 422 | else if (field==HX_CSTRING("cca")) |
| 423 | { |
| 424 | if (ioExpressions.size()!=1) throw "Bad arg count"; |
| 425 | return new CharAtExpr<true,true>(inSrc,inThisExpr,ioExpressions[0]); |
| 426 | } |
| 427 | else if (field==HX_CSTRING("iterator")) |
| 428 | { |
| 429 | if (ioExpressions.size()!=0) throw "Bad arg count"; |
| 430 | return new StringIteratorExpr<false>(inSrc,inThisExpr); |
| 431 | } |
| 432 | else if (field==HX_CSTRING("keyValueIterator")) |
| 433 | { |
| 434 | if (ioExpressions.size()!=0) throw "Bad arg count"; |
| 435 | return new StringIteratorExpr<true>(inSrc,inThisExpr); |
| 436 | } |
| 437 | else if (field==HX_CSTRING("charCodeAt")) |
| 438 | { |
| 439 | if (ioExpressions.size()!=1) throw "Bad arg count"; |
| 440 | return new CharAtExpr<true,false>(inSrc,inThisExpr,ioExpressions[0]); |
| 441 | } |
| 442 | else if (field==HX_CSTRING("split")) |
| 443 | { |
| 444 | if (ioExpressions.size()!=1) throw "Bad arg count"; |
| 445 | return new SplitExpr(inSrc,inThisExpr,ioExpressions[0]); |
| 446 | } |
| 447 | else if (field==HX_CSTRING("indexOf")) |
| 448 | { |
| 449 | if (ioExpressions.size()!=2) throw "Bad arg count"; |
| 450 | return new IndexOfExpr<false>(inSrc,inThisExpr,ioExpressions[0], ioExpressions[1]); |
| 451 | } |
| 452 | else if (field==HX_CSTRING("lastIndexOf")) |
| 453 | { |
| 454 | if (ioExpressions.size()!=2) throw "Bad arg count"; |
| 455 | return new IndexOfExpr<true>(inSrc,inThisExpr,ioExpressions[0], ioExpressions[1]); |
| 456 | } |
| 457 | |