Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a pure-ruby version of the parser for times when you can't comp…
…ile the C or Java extensions. You should avoid using it if at all possible because it is 32 times slower (and has some other problems, too)! Squashed commit of the following: commit d82359a74e543a6c25f5783983926c117045e0bb Author: Jason Garber <jg@jasongarber.com> Date: Mon Mar 16 14:44:20 2009 -0400 Update with best code style for pureruby (result of optimization was F1) commit aa01f61fb075a50d44c29f0831c6b2cb3ee90bee Author: Jason Garber <jg@jasongarber.com> Date: Mon Mar 16 13:17:32 2009 -0400 Fix latex double-escaping some characters in pureruby parser commit 7a09a7c25b2087d9b6f658b3d57443668cc41ef8 Author: Jason Garber <jg@jasongarber.com> Date: Mon Mar 16 09:08:08 2009 -0400 Update profiler so rake pureruby optimize works commit ffd93efc1228be4e245bde536518f60bd47aa6be Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 12:26:46 2009 -0400 cleanup unneeded eof variable commit dc1b0f89d1ff868c285ad1d0eaa2e494757950ea Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 11:46:30 2009 -0400 Fix custom tag fallback commit e10c378f57a232915efc42f8d78859aae55b7a0a Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 11:35:41 2009 -0400 Fixed attributes getting escaped multiple times because of passing by reference commit 20c50513f521299d1917fcefa7fb2aaaf149117e Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 11:13:12 2009 -0400 fix list continuation (hope JRuby works; can't test from this machine) commit 5000560e28945910d41b580bd3bb01fb75167536 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 10:31:03 2009 -0400 Fix attribute parser running the wrong machine commit 71d7f9d1c0fcd654b39c41de3a341e8f6d95c400 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 10:12:03 2009 -0400 Fix TRANSFORM macro commit 9824be7410ef9224c80227105059e732f9a908a3 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 10:02:42 2009 -0400 Fixed comparison error when @reg was not set commit 0f32766aa906bad9514198eab9694cee369d7cd5 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 09:43:56 2009 -0400 Fix backup attributes not being set in regs properly. commit 65a45406a8b81b2be5c43b8fb172b6129214e9d4 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 09:16:07 2009 -0400 Fixed definition lists commit 8441dc220d351264f6f7357eb681402d17d4e0fe Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 08:55:35 2009 -0400 Fix capture of title/alt commit c6b44a228c5d248e91fefa61da7da350279d10a3 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 08:27:59 2009 -0400 Fix ignore action commit 091fb62632ce21ef75fbd3575a185c7427461aa8 Author: Jason Garber <jg@jasongarber.com> Date: Sun Mar 15 03:04:35 2009 -0400 Fixed lists and lookaheads, among other things. commit 6d38837050d593db29d40d059e884ea3e0fd5b21 Author: Jason Garber <jg@jasongarber.com> Date: Fri Mar 13 16:41:20 2009 -0400 Fix it up just a bit. commit 96a54a7188c73c670d11e75e4177de4a39e944bb Author: Jason Garber <jg@jasongarber.com> Date: Fri Mar 13 15:36:27 2009 -0400 Switch back to instances, but with class methods for invoking. Nearly working now. commit 2437f528ffc5ca1f30f9774c2c8fe025e6216468 Author: Jason Garber <jg@jasongarber.com> Date: Thu Mar 12 17:16:34 2009 -0400 Converted scanners to class methods & class variables. Nearly works. commit 3d7c554e7cfca60c7f7a1fcc69b1cbfce54038d6 Author: Jason Garber <jg@jasongarber.com> Date: Thu Mar 12 14:32:51 2009 -0400 Almost working. Maybe should convert them to class methods, though. commit c375474f4f2773458cb0b4b50c6ea5c3a49cca71 Author: Jason Garber <jg@jasongarber.com> Date: Tue Mar 10 16:42:32 2009 -0400 Convert the rest to ruby and hook lots of things up. Still not working, though. commit 1b379c147b0b90aa314117014308f3d215b1c3b0 Author: Jason Garber <jg@jasongarber.com> Date: Mon Mar 9 12:32:53 2009 -0400 wip commit 3393bb4a9a0e59cb2455f68844e93b9ec4ba82b2 Author: Jason Garber <jg@jasongarber.com> Date: Mon Mar 9 09:31:47 2009 -0400 wip (15 minutes) commit ebfbe336bff92ec85fa7d7a5602f4670b5598606 Author: Jason Garber <jg@jasongarber.com> Date: Fri Mar 6 08:22:50 2009 -0500 Add files that were missing before. WIP on parser macros. (15 min) commit e7a92338f3c2417b763bb9f8c8e75a733bb453f7 Author: Jason Garber <jg@jasongarber.com> Date: Fri Mar 6 08:10:46 2009 -0500 Converted everything to pure Ruby. Haven't tested yet, though. (100 minutes)
- Loading branch information
Showing
21 changed files
with
775 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# | ||
# redcloth_attributes.rb.rl | ||
# | ||
# Copyright (C) 2009 Jason Garber | ||
# | ||
|
||
%%{ | ||
|
||
machine redcloth_attributes; | ||
include redcloth_common "redcloth_common.rb.rl"; | ||
include redcloth_attributes "redcloth_attributes.rl"; | ||
|
||
}%% | ||
|
||
module RedCloth | ||
class RedclothAttributes < BaseScanner | ||
def self.redcloth_attributes(str) | ||
self.new.redcloth_attributes(str) | ||
end | ||
|
||
def self.redcloth_link_attributes(str) | ||
self.new.redcloth_link_attributes(str) | ||
end | ||
|
||
def redcloth_attribute_parser(cs, data) | ||
@data = data + "\0" | ||
@regs = {} | ||
@p = 0 | ||
@pe = @data.length | ||
|
||
%% write init; #% | ||
|
||
@cs = cs | ||
|
||
%% write exec; #% | ||
|
||
return @regs | ||
end | ||
|
||
def redcloth_attributes(str) | ||
self.cs = self.redcloth_attributes_en_inline | ||
return redcloth_attribute_parser(cs, str) | ||
end | ||
|
||
def redcloth_link_attributes(str) | ||
self.cs = self.redcloth_attributes_en_link_says; | ||
return redcloth_attribute_parser(cs, str) | ||
end | ||
|
||
def initialize | ||
%%{ | ||
variable data @data; | ||
variable p @p; | ||
variable pe @pe; | ||
variable cs @cs; | ||
variable ts @ts; | ||
variable te @te; | ||
|
||
write data nofinal; | ||
}%% | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
%%{ | ||
|
||
machine redcloth_common; | ||
include redcloth_common "redcloth_common.rl"; | ||
|
||
action esc { rb_str_cat_escaped(@block, @ts, @te); } | ||
action esc_pre { rb_str_cat_escaped_for_preformatted(@block, STR_NEW(@ts, @te-@ts)); } | ||
action ignore { @block << @textile_doc.ignore(@regs); } | ||
|
||
# conditionals | ||
action starts_line { | ||
@p == 0 || @data[(@p-1), 1] == "\r" || @data[(@p-1), 1] == "\n" || @data[(@p-1), 1] == "\f" | ||
} | ||
action starts_phrase { | ||
@p == 0 || @data[(@p-1), 1] == "\r" || @data[(@p-1), 1] == "\n" || @data[(@p-1), 1] == "\f" || @data[(@p-1), 1] == " " | ||
} | ||
action extended { !@extend.nil? } | ||
action not_extended { @extend.nil? } | ||
|
||
}%%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.