In Codemirror cm.getTokenAt(pos) returns a token at the current cursor position. What exactly does a token mean?
For eg. When you look for a token in the line "System.out.println", it returns the token println, whereas when you search for a token in "System.out.", it return "."
Also is a token language dependent and different results are obtained for different languages?
A token is whatever the mode writer wants it to be. In the context of a codemirror mode, a token is a sequence of text that should be highlighted as a unit. A token is one "thing". That might mean one character (such as an opening or closing brace), or a function or variable name.
The token is completely dependent on the language mode, though most languages use the same rough definition for tokens (functions, variables, syntax characters, comments, etc)