Skip to content

Commit

Permalink
lib/lingo/attendee/tokenizer.rb (tokenize): [MINOR] Use "last match" …
Browse files Browse the repository at this point in the history
…variable instead of indexing into MatchData.
  • Loading branch information
blackwinter committed Apr 19, 2012
1 parent 9de597f commit 95d7f5c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/lingo/attendee/tokenizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,36 +161,36 @@ def tokenize(textline)
case @cont
when 'HTML'
if textline =~ /^[^<>]*>/
yield $~[0], @cont
yield $&, @cont
textline, @cont = $', nil
else
yield textline, @cont
return
end
when 'WIKI'
if textline =~ /^[^\[\]]*\]\]/
yield $~[0], @cont
yield $&, @cont
textline, @cont = $', nil
else
yield textline, @cont
return
end
when nil
if !@tags && textline =~ /<[^<>]*$/
yield $~[0], @cont = 'HTML'
yield $&, @cont = 'HTML'
textline = $`
end

if !@wiki && textline =~ /\[\[[^\[\]]*$/
yield $~[0], @cont = 'WIKI'
yield $&, @cont = 'WIKI'
textline = $`
end
end

until textline.empty?
@rules.each { |name, expr|
if textline =~ expr
yield $~[0], name if name != 'SPAC' || @space
yield $&, name if name != 'SPAC' || @space
textline = $'
break
end
Expand Down

0 comments on commit 95d7f5c

Please sign in to comment.