Ruby 1.9 Compatibility of Vendored Syntax Library

The CSS language support of the syntax
colourer was broken under Ruby 1.9
This commit is contained in:
Jacques Distler 2009-12-25 03:17:06 -06:00
parent 3ab7327cea
commit f06e6c004b

View file

@ -1,4 +1,5 @@
require 'syntax' require 'syntax'
require 'stringsupport'
module Syntax module Syntax
@ -77,7 +78,7 @@ module Syntax
# http://www.w3.org/TR/CSS21/syndata.html # http://www.w3.org/TR/CSS21/syndata.html
macro(:h, /([0-9a-fA-F])/ ) # uppercase A-Z added? macro(:h, /([0-9a-fA-F])/ ) # uppercase A-Z added?
macro(:nonascii, /([\200-\377])/ ) macro(:nonascii, /([^\000-\177])/ )
macro(:nl, /(\n|\r\n|\r|\f)/ ) macro(:nl, /(\n|\r\n|\r|\f)/ )
macro(:unicode, /(\\#{m(:h)}{1,6}(\r\n|[ \t\r\n\f])?)/ ) macro(:unicode, /(\\#{m(:h)}{1,6}(\r\n|[ \t\r\n\f])?)/ )
macro(:escape, /(#{m(:unicode)}|\\[^\r\n\f0-9a-f])/ ) macro(:escape, /(#{m(:unicode)}|\\[^\r\n\f0-9a-f])/ )
@ -208,7 +209,8 @@ module Syntax
end end
# scanning declarations only # scanning declarations only
when !@selector && scan(@tokens[:RBRACE]): @selector = true when !@selector && scan(@tokens[:RBRACE])
@selector = true
start_group :normal, matched start_group :normal, matched
when !@selector && scan(@tokens[:FUNCTION]) when !@selector && scan(@tokens[:FUNCTION])
start_group :function, matched start_group :function, matched