[fpc-devel] String cases development

Mike Denisenko mike_d at mail.ru
Sat Apr 18 09:33:53 CEST 2009


Hello everyone, I'm a student of FESU, Russia. I've started to develop a feature - string cases (Topic: Easiest way to "case" strings, http://www.lazarus.freepascal.org/pipermail/lazarus/2009-March/023369.html), and now some questions appear:

Existing method of parsing and generating assembly code doesn't process any constants but ordinal type,
so the class holding case data, TCaseNode, contains labelinfo as object of TCaseLabel record.

And TCaseLabel contains two fields: _low and _high representing the low and high bounds of interval signed as case label. These fields are of TConstExprInt type, so if we want to process the string label we get a problem: how it's better to hold its value? Should we simply add two string-type fields to TCaseLabel, or it should be solved by creating a base class with some virtual procedures and refactoring all modules having procedures operating with this type?



More information about the fpc-devel mailing list