HyperDbg Debugger
Loading...
Searching...
No Matches
EvalScripts.StatementGenerator Class Reference

Classes

struct  IDENTIFIER_DEFINITION
 

Static Public Member Functions

static void ResetDepth ()
 
static string GET_CHECK_STATEMENT ()
 
static string S ()
 
static string STATEMENT ()
 
static string CALL_FUNC_STATEMENT ()
 
static string ASSIGN_STATEMENT ()
 
static string IF_STATEMENT (bool AddStatement)
 
static string ELSIF_STATEMENT (bool AddStatement)
 
static string ELSIF_STATEMENTP ()
 
static string ELSE_STATEMENT (bool AddStatement)
 
static string END_OF_IF ()
 
static string WHILE_STATEMENT (bool AddStatement)
 
static string DO_WHILE_STATEMENT (bool AddStatement)
 
static string FOR_STATEMENT (bool AddStatement)
 
static string SIMPLE_ASSIGNMENT ()
 
static string SIMPLE_ASSIGNMENTP ()
 
static string INC_DEC ()
 
static string INC_DECP ()
 
static string INCP ()
 
static string DECP ()
 
static string BOOLEAN_EXPRESSION ()
 
static string EXPRESSION ()
 
static string EXPRESSION (bool ForceToBeValid)
 
static string E0P ()
 
static string E1 ()
 
static string E1P ()
 
static string E2 ()
 
static string E2P ()
 
static string E3 ()
 
static string E3P ()
 
static string E4 ()
 
static string E4P ()
 
static string E5 ()
 
static string E5P ()
 
static string E6 ()
 
static string E6P ()
 
static string E7 ()
 
static string E7P ()
 
static string E8 ()
 
static string E8P ()
 
static string E9 ()
 
static string E9P ()
 
static string E10 ()
 
static string E13 ()
 
static string L_VALUE ()
 
static string NULL ()
 
static string E12 ()
 

Static Public Attributes

const int SizeOfStructOfIdentifiers = 50
 
static List< IDENTIFIER_DEFINITIONIdentifiers = new List<IDENTIFIER_DEFINITION>()
 

Member Function Documentation

◆ ASSIGN_STATEMENT()

static string EvalScripts.StatementGenerator.ASSIGN_STATEMENT ( )
inlinestatic
174 {
175 string Result = string.Empty;
176
177 Depth += 1;
178
179 Result = L_VALUE() + " = " + EXPRESSION() + " " + NULL();
180
181 Depth -= 1;
182
183 return Result;
184 }
static string L_VALUE()
Definition StatementGenerator.cs:934
static string NULL()
Definition StatementGenerator.cs:954
static string EXPRESSION()
Definition StatementGenerator.cs:484

◆ BOOLEAN_EXPRESSION()

static string EvalScripts.StatementGenerator.BOOLEAN_EXPRESSION ( )
inlinestatic
444 {
445 string Result = string.Empty;
446 string Expr = string.Empty;
447 string[] Operators = { " ", " == ", " <= ", " >= ", " <> ", " >< ", " ! ", " ; ", " != ", " = ", " > ", " < ", "((", "(", ")", "))", };
448 var RandomNum = Rand.Next(0, Operators.Length);
449 var RandomNum2 = Rand.Next(3);
450
451 Depth += 1;
452
453 Expr = EXPRESSION();
454
455 if (RandomNum2 == 0)
456 {
457 //
458 // Two sides are equal
459 //
460 Result = Expr + Operators[RandomNum] + Expr + SIMPLE_ASSIGNMENTP();
461 Depth -= 1;
462
463 return Result;
464 }
465 else
466 {
467 //
468 // Two sides are not equal
469 //
470 string Expr2 = EXPRESSION(true);
471
472 if (Expr2.Length >= 150)
473 {
474 Expr2 = EXPRESSION(true);
475 }
476
477 Result = Expr + Operators[RandomNum] + Expr2 + SIMPLE_ASSIGNMENTP();
478 Depth -= 1;
479
480 return Result;
481 }
482 }
static string SIMPLE_ASSIGNMENTP()
Definition StatementGenerator.cs:395

◆ CALL_FUNC_STATEMENT()

static string EvalScripts.StatementGenerator.CALL_FUNC_STATEMENT ( )
inlinestatic
167 {
168 string Result = string.Empty;
169
170 return Result;
171 }

◆ DECP()

static string EvalScripts.StatementGenerator.DECP ( )
inlinestatic
437 {
438 string Result = string.Empty;
439
440 return Result;
441 }

◆ DO_WHILE_STATEMENT()

static string EvalScripts.StatementGenerator.DO_WHILE_STATEMENT ( bool AddStatement)
inlinestatic
316 {
317 string Result = string.Empty;
318
319 Depth += 1;
320
321 if (AddStatement)
322 {
323 Result = " do { tmp_counter = tmp_counter + 1; if (tmp_counter >= 0x1000) { break; } " + S() + "} while ( " + BOOLEAN_EXPRESSION() + ") ;";
324 }
325 else
326 {
327 Result = " do { tmp_counter = tmp_counter + 1; if (tmp_counter >= 0x1000) { break; } } while ( " + BOOLEAN_EXPRESSION() + ") ;";
328 }
329
330 Depth -= 1;
331
332 return Result;
333 }
static string BOOLEAN_EXPRESSION()
Definition StatementGenerator.cs:443
static string S()
Definition StatementGenerator.cs:43

◆ E0P()

static string EvalScripts.StatementGenerator.E0P ( )
inlinestatic
521 {
522 var RandomNum = Rand.Next(2);
523 string Result = string.Empty;
524
525 Depth += 1;
526
527 if (Depth >= MAX_DEPTH)
528 {
529 RandomNum = 1;
530 }
531
532 if (RandomNum == 0)
533 {
534 Result = " | " + E1() + E0P();
535 Depth -= 1;
536
537 return Result;
538 }
539 else
540 {
541 Result = "";
542 Depth -= 1;
543
544 return Result;
545 }
546 }
static string E1()
Definition StatementGenerator.cs:548
static string E0P()
Definition StatementGenerator.cs:520

◆ E1()

static string EvalScripts.StatementGenerator.E1 ( )
inlinestatic
549 {
550 string Result = string.Empty;
551
552 Depth += 1;
553
554 Result = E2() + E1P();
555
556 Depth -= 1;
557
558 return Result;
559 }
static string E1P()
Definition StatementGenerator.cs:561
static string E2()
Definition StatementGenerator.cs:589

◆ E10()

static string EvalScripts.StatementGenerator.E10 ( )
inlinestatic
914 {
915 string Result = string.Empty;
916
917 Depth += 1;
918
919 Result = E12();
920
921 Depth -= 1;
922
923 return Result;
924 }
static string E12()
Definition StatementGenerator.cs:962

◆ E12()

static string EvalScripts.StatementGenerator.E12 ( )
inlinestatic
963 {
964 string Result = string.Empty;
965 var RandomNum = Rand.Next(0, 8 + Identifiers.Count);
966 var RandomNum2 = 0;
967
968 Depth += 1;
969
970 switch (RandomNum)
971 {
972 case 0:
973
974 Result = "(" + EXPRESSION() + ")";
975 Depth -= 1;
976
977 return Result;
978
979 case 1:
980
981 RandomNum2 = Rand.Next(0, 20);
982 Result = "0x" + RandomNum2.ToString("X"); // hex
983 Depth -= 1;
984
985 return Result;
986
987 case 2:
988
989 RandomNum2 = Rand.Next(0, 20);
990 Result = "0n" + RandomNum2.ToString(); // decimal
991 Depth -= 1;
992
993 return Result;
994
995 case 3:
996
997 RandomNum2 = Rand.Next(0, 20);
998
999 //
1000 // C# don't support prefix for octals
1001 //
1002 // Result = "0t" + Convert.ToString(RandomNum2, 8); // octal
1003 Result = Convert.ToString(RandomNum2, 8); // octal
1004 Depth -= 1;
1005
1006 return Result;
1007
1008 case 4:
1009
1010 RandomNum2 = Rand.Next(0, 20);
1011 Result = "0y" + Convert.ToString(RandomNum2, 2); // binary
1012 Depth -= 1;
1013
1014 return Result;
1015
1016 case 5:
1017
1018 Result = "-" + E12() + E13();
1019 Depth -= 1;
1020
1021 return Result;
1022
1023 case 6:
1024
1025 Result = "+" + E12() + E13();
1026 Depth -= 1;
1027
1028 return Result;
1029
1030 case 7:
1031
1032 Result = "~" + E12() + E13();
1033 Depth -= 1;
1034
1035 return Result;
1036
1037 default:
1038
1039 RandomNum2 = Rand.Next(0, Identifiers.Count);
1040 Result = Identifiers[RandomNum2].IdentifierName; // register, pesudo-registers, ids whatever
1041 Depth -= 1;
1042
1043 return Result;
1044 }
1045 }
static List< IDENTIFIER_DEFINITION > Identifiers
Definition StatementGenerator.cs:27
static string E13()
Definition StatementGenerator.cs:926

◆ E13()

static string EvalScripts.StatementGenerator.E13 ( )
inlinestatic
927 {
928 string Result = string.Empty;
929
930 Result = "";
931
932 return Result;
933 }

◆ E1P()

static string EvalScripts.StatementGenerator.E1P ( )
inlinestatic
562 {
563 var RandomNum = Rand.Next(2);
564 string Result = string.Empty;
565
566 Depth += 1;
567
568 if (Depth >= MAX_DEPTH)
569 {
570 RandomNum = 1;
571 }
572
573 if (RandomNum == 0)
574 {
575 Result = " ^ " + E2() + E1P();
576 Depth -= 1;
577
578 return Result;
579 }
580 else
581 {
582 Result = "";
583 Depth -= 1;
584
585 return Result;
586 }
587 }

◆ E2()

static string EvalScripts.StatementGenerator.E2 ( )
inlinestatic
590 {
591 string Result = string.Empty;
592
593 Depth += 1;
594
595 Result = E3() + E2P();
596
597 Depth -= 1;
598
599 return Result;
600 }
static string E3()
Definition StatementGenerator.cs:629
static string E2P()
Definition StatementGenerator.cs:602

◆ E2P()

static string EvalScripts.StatementGenerator.E2P ( )
inlinestatic
603 {
604 string Result = string.Empty;
605
606 var RandomNum = Rand.Next(2);
607
608 Depth += 1;
609
610 if (Depth >= MAX_DEPTH)
611 {
612 RandomNum = 1;
613 }
614
615 if (RandomNum == 0)
616 {
617 Result = " & " + E3() + E2P();
618 Depth -= 1;
619 return Result;
620 }
621 else
622 {
623 Result = "";
624 Depth -= 1;
625 return Result;
626 }
627 }

◆ E3()

static string EvalScripts.StatementGenerator.E3 ( )
inlinestatic
630 {
631 string Result = string.Empty;
632
633 Depth += 1;
634
635 Result = E4() + E3P();
636
637 Depth -= 1;
638
639 return Result;
640 }
static string E4()
Definition StatementGenerator.cs:670
static string E3P()
Definition StatementGenerator.cs:642

◆ E3P()

static string EvalScripts.StatementGenerator.E3P ( )
inlinestatic
643 {
644 string Result = string.Empty;
645
646 var RandomNum = Rand.Next(2);
647
648 Depth += 1;
649 if (Depth >= MAX_DEPTH)
650 {
651 RandomNum = 1;
652 }
653
654 if (RandomNum == 0)
655 {
656 Result = " >> " + E4() + E3P();
657 Depth -= 1;
658
659 return Result;
660 }
661 else
662 {
663 Result = "";
664 Depth -= 1;
665
666 return Result;
667 }
668 }

◆ E4()

static string EvalScripts.StatementGenerator.E4 ( )
inlinestatic
671 {
672 string Result = string.Empty;
673
674 Depth += 1;
675
676 Result = E5() + E4P();
677
678 Depth -= 1;
679
680 return Result;
681 }
static string E4P()
Definition StatementGenerator.cs:683
static string E5()
Definition StatementGenerator.cs:709

◆ E4P()

static string EvalScripts.StatementGenerator.E4P ( )
inlinestatic
684 {
685 string Result = string.Empty;
686 var RandomNum = Rand.Next(2);
687
688 Depth += 1;
689
690 if (Depth >= MAX_DEPTH)
691 {
692 RandomNum = 1;
693 }
694
695 if (RandomNum == 0)
696 {
697 Result = " << " + E5() + E4P();
698 Depth -= 1;
699 return Result;
700 }
701 else
702 {
703 Result = "";
704 Depth -= 1;
705 return Result;
706 }
707 }

◆ E5()

static string EvalScripts.StatementGenerator.E5 ( )
inlinestatic
710 {
711 string Result = string.Empty;
712
713 Depth += 1;
714
715 Result = E6() + E5P();
716
717 Depth -= 1;
718
719 return Result;
720 }
static string E6()
Definition StatementGenerator.cs:751
static string E5P()
Definition StatementGenerator.cs:722

◆ E5P()

static string EvalScripts.StatementGenerator.E5P ( )
inlinestatic
723 {
724 string Result = string.Empty;
725
726 var RandomNum = Rand.Next(2);
727
728 Depth += 1;
729
730 if (Depth >= MAX_DEPTH)
731 {
732 RandomNum = 1;
733 }
734
735 if (RandomNum == 0)
736 {
737 Result = " + " + E6() + E5P();
738 Depth -= 1;
739
740 return Result;
741 }
742 else
743 {
744 Result = "";
745 Depth -= 1;
746
747 return Result;
748 }
749 }

◆ E6()

static string EvalScripts.StatementGenerator.E6 ( )
inlinestatic
752 {
753 string Result = string.Empty;
754
755 Depth += 1;
756
757 Result = E7() + E6P();
758
759 Depth -= 1;
760
761 return Result;
762 }
static string E6P()
Definition StatementGenerator.cs:764
static string E7()
Definition StatementGenerator.cs:790

◆ E6P()

static string EvalScripts.StatementGenerator.E6P ( )
inlinestatic
765 {
766 string Result = string.Empty;
767 var RandomNum = Rand.Next(2);
768
769 Depth += 1;
770
771 if (Depth >= MAX_DEPTH)
772 {
773 RandomNum = 1;
774 }
775
776 if (RandomNum == 0)
777 {
778 Result = " - " + E7() + E6P();
779 Depth -= 1;
780 return Result;
781 }
782 else
783 {
784 Result = "";
785 Depth -= 1;
786 return Result;
787 }
788 }

◆ E7()

static string EvalScripts.StatementGenerator.E7 ( )
inlinestatic
791 {
792 string Result = string.Empty;
793
794 Depth += 1;
795
796 Result = E8() + E7P();
797
798 Depth -= 1;
799
800 return Result;
801 }
static string E8()
Definition StatementGenerator.cs:831
static string E7P()
Definition StatementGenerator.cs:803

◆ E7P()

static string EvalScripts.StatementGenerator.E7P ( )
inlinestatic
804 {
805 string Result = string.Empty;
806 var RandomNum = Rand.Next(2);
807
808 Depth += 1;
809
810 if (Depth >= MAX_DEPTH)
811 {
812 RandomNum = 1;
813 }
814
815 if (RandomNum == 0)
816 {
817 Result = " * " + E8() + E7P();
818 Depth -= 1;
819
820 return Result;
821 }
822 else
823 {
824 Result = "";
825 Depth -= 1;
826
827 return Result;
828 }
829 }

◆ E8()

static string EvalScripts.StatementGenerator.E8 ( )
inlinestatic
832 {
833 string Result = string.Empty;
834
835 Depth += 1;
836
837 Result = E9() + E8P();
838
839 Depth -= 1;
840
841 return Result;
842 }
static string E8P()
Definition StatementGenerator.cs:844
static string E9()
Definition StatementGenerator.cs:872

◆ E8P()

static string EvalScripts.StatementGenerator.E8P ( )
inlinestatic
845 {
846 string Result = string.Empty;
847 var RandomNum = Rand.Next(2);
848
849 Depth += 1;
850
851 if (Depth >= MAX_DEPTH)
852 {
853 RandomNum = 1;
854 }
855
856 if (RandomNum == 0)
857 {
858 Result = " / " + E9() + E8P();
859 Depth -= 1;
860
861 return Result;
862 }
863 else
864 {
865 Result = "";
866 Depth -= 1;
867
868 return Result;
869 }
870 }

◆ E9()

static string EvalScripts.StatementGenerator.E9 ( )
inlinestatic
873 {
874 string Result = string.Empty;
875
876 Depth += 1;
877
878 Result = E10() + E9P();
879
880 Depth -= 1;
881
882 return Result;
883 }
static string E10()
Definition StatementGenerator.cs:913
static string E9P()
Definition StatementGenerator.cs:885

◆ E9P()

static string EvalScripts.StatementGenerator.E9P ( )
inlinestatic
886 {
887 string Result = string.Empty;
888 var RandomNum = Rand.Next(2);
889
890 Depth += 1;
891
892 if (Depth >= MAX_DEPTH)
893 {
894 RandomNum = 1;
895 }
896
897 if (RandomNum == 0)
898 {
899 Result = " % " + E10() + E9P();
900 Depth -= 1;
901
902 return Result;
903 }
904 else
905 {
906 Result = "";
907 Depth -= 1;
908
909 return Result;
910 }
911 }

◆ ELSE_STATEMENT()

static string EvalScripts.StatementGenerator.ELSE_STATEMENT ( bool AddStatement)
inlinestatic
252 {
253 var RandomNum = Rand.Next(2);
254 string Result = string.Empty;
255
256 Depth += 1;
257
258 if (Depth >= MAX_DEPTH)
259 {
260 RandomNum = 1;
261 }
262
263 if (RandomNum == 0)
264 {
265 if (AddStatement)
266 {
267 Result = " else {" + GET_CHECK_STATEMENT() + S() + "}";
268 }
269 else
270 {
271 Result = " else {" + GET_CHECK_STATEMENT() + "}";
272 }
273
274 Depth -= 1;
275
276 return Result;
277 }
278 else
279 {
280 Result = "";
281 Depth -= 1;
282
283 return Result;
284 }
285
286 }
static string GET_CHECK_STATEMENT()
Definition StatementGenerator.cs:34

◆ ELSIF_STATEMENT()

static string EvalScripts.StatementGenerator.ELSIF_STATEMENT ( bool AddStatement)
inlinestatic
207 {
208 var RandomNum = Rand.Next(2);
209 string Result = string.Empty;
210
211 Depth += 1;
212
213 if (Depth >= MAX_DEPTH)
214 {
215 RandomNum = 1;
216 }
217
218 if (RandomNum == 0)
219 {
220
221 if (AddStatement)
222 {
223 Result = " elsif (" + BOOLEAN_EXPRESSION() + ") {" + GET_CHECK_STATEMENT() + S() + "}" + ELSIF_STATEMENT(AddStatement);
224 }
225 else
226 {
227 Result = " elsif (" + BOOLEAN_EXPRESSION() + ") {" + GET_CHECK_STATEMENT() + "}" + ELSIF_STATEMENT(AddStatement);
228 }
229 Depth -= 1;
230
231 return Result;
232
233 }
234 else
235 {
236
237 Result = ELSIF_STATEMENTP();
238 Depth -= 1;
239
240 return Result;
241 }
242 }
static string ELSIF_STATEMENT(bool AddStatement)
Definition StatementGenerator.cs:206
static string ELSIF_STATEMENTP()
Definition StatementGenerator.cs:244

◆ ELSIF_STATEMENTP()

static string EvalScripts.StatementGenerator.ELSIF_STATEMENTP ( )
inlinestatic
245 {
246 string Result = string.Empty;
247
248 return Result;
249 }

◆ END_OF_IF()

static string EvalScripts.StatementGenerator.END_OF_IF ( )
inlinestatic
289 {
290 string Result = string.Empty;
291
292 return Result;
293 }

◆ EXPRESSION() [1/2]

static string EvalScripts.StatementGenerator.EXPRESSION ( )
inlinestatic
485 {
486 string Result = string.Empty;
487
488 Depth += 1;
489
490 Result = E1() + E0P();
491
492 Depth -= 1;
493
494 return Result;
495 }

◆ EXPRESSION() [2/2]

static string EvalScripts.StatementGenerator.EXPRESSION ( bool ForceToBeValid)
inlinestatic
498 {
499 string Result = string.Empty;
500
501 if (!ForceToBeValid)
502 {
503 return EXPRESSION();
504 }
505 else
506 {
507 while (true)
508 {
509 string Expr = EXPRESSION();
510
511 if (HighLevelScriptGen.EvaluateExpression(Expr, ref Result))
512 {
513 return Expr;
514 }
515 }
516
517 }
518 }

◆ FOR_STATEMENT()

static string EvalScripts.StatementGenerator.FOR_STATEMENT ( bool AddStatement)
inlinestatic
336 {
337 string Result = string.Empty;
338
339 Depth += 1;
340
341 if (!AddStatement)
342 {
343 Result = " for (" + SIMPLE_ASSIGNMENT() + "; " + BOOLEAN_EXPRESSION() + ";" + INC_DEC() + ") { tmp_counter = tmp_counter + 1; if (tmp_counter >= 0x1000) { break; } " + "}";
344 }
345 else
346 {
347 Result = " for (" + SIMPLE_ASSIGNMENT() + "; " + BOOLEAN_EXPRESSION() + ";" + INC_DEC() + ") { tmp_counter = tmp_counter + 1; if (tmp_counter >= 0x1000) { break; } " + S() + "}";
348 }
349
350 Depth -= 1;
351
352 return Result;
353 }
static string INC_DEC()
Definition StatementGenerator.cs:402
static string SIMPLE_ASSIGNMENT()
Definition StatementGenerator.cs:355

◆ GET_CHECK_STATEMENT()

static string EvalScripts.StatementGenerator.GET_CHECK_STATEMENT ( )
inlinestatic
35 {
36 var token = Rand.Next(10000);
37 string Result = string.Empty;
38
39 Result = " test_statement(" + "0x" + token.ToString("X") + "); ";
40 return Result;
41 }

◆ IF_STATEMENT()

static string EvalScripts.StatementGenerator.IF_STATEMENT ( bool AddStatement)
inlinestatic
187 {
188 string Result = string.Empty;
189
190 Depth += 1;
191
192 if (AddStatement)
193 {
194 Result = " if (" + BOOLEAN_EXPRESSION() + ") {" + GET_CHECK_STATEMENT() + S() + "}" + ELSIF_STATEMENT(AddStatement) + ELSE_STATEMENT(AddStatement) + END_OF_IF();
195 }
196 else
197 {
198 Result = " if (" + BOOLEAN_EXPRESSION() + ") {" + GET_CHECK_STATEMENT() + "}" + ELSIF_STATEMENT(AddStatement) + ELSE_STATEMENT(AddStatement) + END_OF_IF();
199 }
200
201 Depth -= 1;
202
203 return Result;
204 }
static string END_OF_IF()
Definition StatementGenerator.cs:288
static string ELSE_STATEMENT(bool AddStatement)
Definition StatementGenerator.cs:251

◆ INC_DEC()

static string EvalScripts.StatementGenerator.INC_DEC ( )
inlinestatic
403 {
404 string Result = string.Empty;
405 var RandomNum = Rand.Next(4);
406
407 Depth += 1;
408
409 Result = L_VALUE() + INC_DECP();
410
411 Depth -= 1;
412
413 return Result;
414 }
static string INC_DECP()
Definition StatementGenerator.cs:416

◆ INC_DECP()

static string EvalScripts.StatementGenerator.INC_DECP ( )
inlinestatic
417 {
418 string Result = string.Empty;
419
420 Depth += 1;
421
422 Result = "--" + DECP();
423
424 Depth -= 1;
425
426 return Result;
427 }
static string DECP()
Definition StatementGenerator.cs:436

◆ INCP()

static string EvalScripts.StatementGenerator.INCP ( )
inlinestatic
430 {
431 string Result = string.Empty;
432
433 return Result;
434 }

◆ L_VALUE()

static string EvalScripts.StatementGenerator.L_VALUE ( )
inlinestatic
935 {
936 string Result = string.Empty;
937
938 var RandomNum = Rand.Next(2);
939
940 if (RandomNum == 0)
941 {
942 Result = "val"; // id
943 return Result;
944 }
945 else if (RandomNum == 1)
946 {
947 Result = "@rax"; // register
948 return Result;
949 }
950
951 return string.Empty;
952 }

◆ NULL()

static string EvalScripts.StatementGenerator.NULL ( )
inlinestatic
955 {
956 string Result = string.Empty;
957
958 return Result;
959
960 }

◆ ResetDepth()

static void EvalScripts.StatementGenerator.ResetDepth ( )
inlinestatic
30 {
31 Depth = 0;
32 }

◆ S()

static string EvalScripts.StatementGenerator.S ( )
inlinestatic
44 {
45
46 var RandomNum = Rand.Next(2);
47 string Result = string.Empty;
48
49 Depth += 1;
50
51 if (Depth >= MAX_DEPTH)
52 {
53 RandomNum = 1;
54 }
55
56 if (RandomNum == 0)
57 {
58 Result = STATEMENT() + " " + S();
59 Depth -= 1;
60
61 return Result;
62 }
63 else
64 {
65 Result = "";
66 Depth -= 1;
67
68 return Result;
69 }
70
71 }
static string STATEMENT()
Definition StatementGenerator.cs:73

◆ SIMPLE_ASSIGNMENT()

static string EvalScripts.StatementGenerator.SIMPLE_ASSIGNMENT ( )
inlinestatic
356 {
357 var RandomNum = Rand.Next(5);
358 string Result = string.Empty;
359
360 Depth += 1;
361
362 if (Depth >= MAX_DEPTH)
363 {
364 RandomNum = 1;
365 }
366
367 switch (RandomNum)
368 {
369 case 0:
370
371 Result = L_VALUE() + " = " + EXPRESSION() + SIMPLE_ASSIGNMENTP();
372 Depth -= 1;
373
374 return Result;
375
376 case 1:
377
378 Result = "";
379 Depth -= 1;
380
381 return Result;
382
383 default:
384
385 Result = "val = 10";
386 Depth -= 1;
387
388 return Result;
389
390 }
391
392
393 }

◆ SIMPLE_ASSIGNMENTP()

static string EvalScripts.StatementGenerator.SIMPLE_ASSIGNMENTP ( )
inlinestatic
396 {
397 string Result = string.Empty;
398
399 return Result;
400 }

◆ STATEMENT()

static string EvalScripts.StatementGenerator.STATEMENT ( )
inlinestatic
74 {
75 var RandomNum = Rand.Next(11);
76 string Result = string.Empty;
77
78 Depth += 1;
79
80 switch (RandomNum)
81 {
82 case 0:
83
84 Result = IF_STATEMENT(false);
85 Depth -= 1;
86
87 return Result;
88
89 case 1:
90
91 Result = WHILE_STATEMENT(false);
92 Depth -= 1;
93
94 return Result;
95
96 case 2:
97
98 Result = DO_WHILE_STATEMENT(false);
99 Depth -= 1;
100
101 return Result;
102
103 case 3:
104
105 Result = FOR_STATEMENT(false);
106 Depth -= 1;
107
108 return Result;
109
110 case 4:
111
112 Result = ASSIGN_STATEMENT() + ";";
113 Depth -= 1;
114
115 return Result;
116
117 case 5:
118
119 Result = CALL_FUNC_STATEMENT() + ";";
120 Depth -= 1;
121
122 return Result;
123
124 case 6:
125
126 Result = " break;";
127 Depth -= 1;
128
129 return Result;
130
131 case 7:
132
133 Result = " /* This is a comment */";
134 Depth -= 1;
135
136 return Result;
137
138 case 8:
139
140 Result = " // /* This is a comment ";
141 Depth -= 1;
142
143 return Result;
144
145 case 9:
146
147 Result = " /* This is a not closed comment";
148 Depth -= 1;
149
150 return Result;
151
152 case 10:
153
154 Result = " This is a not opened comment */";
155 Depth -= 1;
156
157 return Result;
158
159 default:
160
161 return string.Empty;
162
163 }
164 }
static string CALL_FUNC_STATEMENT()
Definition StatementGenerator.cs:166
static string FOR_STATEMENT(bool AddStatement)
Definition StatementGenerator.cs:335
static string WHILE_STATEMENT(bool AddStatement)
Definition StatementGenerator.cs:295
static string ASSIGN_STATEMENT()
Definition StatementGenerator.cs:173
static string DO_WHILE_STATEMENT(bool AddStatement)
Definition StatementGenerator.cs:315
static string IF_STATEMENT(bool AddStatement)
Definition StatementGenerator.cs:186

◆ WHILE_STATEMENT()

static string EvalScripts.StatementGenerator.WHILE_STATEMENT ( bool AddStatement)
inlinestatic
296 {
297 string Result = string.Empty;
298
299 Depth += 1;
300
301 if (AddStatement)
302 {
303 Result = " while (" + BOOLEAN_EXPRESSION() + ") { tmp_counter = tmp_counter + 1; if (tmp_counter >= 0x1000) { break; } " + S() + " }";
304 }
305 else
306 {
307 Result = " while (" + BOOLEAN_EXPRESSION() + ") { tmp_counter = tmp_counter + 1; if (tmp_counter >= 0x1000) { break; } }";
308 }
309
310 Depth -= 1;
311
312 return Result;
313 }

Member Data Documentation

◆ Identifiers

List<IDENTIFIER_DEFINITION> EvalScripts.StatementGenerator.Identifiers = new List<IDENTIFIER_DEFINITION>()
static

◆ SizeOfStructOfIdentifiers

const int EvalScripts.StatementGenerator.SizeOfStructOfIdentifiers = 50
static

The documentation for this class was generated from the following file: