lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jun 30, 2003 at 12:47:42PM +0000, David Jones wrote:
....
> Put all your patterns in a table.  This will simplify the lookup
> procedure and allow you to check the patterns.  It won't be "compile
> time" but will be "ahead of time":
> 
> t = {
>   "some_pattern",
>   "some_pattern2",
>   "some_pattern3"
> }
> 
....

I thought about this as well. But this is not very practical solution. Imagine
100 patterns that have to be taken out of context and put into table. And then
in the code maintainer would have to point to correct slot in the table. That
is why I decided to go with extra run thru regular expressions, kind of
"before compilation check". It just looks kind of dirty: parsing before
parsing.

Andrei