public void setTokenForType(int ttype, String text) { if (ttype == Token.EOF) { // ignore EOF, it will be reported as an error separately return; } if ( ttype>=typeToTokenList.size() ) { Utils.setSize(typeToTokenList, ttype+1); } String prevToken = typeToTokenList.get(ttype); if ( prevToken==null || prevToken.charAt(0)=='\'' ) { // only record if nothing there before or if thing before was a literal typeToTokenList.set(ttype, text); } }
public void setTokenForType(int ttype, String text) { if (ttype == Token.EOF) { // ignore EOF, it will be reported as an error separately return; } if ( ttype>=typeToTokenList.size() ) { Utils.setSize(typeToTokenList, ttype+1); } String prevToken = typeToTokenList.get(ttype); if ( prevToken==null || prevToken.charAt(0)=='\'' ) { // only record if nothing there before or if thing before was a literal typeToTokenList.set(ttype, text); } }
public void setTokenForType(int ttype, String text) { if (ttype == Token.EOF) { // ignore EOF, it will be reported as an error separately return; } if ( ttype>=typeToTokenList.size() ) { Utils.setSize(typeToTokenList, ttype+1); } String prevToken = typeToTokenList.get(ttype); if ( prevToken==null || prevToken.charAt(0)=='\'' ) { // only record if nothing there before or if thing before was a literal typeToTokenList.set(ttype, text); } }
public void setTokenForType(int ttype, String text) { if (ttype == Token.EOF) { // ignore EOF, it will be reported as an error separately return; } if ( ttype>=typeToTokenList.size() ) { Utils.setSize(typeToTokenList, ttype+1); } String prevToken = typeToTokenList.get(ttype); if ( prevToken==null || prevToken.charAt(0)=='\'' ) { // only record if nothing there before or if thing before was a literal typeToTokenList.set(ttype, text); } }
public void setTokenForType(int ttype, String text) { if (ttype == Token.EOF) { // ignore EOF, it will be reported as an error separately return; } if ( ttype>=typeToTokenList.size() ) { Utils.setSize(typeToTokenList, ttype+1); } String prevToken = typeToTokenList.get(ttype); if ( prevToken==null || prevToken.charAt(0)=='\'' ) { // only record if nothing there before or if thing before was a literal typeToTokenList.set(ttype, text); } }
public int defineStringLiteral(String lit, int ttype) { if ( !stringLiteralToTypeMap.containsKey(lit) ) { stringLiteralToTypeMap.put(lit, ttype); // track in reverse index too if ( ttype>=typeToStringLiteralList.size() ) { Utils.setSize(typeToStringLiteralList, ttype+1); } typeToStringLiteralList.set(ttype, lit); setTokenForType(ttype, lit); return ttype; } return Token.INVALID_TYPE; }
/** * Sets the channel name associated with a particular channel value. * * <p> * If a name has already been assigned to the channel with constant value * {@code channelValue}, this method does nothing.</p> * * @param channelValue The constant value for the channel. * @param name The channel name. */ public void setChannelNameForValue(int channelValue, String name) { if (channelValue >= channelValueToNameList.size()) { Utils.setSize(channelValueToNameList, channelValue + 1); } String prevChannel = channelValueToNameList.get(channelValue); if (prevChannel == null) { channelValueToNameList.set(channelValue, name); } }
public int defineStringLiteral(String lit, int ttype) { if ( !stringLiteralToTypeMap.containsKey(lit) ) { stringLiteralToTypeMap.put(lit, ttype); // track in reverse index too if ( ttype>=typeToStringLiteralList.size() ) { Utils.setSize(typeToStringLiteralList, ttype+1); } typeToStringLiteralList.set(ttype, lit); setTokenForType(ttype, lit); return ttype; } return Token.INVALID_TYPE; }
/** * Sets the channel name associated with a particular channel value. * * <p> * If a name has already been assigned to the channel with constant value * {@code channelValue}, this method does nothing.</p> * * @param channelValue The constant value for the channel. * @param name The channel name. */ public void setChannelNameForValue(int channelValue, String name) { if (channelValue >= channelValueToNameList.size()) { Utils.setSize(channelValueToNameList, channelValue + 1); } String prevChannel = channelValueToNameList.get(channelValue); if (prevChannel == null) { channelValueToNameList.set(channelValue, name); } }
public int defineStringLiteral(String lit, int ttype) { if ( !stringLiteralToTypeMap.containsKey(lit) ) { stringLiteralToTypeMap.put(lit, ttype); // track in reverse index too if ( ttype>=typeToStringLiteralList.size() ) { Utils.setSize(typeToStringLiteralList, ttype+1); } typeToStringLiteralList.set(ttype, lit); setTokenForType(ttype, lit); return ttype; } return Token.INVALID_TYPE; }
public int defineStringLiteral(String lit, int ttype) { if ( !stringLiteralToTypeMap.containsKey(lit) ) { stringLiteralToTypeMap.put(lit, ttype); // track in reverse index too if ( ttype>=typeToStringLiteralList.size() ) { Utils.setSize(typeToStringLiteralList, ttype+1); } typeToStringLiteralList.set(ttype, lit); setTokenForType(ttype, lit); return ttype; } return Token.INVALID_TYPE; }
/** * Sets the channel name associated with a particular channel value. * * <p> * If a name has already been assigned to the channel with constant value * {@code channelValue}, this method does nothing.</p> * * @param channelValue The constant value for the channel. * @param name The channel name. */ public void setChannelNameForValue(int channelValue, String name) { if (channelValue >= channelValueToNameList.size()) { Utils.setSize(channelValueToNameList, channelValue + 1); } String prevChannel = channelValueToNameList.get(channelValue); if (prevChannel == null) { channelValueToNameList.set(channelValue, name); } }
/** * Sets the channel name associated with a particular channel value. * * <p> * If a name has already been assigned to the channel with constant value * {@code channelValue}, this method does nothing.</p> * * @param channelValue The constant value for the channel. * @param name The channel name. */ public void setChannelNameForValue(int channelValue, String name) { if (channelValue >= channelValueToNameList.size()) { Utils.setSize(channelValueToNameList, channelValue + 1); } String prevChannel = channelValueToNameList.get(channelValue); if (prevChannel == null) { channelValueToNameList.set(channelValue, name); } }
/** * Sets the channel name associated with a particular channel value. * * <p> * If a name has already been assigned to the channel with constant value * {@code channelValue}, this method does nothing.</p> * * @param channelValue The constant value for the channel. * @param name The channel name. */ public void setChannelNameForValue(int channelValue, String name) { if (channelValue >= channelValueToNameList.size()) { Utils.setSize(channelValueToNameList, channelValue + 1); } String prevChannel = channelValueToNameList.get(channelValue); if (prevChannel == null) { channelValueToNameList.set(channelValue, name); } }
public int defineStringLiteral(String lit, int ttype) { if ( !stringLiteralToTypeMap.containsKey(lit) ) { stringLiteralToTypeMap.put(lit, ttype); // track in reverse index too if ( ttype>=typeToStringLiteralList.size() ) { Utils.setSize(typeToStringLiteralList, ttype+1); } typeToStringLiteralList.set(ttype, lit); setTokenForType(ttype, lit); return ttype; } return Token.INVALID_TYPE; }
protected void processParser() { g.decisionLOOK = new ArrayList<IntervalSet[]>(g.atn.getNumberOfDecisions()+1); for (DecisionState s : g.atn.decisionToState) { g.tool.log("LL1", "\nDECISION "+s.decision+" in rule "+g.getRule(s.ruleIndex).name); IntervalSet[] look; if ( s.nonGreedy ) { // nongreedy decisions can't be LL(1) look = new IntervalSet[s.getNumberOfTransitions()+1]; } else { LL1Analyzer anal = new LL1Analyzer(g.atn); look = anal.getDecisionLookahead(s); g.tool.log("LL1", "look=" + Arrays.toString(look)); } assert s.decision + 1 >= g.decisionLOOK.size(); Utils.setSize(g.decisionLOOK, s.decision+1); g.decisionLOOK.set(s.decision, look); g.tool.log("LL1", "LL(1)? " + disjoint(look)); } }
protected void processParser() { g.decisionLOOK = new ArrayList<IntervalSet[]>(g.atn.getNumberOfDecisions()+1); for (DecisionState s : g.atn.decisionToState) { g.tool.log("LL1", "\nDECISION "+s.decision+" in rule "+g.getRule(s.ruleIndex).name); IntervalSet[] look; if ( s.nonGreedy ) { // nongreedy decisions can't be LL(1) look = new IntervalSet[s.getNumberOfTransitions()+1]; } else { LL1Analyzer anal = new LL1Analyzer(g.atn); look = anal.getDecisionLookahead(s); g.tool.log("LL1", "look=" + Arrays.toString(look)); } assert s.decision + 1 >= g.decisionLOOK.size(); Utils.setSize(g.decisionLOOK, s.decision+1); g.decisionLOOK.set(s.decision, look); g.tool.log("LL1", "LL(1)? " + disjoint(look)); } }
protected void processParser() { g.decisionLOOK = new ArrayList<IntervalSet[]>(g.atn.getNumberOfDecisions()+1); for (DecisionState s : g.atn.decisionToState) { g.tool.log("LL1", "\nDECISION "+s.decision+" in rule "+g.getRule(s.ruleIndex).name); IntervalSet[] look; if ( s.nonGreedy ) { // nongreedy decisions can't be LL(1) look = new IntervalSet[s.getNumberOfTransitions()+1]; } else { LL1Analyzer anal = new LL1Analyzer(g.atn); look = anal.getDecisionLookahead(s); g.tool.log("LL1", "look=" + Arrays.toString(look)); } assert s.decision + 1 >= g.decisionLOOK.size(); Utils.setSize(g.decisionLOOK, s.decision+1); g.decisionLOOK.set(s.decision, look); g.tool.log("LL1", "LL(1)? " + disjoint(look)); } }
protected void processParser() { g.decisionLOOK = new ArrayList<IntervalSet[]>(g.atn.getNumberOfDecisions()+1); for (DecisionState s : g.atn.decisionToState) { g.tool.log("LL1", "\nDECISION "+s.decision+" in rule "+g.getRule(s.ruleIndex).name); IntervalSet[] look; if ( s.nonGreedy ) { // nongreedy decisions can't be LL(1) look = new IntervalSet[s.getNumberOfTransitions()+1]; } else { LL1Analyzer anal = new LL1Analyzer(g.atn); look = anal.getDecisionLookahead(s); g.tool.log("LL1", "look=" + Arrays.toString(look)); } assert s.decision + 1 >= g.decisionLOOK.size(); Utils.setSize(g.decisionLOOK, s.decision+1); g.decisionLOOK.set(s.decision, look); g.tool.log("LL1", "LL(1)? " + disjoint(look)); } }
protected void processParser() { g.decisionLOOK = new ArrayList<IntervalSet[]>(g.atn.getNumberOfDecisions()+1); for (DecisionState s : g.atn.decisionToState) { g.tool.log("LL1", "\nDECISION "+s.decision+" in rule "+g.getRule(s.ruleIndex).name); IntervalSet[] look; if ( s.nonGreedy ) { // nongreedy decisions can't be LL(1) look = new IntervalSet[s.getNumberOfTransitions()+1]; } else { LL1Analyzer anal = new LL1Analyzer(g.atn); look = anal.getDecisionLookahead(s); g.tool.log("LL1", "look=" + Arrays.toString(look)); } assert s.decision + 1 >= g.decisionLOOK.size(); Utils.setSize(g.decisionLOOK, s.decision+1); g.decisionLOOK.set(s.decision, look); g.tool.log("LL1", "LL(1)? " + disjoint(look)); } }