What token does a “peek” operation refer to in Lexical analysis?

Given a grammar for a space delimited list of words:

S     -> word { space word }
word  -> [a-zA-Z]+
space -> [ \t]+


And given the input "Hello World", what token would a peek() operation return?

• Where did you come across this operation? Can you cite the source and the context in which it was used? Did the source define it? I'm not sure there is a standard, accepted meaning for it -- I suspect it might be up to the document where you saw that to define what they meant by that. – D.W. Apr 20 '18 at 6:08
• I have seen two answers: 1. Return the current token ("Hello") without advancing the input stream and 2. return the next token ("World") without advancing the input stream. I want to know which definition is most common in compilers. – Zippers Apr 20 '18 at 13:09