aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-08-29 14:55:33 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-08-29 14:56:00 +0100
commite57fa3d276d700ea21c97f8c2d3731f0f9d4c7ab (patch)
tree1c9e555bde2d3b1a2007841f02ae62b3c3520b37 /vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb
parent3084034493a428b2394a59b68921ed4b73a8cf7e (diff)
parentb4aefe5a69bbd492959931f1c577a028ec361993 (diff)
Attempt to merge current develop to theme
Diffstat (limited to 'vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb')
-rw-r--r--vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb b/vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb
new file mode 100644
index 000000000..0a1eb9130
--- /dev/null
+++ b/vendor/gems/rdoc-2.4.3/lib/rdoc/tokenstream.rb
@@ -0,0 +1,33 @@
+module RDoc; end
+
+##
+# A TokenStream is a list of tokens, gathered during the parse of some entity
+# (say a method). Entities populate these streams by being registered with the
+# lexer. Any class can collect tokens by including TokenStream. From the
+# outside, you use such an object by calling the start_collecting_tokens
+# method, followed by calls to add_token and pop_token.
+
+module RDoc::TokenStream
+
+ def token_stream
+ @token_stream
+ end
+
+ def start_collecting_tokens
+ @token_stream = []
+ end
+
+ def add_token(tk)
+ @token_stream << tk
+ end
+
+ def add_tokens(tks)
+ tks.each {|tk| add_token(tk)}
+ end
+
+ def pop_token
+ @token_stream.pop
+ end
+
+end
+