Skip to content

Commit

Permalink
Update code so it almost works. Very close now...
Browse files Browse the repository at this point in the history
  • Loading branch information
olabini committed Oct 22, 2008
1 parent e8c7f88 commit 4ed164e
Show file tree
Hide file tree
Showing 4 changed files with 295 additions and 90 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -7,7 +7,9 @@ ext/redcloth_scan/*.class
ext/redcloth_scan/*.java
lib/*.bundle
lib/*.so
lib/*.jar
doc/rdoc/*
tmp/*
pkg/*
.DS_Store
*.log
10 changes: 9 additions & 1 deletion Rakefile
Expand Up @@ -291,9 +291,17 @@ namespace "jruby" do
Dir.chdir "ext/redcloth_scan" do
compile_java("RedclothScanService.java", "redcloth_scan.jar")
end
cp "ext/redcloth_scan/redcloth_scan.jar", "lib"
end

JRUBY_PKG_DIR = "pkg-jruby"
desc "Run all the tests using JRuby"
Rake::TestTask.new(:test => [:redcloth_scan_java]) do |t|
t.libs << "test"
t.test_files = FileList['test/test_*.rb']
t.verbose = true
end

JRUBY_PKG_DIR = "pkg-jruby"

desc "Package up the JRuby distribution."
file JRUBY_PKG_DIR => [:ragel_java, :package] do
Expand Down
36 changes: 18 additions & 18 deletions ext/redcloth_scan/redcloth_common.java.rl
Expand Up @@ -4,41 +4,41 @@

action A { reg = p; }
action B { bck = p; }
action T { STORE(text); }
action X { CLEAR_REGS(); reg = NULL; }
action T { STORE("text"); }
action X { CLEAR_REGS(); reg = -1; }
action cat { CAT(block); }
action esc { rb_str_cat_escaped(self, block, ts, te); }
action esc_pre { rb_str_cat_escaped_for_preformatted(self, block, ts, te); }
action ignore { rb_str_append(block, rb_funcall(self, rb_intern("ignore"), 1, regs)); }
action ignore { ((RubyString)block).append(self.callMethod(runtime.getCurrentContext(), "ignore", regs)); }

# simple
LF = ( '\n' ) ;
default = ^0 ;
EOF = 0 ;

# textile modifiers
A_LEFT = "<" %{ ASET(align, left) } ;
A_RIGHT = ">" %{ ASET(align, right) } ;
A_JUSTIFIED = "<>" %{ ASET(align, justify) } ;
A_CENTER = "=" %{ ASET(align, center) } ;
A_PADLEFT = "(" >A %{ AINC(padding-left) } ;
A_PADRIGHT = ")" >A %{ AINC(padding-right) } ;
A_LEFT = "<" %{ ASET("align", "left"); } ;
A_RIGHT = ">" %{ ASET("align", "right"); } ;
A_JUSTIFIED = "<>" %{ ASET("align", "justify"); } ;
A_CENTER = "=" %{ ASET("align", "center"); } ;
A_PADLEFT = "(" >A %{ AINC("padding-left"); } ;
A_PADRIGHT = ")" >A %{ AINC("padding-right"); } ;
A_HLGN = ( A_LEFT | A_RIGHT | A_JUSTIFIED | A_CENTER | A_PADLEFT | A_PADRIGHT ) ;
A_LIMIT = ( A_LEFT | A_CENTER | A_RIGHT ) ;
A_VLGN = ( "-" %{ ASET(vertical-align, middle) } | "^" %{ ASET(vertical-align, top) } | "~" %{ ASET(vertical-align, bottom) } ) ;
C_CLAS = ( "(" ( [^)#]+ >A %{ STORE(class) } )? ("#" [^)]+ >A %{STORE(id)} )? ")" ) ;
C_LNGE = ( "[" [^\]]+ >A %{ STORE(lang) } "]" ) ;
C_STYL = ( "{" [^}]+ >A %{ STORE(style) } "}" ) ;
S_CSPN = ( "\\" [0-9]+ >A %{ STORE(colspan) } ) ;
S_RSPN = ( "/" [0-9]+ >A %{ STORE(rowspan) } ) ;
D_HEADER = "_" %{ ASET(th, true) } ;
A_VLGN = ( "-" %{ ASET("vertical-align", "middle"); } | "^" %{ ASET("vertical-align", "top"); } | "~" %{ ASET("vertical-align", "bottom"); } ) ;
C_CLAS = ( "(" ( [^)#]+ >A %{ STORE("class"); } )? ("#" [^)]+ >A %{STORE("id");} )? ")" ) ;
C_LNGE = ( "[" [^\]]+ >A %{ STORE("lang"); } "]" ) ;
C_STYL = ( "{" [^}]+ >A %{ STORE("style"); } "}" ) ;
S_CSPN = ( "\\" [0-9]+ >A %{ STORE("colspan"); } ) ;
S_RSPN = ( "/" [0-9]+ >A %{ STORE("rowspan"); } ) ;
D_HEADER = "_" %{ ASET("th", "true"); } ;
A = ( ( A_HLGN | A_VLGN )* ) ;
A2 = ( A_LIMIT? ) ;
S = ( S_CSPN | S_RSPN )* ;
C = ( C_CLAS | C_STYL | C_LNGE )* ;
D = ( D_HEADER ) ;
N_CONT = "_" %{ list_continue = 1; };
N_NUM = digit+ >A %{ STORE(start) };
N_NUM = digit+ >A %{ STORE("start"); };
N = ( N_CONT | N_NUM )? ;
PUNCT = ( "!" | '"' | "#" | "$" | "%" | "&" | "'" | "," | "-" | "." | "/" | ":" | ";" | "=" | "?" | "\\" | "^" | "`" | "|" | "~" | "[" | "]" | "(" | ")" | "<" ) ;
dotspace = ("." " "*) ;
Expand Down Expand Up @@ -105,7 +105,7 @@
uri = (target | absolute_uri | absolute_path | rel_path) ;

# common
title = ( '(' default+ >A %{ STORE(title) } :> ')' ) ;
title = ( '(' default+ >A %{ STORE("title"); } :> ')' ) ;
word = ( alnum | safe | " " ) ;
mspace = ( ( " " | "\t" | LF )+ ) -- LF{2} ;
mtext = ( chars (mspace chars)* ) ;
Expand Down

0 comments on commit 4ed164e

Please sign in to comment.