I am trying to write a lexical analyzer for C# language, but I can't figure out how can I differentiate the plus sign from the plus operator, except the context. I need the next token from the source file. So, when I encounter a + how do I now it refers to a declaration of some integer, real, whatever or it refers to + operator? How can my scannig function differentiate these two situations appropriately? The case is similar to this < and <=, <<, but in my situation next character does't help every time.
int a = +1;
a=2 + 3;