
ParleRParser::advance 메서드는 텍스트 분석 중에 현재 위치를 다음 위치로 이동시키기 위한 목적으로 사용됩니다.
advance 메서드가 호출되었을 때, 내부적으로 현재 위치의 토큰을 제거하고, 다음 위치로 이동하는 처리가 이루어집니다.
advance 메서드의 반환 값은 다음 위치의 토큰을 반환합니다. 반환 값이 없을 경우, EOF(End Of File) 토큰이 반환됩니다.
advance 메서드의 사용 예는 다음과 같습니다.
#hostingforum.kr
java
ParleRParser parser = new ParleRParser("Hello, World!");
Token token = parser.advance();
System.out.println(token.getValue()); // Hello
token = parser.advance();
System.out.println(token.getValue()); // ,
token = parser.advance();
System.out.println(token.getValue()); // World
token = parser.advance();
System.out.println(token.getValue()); // EOF
2025-07-25 06:36