programming language
Revisión | eabbfd5f6f361ff1e0cbe14435ddbf4bf2964603 (tree) |
---|---|
Tiempo | 2023-04-17 22:52:04 |
Autor | dhrname <dhrname@joes...> |
Commiter | dhrname |
New the SyntaxRule class
@@ -1121,8 +1121,47 @@ namespace jstr | ||
1121 | 1121 | } |
1122 | 1122 | }; |
1123 | 1123 | |
1124 | + /*Syntax クラス | |
1125 | + * BNF配列を安全に扱うためのクラス*/ | |
1126 | + class SyntaxRule | |
1127 | + { | |
1128 | + private: | |
1129 | + root* tree; | |
1130 | + | |
1131 | + public: | |
1132 | + SyntaxRule(){ | |
1133 | + tree = new root(); | |
1134 | + } | |
1135 | + virtual ~SyntaxRule(){ | |
1136 | + delete tree; | |
1137 | + tree = nullptr; | |
1138 | + } | |
1139 | + | |
1140 | + /*isRangeBNF メンバ関数 | |
1141 | + * xとyとzがBNF三次元配列の範囲内であることをチェックする関数*/ | |
1142 | + virtual bool isRangeBNF(int32_t x, int32_t y, int32_t z) | |
1143 | + { | |
1144 | + if ( ( (0 < y) && (BNF_SELECTION_LENGTH > (y+1)) ) | |
1145 | + && ( (0 < x) && (BNF_NONTERMINAL_LENGTH > x) ) | |
1146 | + && ( (0 < z) && (BNF_CONCATNATION_LENGTH > z) ) ) | |
1147 | + { | |
1148 | + return true; | |
1149 | + } | |
1150 | + else | |
1151 | + { | |
1152 | + return false; | |
1153 | + } | |
1154 | + } | |
1155 | + | |
1156 | + virtual Node* getBNFTree() | |
1157 | + { | |
1158 | + return tree; | |
1159 | + } | |
1160 | + }; | |
1161 | + | |
1124 | 1162 | } |
1125 | - | |
1163 | + | |
1164 | + | |
1126 | 1165 | class SemanticNetwork: public BaseNode |
1127 | 1166 | { |
1128 | 1167 | private: |
@@ -206,7 +206,7 @@ DIGIT [1-9][0-9]* | ||
206 | 206 | "cla" return jstr::parser::terminal::CLASS ; |
207 | 207 | "new" return jstr::parser::terminal::NEW ; |
208 | 208 | "this" return jstr::parser::terminal::THIS ; |
209 | -"delete" return jstr::parser::terminal::DELETE ; | |
209 | +"del" return jstr::parser::terminal::DELETE ; | |
210 | 210 | |
211 | 211 | "case" return jstr::parser::terminal::CASE ; |
212 | 212 | "type" return jstr::parser::terminal::TYPE ; |
@@ -394,7 +394,7 @@ struct yy_trans_info | ||
394 | 394 | flex_int32_t yy_verify; |
395 | 395 | flex_int32_t yy_nxt; |
396 | 396 | }; |
397 | -static const flex_int16_t yy_accept[219] = | |
397 | +static const flex_int16_t yy_accept[216] = | |
398 | 398 | { 0, |
399 | 399 | 0, 0, 96, 95, 93, 93, 79, 95, 95, 78, |
400 | 400 | 95, 83, 84, 76, 74, 35, 75, 82, 77, 95, |
@@ -410,16 +410,16 @@ static const flex_int16_t yy_accept[219] = | ||
410 | 410 | 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, |
411 | 411 | 88, 88, 88, 88, 88, 64, 94, 94, 91, 34, |
412 | 412 | 0, 62, 63, 15, 88, 9, 10, 11, 12, 88, |
413 | - 88, 22, 29, 88, 88, 88, 33, 28, 14, 88, | |
413 | + 88, 22, 29, 88, 25, 88, 33, 28, 14, 88, | |
414 | 414 | 88, 88, 88, 88, 13, 42, 1, 2, 3, 4, |
415 | 415 | 88, 17, 88, 88, 23, 16, 88, 88, 88, 88, |
416 | 416 | 5, 6, 7, 8, 18, 88, 88, 0, 88, 31, |
417 | - 26, 88, 88, 88, 88, 45, 44, 88, 88, 88, | |
418 | - 88, 55, 88, 88, 88, 24, 27, 88, 88, 90, | |
419 | - 47, 20, 88, 88, 88, 49, 88, 88, 88, 48, | |
417 | + 26, 88, 88, 88, 45, 44, 88, 88, 88, 88, | |
418 | + 55, 88, 88, 88, 24, 27, 88, 88, 90, 47, | |
419 | + 20, 88, 88, 49, 88, 88, 88, 48, 50, 88, | |
420 | 420 | |
421 | - 50, 88, 88, 40, 90, 88, 25, 32, 87, 86, | |
422 | - 54, 30, 88, 88, 88, 46, 21, 0 | |
421 | + 88, 40, 90, 88, 32, 87, 86, 54, 30, 88, | |
422 | + 88, 88, 46, 21, 0 | |
423 | 423 | } ; |
424 | 424 | |
425 | 425 | static const YY_CHAR yy_ec[256] = |
@@ -464,65 +464,65 @@ static const YY_CHAR yy_meta[60] = | ||
464 | 464 | 5, 5, 5, 5, 5, 5, 1, 1, 1 |
465 | 465 | } ; |
466 | 466 | |
467 | -static const flex_int16_t yy_base[225] = | |
467 | +static const flex_int16_t yy_base[222] = | |
468 | 468 | { 0, |
469 | - 0, 58, 286, 287, 287, 282, 255, 277, 279, 252, | |
470 | - 271, 287, 287, 45, 49, 287, 48, 263, 249, 261, | |
471 | - 260, 287, 287, 37, 246, 38, 287, 0, 22, 62, | |
472 | - 32, 38, 28, 71, 240, 50, 235, 237, 222, 232, | |
473 | - 48, 81, 222, 228, 287, 209, 287, 92, 101, 287, | |
474 | - 287, 287, 260, 259, 261, 287, 287, 287, 287, 287, | |
475 | - 287, 287, 287, 287, 247, 75, 287, 101, 246, 245, | |
476 | - 231, 287, 287, 287, 230, 0, 214, 219, 231, 231, | |
477 | - 234, 231, 67, 218, 90, 84, 209, 85, 88, 201, | |
478 | - 95, 202, 199, 222, 222, 225, 222, 0, 195, 0, | |
479 | - | |
480 | - 197, 200, 194, 185, 196, 196, 186, 194, 186, 208, | |
481 | - 208, 211, 208, 71, 188, 287, 138, 139, 140, 287, | |
482 | - 119, 287, 287, 0, 194, 0, 0, 0, 0, 183, | |
483 | - 188, 0, 0, 97, 187, 190, 0, 0, 0, 184, | |
484 | - 184, 174, 182, 181, 0, 0, 0, 0, 0, 0, | |
485 | - 171, 0, 171, 182, 0, 0, 169, 162, 163, 174, | |
486 | - 0, 0, 0, 0, 0, 177, 166, 130, 166, 0, | |
487 | - 0, 157, 166, 155, 169, 0, 0, 155, 155, 166, | |
488 | - 152, 0, 163, 148, 153, 0, 0, 146, 158, 138, | |
489 | - 0, 0, 149, 156, 153, 0, 141, 140, 139, 0, | |
490 | - | |
491 | - 0, 135, 98, 0, 146, 81, 0, 0, 0, 0, | |
492 | - 0, 0, 70, 63, 38, 0, 0, 287, 171, 176, | |
493 | - 179, 181, 183, 184 | |
469 | + 0, 58, 283, 284, 284, 279, 252, 274, 276, 249, | |
470 | + 268, 284, 284, 45, 49, 284, 48, 260, 246, 258, | |
471 | + 257, 284, 284, 37, 243, 38, 284, 0, 22, 62, | |
472 | + 32, 38, 28, 71, 237, 50, 232, 234, 219, 229, | |
473 | + 48, 81, 219, 225, 284, 206, 284, 92, 101, 284, | |
474 | + 284, 284, 257, 256, 258, 284, 284, 284, 284, 284, | |
475 | + 284, 284, 284, 284, 244, 75, 284, 101, 243, 242, | |
476 | + 228, 284, 284, 284, 227, 0, 211, 216, 228, 228, | |
477 | + 231, 228, 67, 215, 90, 84, 206, 85, 88, 198, | |
478 | + 95, 199, 196, 219, 219, 222, 219, 0, 192, 0, | |
479 | + | |
480 | + 194, 197, 191, 182, 193, 193, 183, 191, 183, 205, | |
481 | + 205, 208, 205, 71, 185, 284, 138, 139, 140, 284, | |
482 | + 119, 284, 284, 0, 191, 0, 0, 0, 0, 180, | |
483 | + 185, 0, 0, 97, 0, 188, 0, 0, 0, 182, | |
484 | + 182, 172, 180, 179, 0, 0, 0, 0, 0, 0, | |
485 | + 169, 0, 169, 180, 0, 0, 167, 160, 161, 172, | |
486 | + 0, 0, 0, 0, 0, 175, 164, 130, 164, 0, | |
487 | + 0, 155, 164, 168, 0, 0, 154, 154, 165, 151, | |
488 | + 0, 162, 147, 152, 0, 0, 145, 157, 138, 0, | |
489 | + 0, 148, 153, 0, 141, 140, 139, 0, 0, 135, | |
490 | + | |
491 | + 98, 0, 146, 81, 0, 0, 0, 0, 0, 70, | |
492 | + 63, 38, 0, 0, 284, 171, 176, 179, 181, 183, | |
493 | + 184 | |
494 | 494 | } ; |
495 | 495 | |
496 | -static const flex_int16_t yy_def[225] = | |
496 | +static const flex_int16_t yy_def[222] = | |
497 | 497 | { 0, |
498 | - 218, 1, 218, 218, 218, 218, 218, 219, 220, 218, | |
499 | - 218, 218, 218, 218, 218, 218, 218, 221, 218, 222, | |
500 | - 223, 218, 218, 218, 218, 218, 218, 224, 224, 224, | |
501 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
502 | - 224, 224, 224, 224, 218, 218, 218, 218, 219, 218, | |
503 | - 218, 218, 219, 219, 220, 218, 218, 218, 218, 218, | |
504 | - 218, 218, 218, 218, 218, 221, 218, 218, 222, 223, | |
505 | - 218, 218, 218, 218, 218, 224, 224, 224, 224, 224, | |
506 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
507 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
508 | - | |
509 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
510 | - 224, 224, 224, 224, 224, 218, 218, 219, 219, 218, | |
511 | - 218, 218, 218, 224, 224, 224, 224, 224, 224, 224, | |
512 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
513 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
514 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
515 | - 224, 224, 224, 224, 224, 224, 224, 218, 224, 224, | |
516 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
517 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 218, | |
518 | - 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, | |
519 | - | |
520 | - 224, 224, 224, 224, 218, 224, 224, 224, 224, 224, | |
521 | - 224, 224, 224, 224, 224, 224, 224, 0, 218, 218, | |
522 | - 218, 218, 218, 218 | |
498 | + 215, 1, 215, 215, 215, 215, 215, 216, 217, 215, | |
499 | + 215, 215, 215, 215, 215, 215, 215, 218, 215, 219, | |
500 | + 220, 215, 215, 215, 215, 215, 215, 221, 221, 221, | |
501 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
502 | + 221, 221, 221, 221, 215, 215, 215, 215, 216, 215, | |
503 | + 215, 215, 216, 216, 217, 215, 215, 215, 215, 215, | |
504 | + 215, 215, 215, 215, 215, 218, 215, 215, 219, 220, | |
505 | + 215, 215, 215, 215, 215, 221, 221, 221, 221, 221, | |
506 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
507 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
508 | + | |
509 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
510 | + 221, 221, 221, 221, 221, 215, 215, 216, 216, 215, | |
511 | + 215, 215, 215, 221, 221, 221, 221, 221, 221, 221, | |
512 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
513 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
514 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
515 | + 221, 221, 221, 221, 221, 221, 221, 215, 221, 221, | |
516 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
517 | + 221, 221, 221, 221, 221, 221, 221, 221, 215, 221, | |
518 | + 221, 221, 221, 221, 221, 221, 221, 221, 221, 221, | |
519 | + | |
520 | + 221, 221, 215, 221, 221, 221, 221, 221, 221, 221, | |
521 | + 221, 221, 221, 221, 0, 215, 215, 215, 215, 215, | |
522 | + 215 | |
523 | 523 | } ; |
524 | 524 | |
525 | -static const flex_int16_t yy_nxt[347] = | |
525 | +static const flex_int16_t yy_nxt[344] = | |
526 | 526 | { 0, |
527 | 527 | 4, 4, 5, 6, 7, 8, 9, 10, 11, 12, |
528 | 528 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, |
@@ -531,40 +531,40 @@ static const flex_int16_t yy_nxt[347] = | ||
531 | 531 | 34, 28, 28, 35, 36, 37, 38, 39, 40, 28, |
532 | 532 | 41, 42, 43, 44, 28, 28, 45, 46, 47, 48, |
533 | 533 | 59, 61, 63, 49, 71, 72, 74, 75, 77, 86, |
534 | - 78, 92, 87, 60, 93, 217, 64, 62, 88, 79, | |
534 | + 78, 92, 87, 60, 93, 214, 64, 62, 88, 79, | |
535 | 535 | 80, 89, 81, 102, 50, 82, 90, 108, 94, 95, |
536 | - 218, 96, 91, 117, 97, 83, 103, 117, 110, 111, | |
536 | + 215, 96, 91, 117, 97, 83, 103, 117, 110, 111, | |
537 | 537 | |
538 | - 216, 112, 118, 109, 113, 84, 119, 121, 85, 98, | |
539 | - 130, 165, 121, 215, 166, 99, 131, 100, 66, 66, | |
538 | + 213, 112, 118, 109, 113, 84, 119, 121, 85, 98, | |
539 | + 130, 165, 121, 212, 166, 99, 131, 100, 66, 66, | |
540 | 540 | 66, 66, 66, 66, 66, 66, 133, 135, 140, 138, |
541 | - 143, 168, 214, 168, 136, 134, 139, 141, 213, 117, | |
542 | - 118, 118, 144, 117, 119, 119, 172, 173, 190, 190, | |
543 | - 190, 190, 190, 190, 190, 205, 205, 205, 205, 205, | |
544 | - 205, 205, 205, 205, 205, 205, 205, 205, 205, 205, | |
545 | - 205, 53, 212, 53, 53, 53, 55, 55, 55, 55, | |
546 | - 55, 66, 66, 69, 69, 70, 70, 76, 76, 211, | |
547 | - 210, 209, 208, 207, 206, 204, 203, 202, 201, 200, | |
548 | - | |
549 | - 199, 198, 197, 196, 195, 194, 193, 192, 191, 189, | |
550 | - 188, 187, 186, 185, 184, 183, 182, 181, 180, 179, | |
551 | - 178, 177, 176, 175, 174, 171, 170, 169, 167, 164, | |
552 | - 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, | |
553 | - 153, 152, 151, 150, 149, 148, 147, 146, 145, 142, | |
554 | - 137, 132, 129, 128, 127, 126, 125, 124, 123, 122, | |
555 | - 68, 68, 120, 56, 54, 54, 116, 115, 114, 107, | |
556 | - 106, 105, 104, 101, 73, 68, 68, 67, 65, 58, | |
557 | - 57, 56, 54, 52, 51, 218, 3, 218, 218, 218, | |
558 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
559 | - | |
560 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
561 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
562 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
563 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
564 | - 218, 218, 218, 218, 218, 218 | |
541 | + 143, 168, 211, 168, 136, 134, 139, 141, 210, 117, | |
542 | + 118, 118, 144, 117, 119, 119, 172, 173, 189, 189, | |
543 | + 189, 189, 189, 189, 189, 203, 203, 203, 203, 203, | |
544 | + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, | |
545 | + 203, 53, 209, 53, 53, 53, 55, 55, 55, 55, | |
546 | + 55, 66, 66, 69, 69, 70, 70, 76, 76, 208, | |
547 | + 207, 206, 205, 204, 202, 201, 200, 199, 198, 197, | |
548 | + | |
549 | + 196, 195, 194, 193, 192, 191, 190, 188, 187, 186, | |
550 | + 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, | |
551 | + 175, 174, 171, 170, 169, 167, 164, 163, 162, 161, | |
552 | + 160, 159, 158, 157, 156, 155, 154, 153, 152, 151, | |
553 | + 150, 149, 148, 147, 146, 145, 142, 137, 132, 129, | |
554 | + 128, 127, 126, 125, 124, 123, 122, 68, 68, 120, | |
555 | + 56, 54, 54, 116, 115, 114, 107, 106, 105, 104, | |
556 | + 101, 73, 68, 68, 67, 65, 58, 57, 56, 54, | |
557 | + 52, 51, 215, 3, 215, 215, 215, 215, 215, 215, | |
558 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
559 | + | |
560 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
561 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
562 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
563 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
564 | + 215, 215, 215 | |
565 | 565 | } ; |
566 | 566 | |
567 | -static const flex_int16_t yy_chk[347] = | |
567 | +static const flex_int16_t yy_chk[344] = | |
568 | 568 | { 0, |
569 | 569 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
570 | 570 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
@@ -573,37 +573,37 @@ static const flex_int16_t yy_chk[347] = | ||
573 | 573 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
574 | 574 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, |
575 | 575 | 14, 15, 17, 2, 24, 24, 26, 26, 29, 31, |
576 | - 29, 33, 31, 14, 33, 215, 17, 15, 31, 30, | |
576 | + 29, 33, 31, 14, 33, 212, 17, 15, 31, 30, | |
577 | 577 | 30, 32, 30, 36, 2, 30, 32, 41, 34, 34, |
578 | 578 | 66, 34, 32, 48, 34, 30, 36, 48, 42, 42, |
579 | 579 | |
580 | - 214, 42, 49, 41, 42, 30, 49, 66, 30, 34, | |
581 | - 83, 114, 66, 213, 114, 34, 83, 34, 68, 68, | |
580 | + 211, 42, 49, 41, 42, 30, 49, 66, 30, 34, | |
581 | + 83, 114, 66, 210, 114, 34, 83, 34, 68, 68, | |
582 | 582 | 68, 68, 68, 68, 68, 68, 85, 86, 89, 88, |
583 | - 91, 121, 206, 121, 86, 85, 88, 89, 203, 117, | |
583 | + 91, 121, 204, 121, 86, 85, 88, 89, 201, 117, | |
584 | 584 | 118, 119, 91, 117, 118, 119, 134, 134, 168, 168, |
585 | - 168, 168, 168, 168, 168, 190, 190, 190, 190, 190, | |
586 | - 190, 190, 190, 205, 205, 205, 205, 205, 205, 205, | |
587 | - 205, 219, 202, 219, 219, 219, 220, 220, 220, 220, | |
588 | - 220, 221, 221, 222, 222, 223, 223, 224, 224, 199, | |
589 | - 198, 197, 195, 194, 193, 189, 188, 185, 184, 183, | |
590 | - | |
591 | - 181, 180, 179, 178, 175, 174, 173, 172, 169, 167, | |
592 | - 166, 160, 159, 158, 157, 154, 153, 151, 144, 143, | |
593 | - 142, 141, 140, 136, 135, 131, 130, 125, 115, 113, | |
594 | - 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, | |
595 | - 102, 101, 99, 97, 96, 95, 94, 93, 92, 90, | |
596 | - 87, 84, 82, 81, 80, 79, 78, 77, 75, 71, | |
597 | - 70, 69, 65, 55, 54, 53, 46, 44, 43, 40, | |
598 | - 39, 38, 37, 35, 25, 21, 20, 19, 18, 11, | |
599 | - 10, 9, 8, 7, 6, 3, 218, 218, 218, 218, | |
600 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
601 | - | |
602 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
603 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
604 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
605 | - 218, 218, 218, 218, 218, 218, 218, 218, 218, 218, | |
606 | - 218, 218, 218, 218, 218, 218 | |
585 | + 168, 168, 168, 168, 168, 189, 189, 189, 189, 189, | |
586 | + 189, 189, 189, 203, 203, 203, 203, 203, 203, 203, | |
587 | + 203, 216, 200, 216, 216, 216, 217, 217, 217, 217, | |
588 | + 217, 218, 218, 219, 219, 220, 220, 221, 221, 197, | |
589 | + 196, 195, 193, 192, 188, 187, 184, 183, 182, 180, | |
590 | + | |
591 | + 179, 178, 177, 174, 173, 172, 169, 167, 166, 160, | |
592 | + 159, 158, 157, 154, 153, 151, 144, 143, 142, 141, | |
593 | + 140, 136, 131, 130, 125, 115, 113, 112, 111, 110, | |
594 | + 109, 108, 107, 106, 105, 104, 103, 102, 101, 99, | |
595 | + 97, 96, 95, 94, 93, 92, 90, 87, 84, 82, | |
596 | + 81, 80, 79, 78, 77, 75, 71, 70, 69, 65, | |
597 | + 55, 54, 53, 46, 44, 43, 40, 39, 38, 37, | |
598 | + 35, 25, 21, 20, 19, 18, 11, 10, 9, 8, | |
599 | + 7, 6, 3, 215, 215, 215, 215, 215, 215, 215, | |
600 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
601 | + | |
602 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
603 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
604 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
605 | + 215, 215, 215, 215, 215, 215, 215, 215, 215, 215, | |
606 | + 215, 215, 215 | |
607 | 607 | } ; |
608 | 608 | |
609 | 609 | static const flex_int16_t yy_rule_linenum[95] = |
@@ -1031,13 +1031,13 @@ yy_match: | ||
1031 | 1031 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1032 | 1032 | { |
1033 | 1033 | yy_current_state = (int) yy_def[yy_current_state]; |
1034 | - if ( yy_current_state >= 219 ) | |
1034 | + if ( yy_current_state >= 216 ) | |
1035 | 1035 | yy_c = yy_meta[yy_c]; |
1036 | 1036 | } |
1037 | 1037 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1038 | 1038 | ++yy_cp; |
1039 | 1039 | } |
1040 | - while ( yy_current_state != 218 ); | |
1040 | + while ( yy_current_state != 215 ); | |
1041 | 1041 | yy_cp = (yy_last_accepting_cpos); |
1042 | 1042 | yy_current_state = (yy_last_accepting_state); |
1043 | 1043 |
@@ -1995,7 +1995,7 @@ int yyFlexLexer::yy_get_next_buffer() | ||
1995 | 1995 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1996 | 1996 | { |
1997 | 1997 | yy_current_state = (int) yy_def[yy_current_state]; |
1998 | - if ( yy_current_state >= 219 ) | |
1998 | + if ( yy_current_state >= 216 ) | |
1999 | 1999 | yy_c = yy_meta[yy_c]; |
2000 | 2000 | } |
2001 | 2001 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
@@ -2028,11 +2028,11 @@ int yyFlexLexer::yy_get_next_buffer() | ||
2028 | 2028 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2029 | 2029 | { |
2030 | 2030 | yy_current_state = (int) yy_def[yy_current_state]; |
2031 | - if ( yy_current_state >= 219 ) | |
2031 | + if ( yy_current_state >= 216 ) | |
2032 | 2032 | yy_c = yy_meta[yy_c]; |
2033 | 2033 | } |
2034 | 2034 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2035 | - yy_is_jam = (yy_current_state == 218); | |
2035 | + yy_is_jam = (yy_current_state == 215); | |
2036 | 2036 | |
2037 | 2037 | return yy_is_jam ? 0 : yy_current_state; |
2038 | 2038 | } |
@@ -396,6 +396,19 @@ int main(int argc, char **argv) | ||
396 | 396 | EXPECT(snet->getReference(), snet2); |
397 | 397 | delete snet; |
398 | 398 | delete snet2; |
399 | + snet = nullptr; | |
400 | + snet2 = nullptr; | |
401 | + | |
402 | + jstr::parser::SyntaxRule* sru = new jstr::parser::SyntaxRule(); | |
403 | + EXPECT(sru->isRangeBNF(0, 0, 0), false); | |
404 | + EXPECT(sru->isRangeBNF(1, 1, 1), true); | |
405 | + EXPECT(sru->isRangeBNF(1, 0, 0), false); | |
406 | + EXPECT(sru->isRangeBNF(1, BNF_SELECTION_LENGTH-1, 1), false); | |
407 | + EXPECT(sru->isRangeBNF(BNF_NONTERMINAL_LENGTH, 1, 1), false); | |
408 | + EXPECT(sru->isRangeBNF(1, 1, BNF_CONCATNATION_LENGTH), false); | |
409 | + delete sru; | |
410 | + sru = nullptr; | |
411 | + | |
399 | 412 | jstr::Phrase* phr = new jstr::Phrase(1); |
400 | 413 | EXPECT(phr->nameSpace, ""); |
401 | 414 | phr->setSemanticValue("wpe"); |
@@ -561,8 +574,6 @@ int main(int argc, char **argv) | ||
561 | 574 | jstr::RealNumberTypeValue* real64val = new jstr::RealNumberTypeValue(64); |
562 | 575 | EXPECT(real64val->timeIndex, 64); |
563 | 576 | delete real64val; |
564 | - snet = nullptr; | |
565 | - snet2 = nullptr; | |
566 | 577 | phr = nullptr; |
567 | 578 | metaphr = nullptr; |
568 | 579 | arrowphr = nullptr; |
@@ -82,21 +82,6 @@ bool Tester::isSuccess() | ||
82 | 82 | return success; |
83 | 83 | } |
84 | 84 | |
85 | -/*getAbstractSyntaxTree メンバ関数 | |
86 | -* 抽象構文木の根を返す*/ | |
87 | -root* AbstractSyntaxTree::getAbstractSyntaxTree() | |
88 | -{ | |
89 | - return abstractSyntaxTreeRoot; | |
90 | -} | |
91 | - | |
92 | -/*getCurrentNode 関数 | |
93 | -* 抽象構文木の現在ノードを返す | |
94 | -* nestメンバ関数により現在ノードは更新される*/ | |
95 | -Node* AbstractSyntaxTree::getCurrentNode() | |
96 | -{ | |
97 | - return ast; | |
98 | -} | |
99 | - | |
100 | 85 | int IndentInterpreter::getCurrentIndent() |
101 | 86 | { |
102 | 87 | return indentLength; |
@@ -192,6 +177,22 @@ int64_t IndentInterpreter::nest(Node* nod) | ||
192 | 177 | using namespace jstr::parser::terminal; |
193 | 178 | using namespace jstr::parser::nonterminal; |
194 | 179 | |
180 | + | |
181 | +/*getAbstractSyntaxTree メンバ関数 | |
182 | +* 抽象構文木の根を返す*/ | |
183 | +root* AbstractSyntaxTree::getAbstractSyntaxTree() | |
184 | +{ | |
185 | + return abstractSyntaxTreeRoot; | |
186 | +} | |
187 | + | |
188 | +/*getCurrentNode 関数 | |
189 | +* 抽象構文木の現在ノードを返す | |
190 | +* nestメンバ関数により現在ノードは更新される*/ | |
191 | +Node* AbstractSyntaxTree::getCurrentNode() | |
192 | +{ | |
193 | + return ast; | |
194 | +} | |
195 | + | |
195 | 196 | /*createPhrase メンバ関数 |
196 | 197 | * SymbolIdが引数であるようなPhrase*型のオブジェクトを返す*/ |
197 | 198 | Phrase* AbstractSyntaxTree::createPhrase(int32_t ret) |
@@ -1,8 +1,8 @@ | ||
1 | 1 | main: |
2 | 2 | obj xw = new wp(); |
3 | 3 | obj xww = new w(); |
4 | - delete xw; | |
5 | - delete xww; | |
4 | + del xw; | |
5 | + del xww; | |
6 | 6 | obj o = new hoge(); |
7 | 7 | o.f(); #ダイクストラ選択(選出) |
8 | 8 | obj oa = new hogehoge(i:12); |
@@ -10,7 +10,7 @@ main: | ||
10 | 10 | expect o: |
11 | 11 | f(); |
12 | 12 | o.f(); |
13 | - delete o; | |
13 | + del o; | |
14 | 14 | |
15 | 15 | expect oa: |
16 | 16 | f(); |
@@ -22,7 +22,7 @@ main: | ||
22 | 22 | i:12 |
23 | 23 | ); |
24 | 24 | i = 12; |
25 | - delete oa; | |
25 | + del oa; | |
26 | 26 | |
27 | 27 | obj oh = new Hg(); |
28 | 28 | expect oh: |
@@ -87,8 +87,8 @@ main: | ||
87 | 87 | case oh: |
88 | 88 | type Hf: |
89 | 89 | i = 1; |
90 | - delete oh; | |
91 | - delete ob; | |
90 | + del oh; | |
91 | + del ob; | |
92 | 92 | ; |
93 | 93 | |
94 | 94 | cla wp: |
@@ -3,7 +3,7 @@ main: | ||
3 | 3 | #TEST |
4 | 4 | obj o = new hoge(); |
5 | 5 | o.f(); |
6 | - delete o; | |
6 | + del o; | |
7 | 7 | # |
8 | 8 | ## |
9 | 9 | # |
@@ -2,8 +2,8 @@ main: | ||
2 | 2 | obj o = new hoge(); |
3 | 3 | obj oa = new hogehoge(i:12); |
4 | 4 | o.f(); |
5 | - delete o; | |
6 | - delete oa; | |
5 | + del o; | |
6 | + del oa; | |
7 | 7 | ; |
8 | 8 | |
9 | 9 | class hoge: |
@@ -27,7 +27,7 @@ main: | ||
27 | 27 | c= 200; |
28 | 28 | dd= 15.1; |
29 | 29 | ; |
30 | - delete o; | |
30 | + del o; | |
31 | 31 | obj oo = new Hg(); |
32 | 32 | except oo: |
33 | 33 | oo.g(); |
@@ -3,11 +3,11 @@ main: | ||
3 | 3 | o.f(); |
4 | 4 | except o: |
5 | 5 | g(); |
6 | - delete o; | |
6 | + del o; | |
7 | 7 | obj oo = new hogehoge(); |
8 | 8 | except oo: |
9 | 9 | f(); |
10 | - delete oo; | |
10 | + del oo; | |
11 | 11 | except: |
12 | 12 | oo = 10; #error |
13 | 13 | error; #error |
@@ -10,14 +10,14 @@ main: | ||
10 | 10 | expect o: |
11 | 11 | i = 0; #error |
12 | 12 | f(); #error |
13 | - delete o; | |
13 | + del o; | |
14 | 14 | obj ob = new hogehoge(); |
15 | 15 | expect ob: |
16 | 16 | i = 0; #no error |
17 | 17 | f(); #no error |
18 | 18 | ff(); #no error |
19 | 19 | i = 12; |
20 | - delete ob; | |
20 | + del ob; | |
21 | 21 | ; |
22 | 22 | |
23 | 23 | cla wp: |
@@ -6,7 +6,7 @@ main: | ||
6 | 6 | i= 0; |
7 | 7 | x() = 100; |
8 | 8 | i= 12; |
9 | - delete o; | |
9 | + del o; | |
10 | 10 | |
11 | 11 | #virtual quantitiy (仮想量子化) = override oa.hoge::f() -> oa.f() -> ... |
12 | 12 | # = oa.hoge::f(oa.f()); 最左評価戦略なので、関手oa.hoge::fがまず評価されて、その次に、関手oa.fが評価される |
@@ -28,7 +28,7 @@ main: | ||
28 | 28 | i=12; |
29 | 29 | x() = 100; |
30 | 30 | i= 12; |
31 | - delete oa; | |
31 | + del oa; | |
32 | 32 | |
33 | 33 | obj oh = new Hg(); |
34 | 34 | expect oh: |
@@ -56,7 +56,7 @@ main: | ||
56 | 56 | fg(); |
57 | 57 | i=12; |
58 | 58 | j=100; |
59 | - delete oh; | |
59 | + del oh; | |
60 | 60 | obj ob = new Hh(i:12); |
61 | 61 | expect ob: |
62 | 62 | f(); |
@@ -70,7 +70,7 @@ main: | ||
70 | 70 | i=17; |
71 | 71 | p(); |
72 | 72 | i=15; |
73 | - delete ob; | |
73 | + del ob; | |
74 | 74 | ; |
75 | 75 | |
76 | 76 | cla wp: |
@@ -2,7 +2,7 @@ main: | ||
2 | 2 | obj o = new hoge(); |
3 | 3 | obj oa = new hogehoge(i:12); |
4 | 4 | o.f(); |
5 | - delete o; | |
5 | + del o; | |
6 | 6 | i32 i = 12; |
7 | 7 | if i < 12: |
8 | 8 | ; |
@@ -13,9 +13,9 @@ main: | ||
13 | 13 | if i > 11: |
14 | 14 | ; |
15 | 15 | elif i < 12: |
16 | - delete oa; | |
16 | + del oa; | |
17 | 17 | else: |
18 | - delete oa; | |
18 | + del oa; | |
19 | 19 | print oa.f(i:15); |
20 | 20 | print oa.f( |
21 | 21 | i:12 |
@@ -24,7 +24,7 @@ main: | ||
24 | 24 | ; |
25 | 25 | for i32 i = 0; i<10; ++i: |
26 | 26 | ; |
27 | - delete oa; | |
27 | + del oa; | |
28 | 28 | obj oh = new Hg(); |
29 | 29 | case oh: |
30 | 30 | type hoge: |
@@ -49,10 +49,10 @@ main: | ||
49 | 49 | type pe: |
50 | 50 | print 12; |
51 | 51 | print 125; |
52 | - delete oh; | |
52 | + del oh; | |
53 | 53 | type wp: |
54 | 54 | print 125; |
55 | - delete oh; | |
55 | + del oh; | |
56 | 56 | print oh.f(); |
57 | 57 | print oh.f(i:18); |
58 | 58 | print oh.f(i:12); |
@@ -79,7 +79,7 @@ main: | ||
79 | 79 | i = 4; |
80 | 80 | except: |
81 | 81 | error; |
82 | - delete ob; | |
82 | + del ob; | |
83 | 83 | ; |
84 | 84 | |
85 | 85 | cla hoge: |
@@ -5,13 +5,13 @@ main: | ||
5 | 5 | o.f(); |
6 | 6 | except o: |
7 | 7 | g(); |
8 | - delete o; | |
8 | + del o; | |
9 | 9 | o = new Hh(); |
10 | 10 | expect o: |
11 | 11 | f(); |
12 | 12 | f(); |
13 | 13 | f(i:12); |
14 | - delete o; | |
14 | + del o; | |
15 | 15 | ; |
16 | 16 | |
17 | 17 | #class hoge |