[ragel-users] Starting out with Java

Adrian Thurston thurs... at cs.queensu.ca
Thu Sep 13 00:51:18 UTC 2007


Hi,

I noticed that people have a tendency to play with the first example
that appears in the manual, however that example uses a special-purpose
write option and has caused confusion on more than one occasion. I just
added a more basic example which appears first.

Cheers,
 Adrian

bluetooth wrote:
> 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.
> 
> 
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "ragel-users" group.
> To post to this group, send email to ragel-users at googlegroups.com
> To unsubscribe from this group, send email to ragel-users-unsubscribe at googlegroups.com
> For more options, visit this group at http://groups.google.com/group/ragel-users?hl=en
> -~----------~----~----~----~------~----~------~--~---
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20070912/33b6bf9b/attachment-0001.sig>


More information about the ragel-users mailing list