fbb-git / flexcpp

Flexc++ is a scanner generator like flex, but it generates C++ code
31 stars 11 forks source link

Add a function to get column number? #5

Closed yujincheng08 closed 7 years ago

yujincheng08 commented 7 years ago

How about adding a function to get the column number of a line? We now have a function to get the line number, how about the column number?

fbb-git commented 7 years ago

Dear LoveSy, you wrote:

How about adding a function to get the column number of a line? We now have a function to get the line number, how about the column number?

Thanks for your suggestion. However, a member returning a column number is in practice so little used, that adding it to the standard facilities is not really worth the effort.

If monitoring column numbers is something you require, a simple solution would be to provide the gegerated scanner with an Input class of your own design, and count columns in its get' member. Be sure to update column numbers inreRead' and in the constructors.

But I'll keep your suggestion in mind. I might add it to a future version of flexc++.

Thanks again,

-- Frank B. Brokken Center for Information Technology, University of Groningen (+31) 50 363 9281 Public PGP key: http://pgp.surfnet.nl Key Fingerprint: DF32 13DE B156 7732 E65E 3B4D 7DB2 A8BE EAE4 D8AA

yujincheng08 commented 7 years ago

Thank you for your reply! I will try your solution! Thanks a lot!