diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-07-14 02:49:16 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-07-14 02:49:16 +0200 |
commit | bf395bd14ed7f63aab84955f6768f59965e3a73e (patch) | |
tree | 870e3ee4980401f43c2dc9a34d2e8343ef3a20ca /lib/coderay/tokens.rb | |
parent | ffe0c90999c0b7255a5dfc608c84e683440475b1 (diff) | |
parent | 7493dcbfded42686169027a158c18c5312a3af24 (diff) | |
download | coderay-bf395bd14ed7f63aab84955f6768f59965e3a73e.tar.gz |
Merge branch 'master' into cleanup-output
Diffstat (limited to 'lib/coderay/tokens.rb')
-rw-r--r-- | lib/coderay/tokens.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb index 54358d4..e7bffce 100644 --- a/lib/coderay/tokens.rb +++ b/lib/coderay/tokens.rb @@ -3,17 +3,16 @@ module CodeRay # The Tokens class represents a list of tokens returned from # a Scanner. It's actually just an Array with a few helper methods. # - # A token itself is not a special object, just a two-element Array - # consisting of + # A token itself is not a special object, just two elements in an Array: # * the _token_ _text_ (the original source of the token in a String) or # a _token_ _action_ (begin_group, end_group, begin_line, end_line) # * the _token_ _kind_ (a Symbol representing the type of the token) # # It looks like this: # - # ['# It looks like this', :comment] - # ['3.1415926', :float] - # ['$^', :error] + # ..., '# It looks like this', :comment, ... + # ..., '3.1415926', :float, ... + # ..., '$^', :error, ... # # Some scanners also yield sub-tokens, represented by special # token actions, for example :begin_group and :end_group. @@ -21,11 +20,11 @@ module CodeRay # The Ruby scanner, for example, splits "a string" into: # # [ - # [:begin_group, :string], - # ['"', :delimiter], - # ['a string', :content], - # ['"', :delimiter], - # [:end_group, :string] + # :begin_group, :string, + # '"', :delimiter, + # 'a string', :content, + # '"', :delimiter, + # :end_group, :string # ] # # Tokens can be used to save the output of a Scanners in a simple |