Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new token kind "id" and use it for css id's (surprise) #27

Merged
merged 3 commits into from Jun 11, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion etc/todo/scanners/css.rb
Expand Up @@ -114,7 +114,7 @@ def scan_tokens tokens, options
kind = :class

elsif scan RE::Id
kind = :constant
kind = :id

elsif scan RE::Ident
kind = :label
Expand Down
10 changes: 5 additions & 5 deletions lib/coderay/scanners/css.rb
Expand Up @@ -7,8 +7,8 @@ class CSS < Scanner

KINDS_NOT_LOC = [
:comment,
:class, :pseudo_class, :type,
:constant, :directive,
:class, :pseudo_class, :tag,
:id, :directive,
:key, :value, :operator, :color, :float, :string,
:error, :important,
] # :nodoc:
Expand Down Expand Up @@ -67,13 +67,13 @@ def scan_tokens encoder, options
elsif case states.last
when :initial, :media
if match = scan(/(?>#{RE::Ident})(?!\()|\*/ox)
encoder.text_token match, :type
encoder.text_token match, :tag
next
elsif match = scan(RE::Class)
encoder.text_token match, :class
next
elsif match = scan(RE::Id)
encoder.text_token match, :constant
encoder.text_token match, :id
next
elsif match = scan(RE::PseudoClass)
encoder.text_token match, :pseudo_class
Expand Down Expand Up @@ -102,7 +102,7 @@ def scan_tokens encoder, options

when :media_before_name
if match = scan(RE::Ident)
encoder.text_token match, :type
encoder.text_token match, :tag
states[-1] = :media_after_name
next
end
Expand Down
1 change: 1 addition & 0 deletions lib/coderay/token_kinds.rb
Expand Up @@ -39,6 +39,7 @@ module CodeRay
:function => 'function',
:global_variable => 'global-variable',
:hex => 'hex',
:id => 'id',
:imaginary => 'imaginary',
:important => 'important',
:include => 'include',
Expand Down