protected void createSpecialTable(DFAState s) { // number all special states from 0...n-1 instead of their usual numbers boolean hasSemPred = false; // TODO this code is very similar to canGenerateSwitch. Refactor to share for (int j = 0; j < s.getNumberOfTransitions(); j++) { Transition edge = (Transition) s.transition(j); Label label = edge.label; // can't do a switch if the edges have preds or are going to // require gated predicates if ( label.isSemanticPredicate() || ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null) { hasSemPred = true; break; } } // if has pred or too big for table, make it special int smax = ((Integer)max.get(s.stateNumber)).intValue(); int smin = ((Integer)min.get(s.stateNumber)).intValue(); if ( hasSemPred || smax-smin>MAX_STATE_TRANSITIONS_FOR_TABLE ) { special.set(s.stateNumber, Utils.integer(uniqueCompressedSpecialStateNum)); uniqueCompressedSpecialStateNum++; specialStates.add(s); } else { special.set(s.stateNumber, Utils.integer(-1)); // not special } }
protected void createSpecialTable(DFAState s) { // number all special states from 0...n-1 instead of their usual numbers boolean hasSemPred = false; // TODO this code is very similar to canGenerateSwitch. Refactor to share for (int j = 0; j < s.getNumberOfTransitions(); j++) { Transition edge = (Transition) s.transition(j); Label label = edge.label; // can't do a switch if the edges have preds or are going to // require gated predicates if ( label.isSemanticPredicate() || ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null) { hasSemPred = true; break; } } // if has pred or too big for table, make it special int smax = ((Integer)max.get(s.stateNumber)).intValue(); int smin = ((Integer)min.get(s.stateNumber)).intValue(); if ( hasSemPred || smax-smin>MAX_STATE_TRANSITIONS_FOR_TABLE ) { special.set(s.stateNumber, Utils.integer(uniqueCompressedSpecialStateNum)); uniqueCompressedSpecialStateNum++; specialStates.add(s); } else { special.set(s.stateNumber, Utils.integer(-1)); // not special } }
protected void createSpecialTable(DFAState s) { // number all special states from 0...n-1 instead of their usual numbers boolean hasSemPred = false; // TODO this code is very similar to canGenerateSwitch. Refactor to share for (int j = 0; j < s.getNumberOfTransitions(); j++) { Transition edge = s.transition(j); Label label = edge.label; // can't do a switch if the edges have preds or are going to // require gated predicates if ( label.isSemanticPredicate() || ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null) { hasSemPred = true; break; } } // if has pred or too big for table, make it special int smax = max.get(s.stateNumber); int smin = min.get(s.stateNumber); if ( hasSemPred || smax-smin>MAX_STATE_TRANSITIONS_FOR_TABLE ) { special.set(s.stateNumber, Utils.integer(uniqueCompressedSpecialStateNum)); uniqueCompressedSpecialStateNum++; specialStates.add(s); } else { special.set(s.stateNumber, Utils.integer(-1)); // not special } }
protected void createSpecialTable(DFAState s) { // number all special states from 0...n-1 instead of their usual numbers boolean hasSemPred = false; // TODO this code is very similar to canGenerateSwitch. Refactor to share for (int j = 0; j < s.getNumberOfTransitions(); j++) { Transition edge = s.transition(j); Label label = edge.label; // can't do a switch if the edges have preds or are going to // require gated predicates if ( label.isSemanticPredicate() || ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null) { hasSemPred = true; break; } } // if has pred or too big for table, make it special int smax = max.get(s.stateNumber); int smin = min.get(s.stateNumber); if ( hasSemPred || smax-smin>MAX_STATE_TRANSITIONS_FOR_TABLE ) { special.set(s.stateNumber, Utils.integer(uniqueCompressedSpecialStateNum)); uniqueCompressedSpecialStateNum++; specialStates.add(s); } else { special.set(s.stateNumber, Utils.integer(-1)); // not special } }
SemanticContext gatedPreds = d.getGatedPredicatesInNFAConfigurations(); SemanticContext existingStateGatedPreds = acceptStateForAlt.getGatedPredicatesInNFAConfigurations(); if ( (gatedPreds==null && existingStateGatedPreds==null) || ((gatedPreds!=null && existingStateGatedPreds!=null) &&
SemanticContext gatedPreds = d.getGatedPredicatesInNFAConfigurations(); SemanticContext existingStateGatedPreds = acceptStateForAlt.getGatedPredicatesInNFAConfigurations(); if ( (gatedPreds==null && existingStateGatedPreds==null) || ((gatedPreds!=null && existingStateGatedPreds!=null) &&
((DFAState)edge.target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { predsStr = "&&{"+
((DFAState)edge.target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { predsStr = "&&{"+
SemanticContext gatedPreds = d.getGatedPredicatesInNFAConfigurations(); SemanticContext existingStateGatedPreds = acceptStateForAlt.getGatedPredicatesInNFAConfigurations(); if ( (gatedPreds==null && existingStateGatedPreds==null) || ((gatedPreds!=null && existingStateGatedPreds!=null) &&
SemanticContext gatedPreds = d.getGatedPredicatesInNFAConfigurations(); SemanticContext existingStateGatedPreds = acceptStateForAlt.getGatedPredicatesInNFAConfigurations(); if ( (gatedPreds==null && existingStateGatedPreds==null) || ((gatedPreds!=null && existingStateGatedPreds!=null) &&
((DFAState)edge.target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { predsStr = "&&{"+
((DFAState)edge.target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { predsStr = "&&{"+
/** Fix edge strings so they print out in DOT properly; * generate any gated predicates on edge too. */ protected String getEdgeLabel(Transition edge) { String label = edge.label.toString(grammar); label = Utils.replace(label,"\\", "\\\\"); label = Utils.replace(label,"\"", "\\\""); label = Utils.replace(label,"\n", "\\\\n"); label = Utils.replace(label,"\r", ""); if ( label.equals(Label.EPSILON_STR) ) { label = "e"; } State target = edge.target; if ( !edge.isSemanticPredicate() && target instanceof DFAState ) { // look for gated predicates; don't add gated to simple sempred edges SemanticContext preds = ((DFAState)target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { String predsStr = ""; predsStr = "&&{"+ preds.genExpr(grammar.generator, grammar.generator.getTemplates(), null).toString() +"}?"; label += predsStr; } } return label; }
/** Fix edge strings so they print out in DOT properly; * generate any gated predicates on edge too. */ protected String getEdgeLabel(Transition edge) { String label = edge.label.toString(grammar); label = Utils.replace(label,"\\", "\\\\"); label = Utils.replace(label,"\"", "\\\""); label = Utils.replace(label,"\n", "\\\\n"); label = Utils.replace(label,"\r", ""); if ( label.equals(Label.EPSILON_STR) ) { label = "e"; } State target = edge.target; if ( !edge.isSemanticPredicate() && target instanceof DFAState ) { // look for gated predicates; don't add gated to simple sempred edges SemanticContext preds = ((DFAState)target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { String predsStr = ""; predsStr = "&&{"+ preds.genExpr(grammar.generator, grammar.generator.getTemplates(), null).toString() +"}?"; label += predsStr; } } return label; }
/** Fix edge strings so they print out in DOT properly; * generate any gated predicates on edge too. */ protected String getEdgeLabel(Transition edge) { String label = edge.label.toString(grammar); label = Utils.replace(label,"\\", "\\\\"); label = Utils.replace(label,"\"", "\\\""); label = Utils.replace(label,"\n", "\\\\n"); label = Utils.replace(label,"\r", ""); if ( label.equals(Label.EPSILON_STR) ) { label = "e"; } State target = edge.target; if ( !edge.isSemanticPredicate() && target instanceof DFAState ) { // look for gated predicates; don't add gated to simple sempred edges SemanticContext preds = ((DFAState)target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { String predsStr; predsStr = "&&{"+ preds.genExpr(grammar.generator, grammar.generator.getTemplates(), null).render() +"}?"; label += predsStr; } } return label; }
/** Fix edge strings so they print out in DOT properly; * generate any gated predicates on edge too. */ protected String getEdgeLabel(Transition edge) { String label = edge.label.toString(grammar); label = Utils.replace(label,"\\", "\\\\"); label = Utils.replace(label,"\"", "\\\""); label = Utils.replace(label,"\n", "\\\\n"); label = Utils.replace(label,"\r", ""); if ( label.equals(Label.EPSILON_STR) ) { label = "e"; } State target = edge.target; if ( !edge.isSemanticPredicate() && target instanceof DFAState ) { // look for gated predicates; don't add gated to simple sempred edges SemanticContext preds = ((DFAState)target).getGatedPredicatesInNFAConfigurations(); if ( preds!=null ) { String predsStr; predsStr = "&&{"+ preds.genExpr(grammar.generator, grammar.generator.getTemplates(), null).render() +"}?"; label += predsStr; } } return label; }
if ( ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null ) { return false;
if ( ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null ) { return false;
if ( ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null ) { return false;
if ( ((DFAState)edge.target).getGatedPredicatesInNFAConfigurations()!=null ) { return false;