Setup for Java and Ragel.
This commit is contained in:
parent
2652bc0103
commit
64c9e18651
|
@ -0,0 +1,40 @@
|
|||
package org.liboga.xml;
|
||||
|
||||
%%machine lexer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jruby.Ruby;
|
||||
import org.jruby.RubyModule;
|
||||
import org.jruby.RubyClass;
|
||||
import org.jruby.RubyObject;
|
||||
import org.jruby.anno.JRubyClass;
|
||||
import org.jruby.anno.JRubyMethod;
|
||||
import org.jruby.runtime.ThreadContext;
|
||||
import org.jruby.runtime.builtin.IRubyObject;
|
||||
|
||||
@JRubyClass(name="Oga::XML::Lexer", parent="Object")
|
||||
public class Lexer extends RubyObject
|
||||
{
|
||||
%% write data;
|
||||
|
||||
public Lexer(Ruby runtime, RubyClass klass)
|
||||
{
|
||||
super(runtime, klass);
|
||||
}
|
||||
|
||||
@JRubyMethod
|
||||
public IRubyObject advance_native(ThreadContext context)
|
||||
{
|
||||
%% write init;
|
||||
%% write exec;
|
||||
|
||||
return context.getRuntime().getNil();
|
||||
}
|
||||
}
|
||||
|
||||
%%{
|
||||
main := |*
|
||||
any;
|
||||
*|;
|
||||
}%%
|
|
@ -20,5 +20,12 @@ rule '.c' => '.rl' do |task|
|
|||
sh "ragel -C -G2 #{task.source} -o #{task.name}"
|
||||
end
|
||||
|
||||
rule '.java' => '.rl' do |task|
|
||||
sh "ragel -J #{task.source} -o #{task.name}"
|
||||
end
|
||||
|
||||
desc 'Generates the lexers'
|
||||
task :lexer => ['ext/liboga/lexer.c']
|
||||
multitask :lexer => [
|
||||
'ext/liboga/lexer.c',
|
||||
'ext/liboga/org/liboga/xml/Lexer.java'
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue