rathin.saran
July 18th, 2011, 06:01 PM
Hi Guys,
I am trying to write a tokenizer/scanner for the C programming language in C itself. The only issue(?) is that it is even recognising code fragments such as
+ /* comment */ =
- =
* //comment
=
as +=, -=, *= assignment operators.
It is fine with scanning +=, -= *= etc. when they come without any whitespaces in the middle.
No C compiler in my sight allows whitespaces like \n, \f, comments etc. in the middle of +=, -=, >>, etc. operators. Shall I fix my tokenizer code? Is this behavior tolerable according to the C language standards?
I am a noob undergrad and just curious.
Thanks in Advance!
I am trying to write a tokenizer/scanner for the C programming language in C itself. The only issue(?) is that it is even recognising code fragments such as
+ /* comment */ =
- =
* //comment
=
as +=, -=, *= assignment operators.
It is fine with scanning +=, -= *= etc. when they come without any whitespaces in the middle.
No C compiler in my sight allows whitespaces like \n, \f, comments etc. in the middle of +=, -=, >>, etc. operators. Shall I fix my tokenizer code? Is this behavior tolerable according to the C language standards?
I am a noob undergrad and just curious.
Thanks in Advance!