Home | History | Annotate | Download | only in antlr

Lines Matching refs:predicate

446 /* MR11 */      Predicate   *pred=p->ampersandPred;

512 verify_context(Predicate *predicate)
514 verify_context(predicate)
515 Predicate *predicate;
518 if ( predicate == NULL ) return;
520 if ( predicate->expr == PRED_OR_LIST ||
521 predicate->expr == PRED_AND_LIST )
523 verify_context(predicate->down);
524 verify_context(predicate->right); /* MR10 */
528 if ( !predicate->source->ctxwarned && predicate->source->guardpred==NULL &&
529 ((predicate->k > 1 &&
530 !is_single_tuple(predicate->tcontext)) ||
531 ( predicate->k == 1 &&
532 set_deg(predicate->scontext[1])>1 )) )
537 fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
538 predicate->source->line);
539 fprintf(stderr, " warning: predicate applied for >1 lookahead %d-sequences\n", predicate->k);
540 fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
541 predicate->source->line);
542 fprintf(stderr, " predicate text: \"%s\"\n",
543 (predicate->expr == NULL ? "(null)" : predicate->expr) );
544 fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
545 predicate->source->line);
546 fprintf(stderr, " You may only want one lookahead %d-sequence to apply\n", predicate->k);
547 fprintf(stderr, ErrHdr, FileStr[predicate->source->file],
548 predicate->source->line);
550 predicate->source->ctxwarned = 1;
552 verify_context(predicate->right); /* MR10 */
557 * the predicate(s) for productions alt1,alt2 cover the sequences in delta.
568 * does not have a predicate in the production that generates (A C).
594 if ( alt1->predicate!=NULL )
595 non_covered = tdif(ambig, alt1->predicate, alt1->fset, alt2->fset);
596 if ( (non_covered!=NULL || alt1->predicate==NULL) && WarningLevel>1 )
599 fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
601 if ( alt1->predicate!=NULL && non_covered!=NULL )
606 else if ( alt1->predicate==NULL )
615 if ( alt2->predicate!=NULL )
616 non_covered = tdif(ambig, alt2->predicate, alt1->fset, alt2->fset);
617 if ( (non_covered!=NULL || alt2->predicate==NULL) && WarningLevel>1 )
620 fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
622 if ( alt2->predicate!=NULL && non_covered!=NULL )
627 else if ( alt2->predicate==NULL )
640 non_covered = set_dif(delta, covered_set(alt1->predicate));
644 fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
646 if ( alt1->predicate!=NULL )
654 non_covered = set_dif(delta, covered_set(alt2->predicate));
658 fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity",
660 if ( alt2->predicate!=NULL )
670 else fatal_internal("productions have no lookahead in predicate checking routine");
684 Predicate *p1;
685 Predicate *p2;
693 if (alt1->predicate == NULL && alt2->predicate == NULL) return;
696 && (alt1->predicate == NULL && alt2->predicate != NULL)) {
704 " These alts have ambig lookahead sequences resolved by a predicate for\n",
706 " You may want to use a complementary predicate or rearrange the alts\n"
713 if (MR_comparePredicates(alt1->predicate,alt2->predicate)) {
747 p1=predicate_dup_without_context(alt1->predicate);
752 p2=predicate_dup_without_context(alt2->predicate);
796 fprintf(output," The original predicate for choice 1 with available context information:\n\n");
797 MR_dumpPred1(2,alt1->predicate,1);
798 fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n");
801 Predicate *phelp;
802 fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n");
803 phelp=predicate_dup_without_context(alt1->predicate);
818 fprintf(output," The original predicate for choice 2 with available context information:\n\n");
819 MR_dumpPred1(1,alt2->predicate,1);
820 fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n");
823 Predicate *phelp;
824 fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n");
825 phelp=predicate_dup_without_context(alt2->predicate);
839 "the predicate used to disambiguate the first choice of the optional/exit paths of ",
847 " appears to \"cover\" the second predicate when compared without context.\n",
848 " The second predicate may have no resolving power for some lookahead sequences.\n");
852 "the predicate used to disambiguate the first choice of",
859 " appears to \"cover\" the second predicate when compared without context.\n",
860 " The second predicate may have no resolving power for some lookahead sequences.\n");
864 fprintf(output,"The first predicate appears to \"cover\" the second predicate when they\n");
866 fprintf(output," lookahead sequences the second predicate may not have any power to\n");
874 fprintf(output," The original predicate for choice 1 with available context information:\n\n");
875 MR_dumpPred1(2,alt1->predicate,1);
876 fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n");
879 Predicate *phelp;
880 fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n");
881 phelp=predicate_dup_without_context(alt1->predicate);
896 fprintf(output," The original predicate for choice 2 with available context information:\n\n");
897 MR_dumpPred1(1,alt2->predicate,1);
898 fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n");
901 Predicate *phelp;
902 fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n");
903 phelp=predicate_dup_without_context(alt2->predicate);
998 if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
999 if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
1002 alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
1004 require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
1005 alt1->predicate=MR_predSimplifyALL(alt1->predicate);
1008 alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
1010 require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
1011 alt2->predicate=MR_predSimplifyALL(alt2->predicate);
1016 && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
1018 verify_context(alt1->predicate);
1019 verify_context(alt2->predicate);
1023 && (alt1->predicate!=NULL||alt2->predicate!=NULL)
1091 if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
1092 if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
1095 alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
1097 require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
1098 alt1->predicate=MR_predSimplifyALL(alt1->predicate);
1101 alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
1103 require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
1104 alt2->predicate=MR_predSimplifyALL(alt2->predicate);
1108 if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
1110 verify_context(alt1->predicate);
1111 verify_context(alt2->predicate);
1113 if (HoistPredicateContext&&(alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1)
1116 (alt1->predicate!=NULL||alt2->predicate!=NULL))
1203 if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
1204 if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
1206 alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
1208 require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
1209 alt1->predicate=MR_predSimplifyALL(alt1->predicate);
1212 alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
1214 require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
1215 alt2->predicate=MR_predSimplifyALL(alt2->predicate);
1219 if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
1221 verify_context(alt1->predicate);
1222 verify_context(alt2->predicate);
1224 if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 )
1227 (alt1->predicate!=NULL||alt2->predicate!=NULL))
1315 if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */
1316 if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */
1318 alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1);
1320 require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed");
1321 alt1->predicate=MR_predSimplifyALL(alt1->predicate);
1324 alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1);
1326 require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed");
1327 alt2->predicate=MR_predSimplifyALL(alt2->predicate);
1331 if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) )
1333 verify_context(alt1->predicate);
1334 verify_context(alt2->predicate);
1336 if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 )
1339 (alt1->predicate!=NULL||alt2->predicate!=NULL))
1395 /* MR13b When there was an action/predicate preceding a guess block