Starting out with Java
bluetooth
auxb... at googlemail.com
Sun Sep 9 18:14:20 UTC 2007
Hi,
I'm trying to understand the basics of using ragel in Java. But I
can't find any examples, so I'm struggling to get started.
I notice that "the test directory" is often referenced in posts here,
but no clue is given as to where this mysterious directory might be
found. That might be a help.
Taking simple.rl as a starting point, I so far have:
public class Ragel {
%% machine foo;
public static void main(String[] args) {
%% write data noerror nofinal;
int cs, res = 0;
if (args[0].length() > 0) {
char[] data = args[0].toCharArray();
int p = 0;
int pe = data.length + 1;
%%{
main := [a-z]+ 0 @{ res = 1; fbreak; };
write init;
write exec;
}%%
}
System.out.println("Execute = " + res);
}
}
However, this fails for matches with an out of bounds exception.But if
I set pe = data.length, then no matches are ever found.
Just a suggestion, but examples of simple.rl in Ruby and Java might
broaden your user base quite considerably. Putting the group on gmane
might also garner a lot more input.
More information about the ragel-users
mailing list