@DSSink({DSSinkKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 12:55:51.664 -0500", hash_original_method = "9816EEB9F7DF054BEDA3076A1CE20DA0", hash_generated_method = "8B483A1525BA623F62F1B79AA683FFEA") protected void peekLine(String rule) { if (debug) { Debug.println(rule + " " + lexer.peekLine()); } }
/** Match the given token or throw an exception if no such token can be matched. */ @DSSource({DSSourceKind.SENSITIVE_UNCATEGORIZED}) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 12:55:50.959 -0500", hash_original_method = "EF527252962F704D7452C6B99500917D", hash_generated_method = "BE7655C07E1329CD326693E64EB0674A") public Token match(int tok) throws ParseException { if (Debug.parserDebug) { Debug.println("match " + tok); } if (tok > START && tok < END) { if (tok == ID) { // Generic ID sought. if (!startsId()) throw new ParseException(buffer + "\nID expected", ptr); String id = getNextId(); this.currentMatch = new Token(); this.currentMatch.tokenValue = id; this.currentMatch.tokenType = ID; } else if (tok == SAFE) { if (!startsSafeToken()) throw new ParseException(buffer + "\nID expected", ptr); String id = ttokenSafe(); this.currentMatch = new Token(); this.currentMatch.tokenValue = id; this.currentMatch.tokenType = SAFE; } else { String nexttok = getNextId(); Integer cur = (Integer) currentLexer.get(nexttok.toUpperCase()); if (cur == null || cur.intValue() != tok) throw new ParseException(buffer + "\nUnexpected Token : " + nexttok, ptr); this.currentMatch = new Token(); this.currentMatch.tokenValue = nexttok; this.currentMatch.tokenType = tok; } } else if (tok > END) { // Character classes. char next = lookAhead(0); if (tok == DIGIT) { if (!isDigit(next)) throw new ParseException(buffer + "\nExpecting DIGIT", ptr); this.currentMatch = new Token(); this.currentMatch.tokenValue = String.valueOf(next); this.currentMatch.tokenType = tok; consume(1); } else if (tok == ALPHA) { if (!isAlpha(next)) throw new ParseException(buffer + "\nExpecting ALPHA", ptr); this.currentMatch = new Token(); this.currentMatch.tokenValue = String.valueOf(next); this.currentMatch.tokenType = tok; consume(1); } } else { // This is a direct character spec. char ch = (char) tok; char next = lookAhead(0); if (next == ch) { /*this.currentMatch = new Token(); this.currentMatch.tokenValue = String.valueOf(ch); this.currentMatch.tokenType = tok;*/ consume(1); } else throw new ParseException( buffer + "\nExpecting >>>" + ch + "<<< got >>>" + next + "<<<", ptr); } return this.currentMatch; }