[fpc-pascal] CSV via PCRE

S. Fisher expandafter at yahoo.com
Sun Nov 11 05:52:52 CET 2007


--- Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:


> The code shown in the url below works just fine. Also the usage sample
> is all you need to use the tokenizer. Just replace the FieldSpecLine
> variable with the content from a CSV file and you are good to go. I
> use it as-is in my production code. Plus that unit has been well unit
> tested as part of the hourly tests run by the tiOPF project.
> 
> http://tinyurl.com/395vgp

It won't compile.

Free Pascal Compiler version 2.2.0 [2007/09/09] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling tiTokenLibrary.pp
tiTokenLibrary.pp(26,2) Fatal: Can't open include file "tiDefines.inc"

> 
> But if you insist, I can give you a full running application.  My
> point was that regular expression are normally a nightmare to debug
> and maintain.

I don't think so.

> Plus not everybody knows them (syntax wise),

Not everyone knows how to tie his shoelaces.

Regular expressions are used by vi and emacs; in fact, any editor that
doesn't let you do a regex search is a joke.  (Even some microsoft
applications understand regexes.)  So everyone who programs should
learn regular expressions.

Regular expressions are also used by grep, and by the languages awk,
Ruby, Perl, etc.  Every programmer should know how to use at least
one of these languages.  Those who don't should perhaps be lumped
together with COBOL programmers.

Therefore, I honestly believe that anyone who doesn't understand
regular expressions has a huge, glaring, inexcusable hole in his
computer knowledge.  Ignorance of regular expressions is like not
knowing how to tie one's shoelaces: it's not something to boast about.

The fact that a single regular expression takes as much time to
read and understand as many lines of Pascal isn't a problem,
because the regex does as much work as many lines of Pascal.
Don't worry about that; you'll spend more time writing them than
reading them.

Regular expressions are no more against the spirit of Pascal
than associative arrays (hash tables) or any other feature
that is added by using a unit.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the fpc-pascal mailing list