[ragel-users] (resolved?) Trouble referencing definitions from included machines (6.6) (Austin Hastings)

ragel-user at jgoettgens.de ragel-user at jgoettgens.de
Thu Mar 24 20:33:31 UTC 2011

I can confirm the odd behavior as described, however

include inner "xdir/testinc.rl";  works, if xdir is a subdirectory, but it 
shouldn't because of '/' (*)

include inner "xdir\testinc.rl";  fails, though it should work because '\' 
is correct here

In line 48 in rlscan.cpp there is a definition for the OS dependent path 
separator, but there are only 2 references to it in rlscan (lines 838 and 
857). I would have expected more occurences.

My guess is that the problem is related to a possibly inconsistent handling 
of the Windows path separator '\' in various parts of the code (mea culpa 
verisimilis). I don't know much about mingw, but its older brother cygwin 
handles path issues pretty much transparently inside its lib and allows '/' 
and '\' as far as I remember.

Since includes works on other platforms and partially on Windows boxes (see 
*), the scanner with its basic include handling is very unlikely part of the 

I'll probably find some more time tomorrow to verify this and in case it is 
the problem, there will be some design decisions to be made:

(1) Use PATH_SEP and patch wherever necessary with a lot of #ifdefs: ugly 
and then one could use only '\' on the VisualStudio build, i.e. one cannot 
really move code between different platforms

(2) Factor out path handling using a small number of support routines to 
mimic the behavior of cygwin/mingw: looks good to me

Actually, I'd prefer to allow any character on any platform like you can use 
any delimiter for regular expressions. In this case there would be different 
defaults for different platforms, but this could be changed with a command 
line switch. It could even make sense to allow an array of path separators, 
where '/' and '\' would be the default on Windows machines.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20110324/f3bd1f71/attachment-0001.html>
-------------- next part --------------
ragel-users mailing list
ragel-users at complang.org

More information about the ragel-users mailing list