diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-23 01:10:06 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-23 01:10:06 +0200 |
commit | 492dd5968be468db8d152edb6a525b8aee182632 (patch) | |
tree | 64eddda6c3afedbb054413a98eb17d6e5ed90dec /lib/coderay | |
parent | da1425058e9b9e04bd988ddf606331d9cd0c827b (diff) | |
parent | 546b489e4b3856d361a480de5f1f02cb55c7f002 (diff) | |
download | coderay-492dd5968be468db8d152edb6a525b8aee182632.tar.gz |
Merge branch 'master' into lua-scanner
Diffstat (limited to 'lib/coderay')
-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 |