From 9be25abef4e3feb6dfeb06f6efd4eb2254806cbd Mon Sep 17 00:00:00 2001
From: murphy
Date: Tue, 17 Oct 2006 09:19:09 +0000
Subject: Renamed tests: .actual.* is (ignored) output, .expected.* is input
now. Added test:clean task.
---
test/scanners/ruby/example.expected.raydebug | 3789 ++++++++++++++++++++++++++
1 file changed, 3789 insertions(+)
create mode 100644 test/scanners/ruby/example.expected.raydebug
(limited to 'test/scanners/ruby/example.expected.raydebug')
diff --git a/test/scanners/ruby/example.expected.raydebug b/test/scanners/ruby/example.expected.raydebug
new file mode 100644
index 0000000..be68a13
--- /dev/null
+++ b/test/scanners/ruby/example.expected.raydebug
@@ -0,0 +1,3789 @@
+reserved(module) class(CodeRay)
+ reserved(module) class(Scanners)
+
+reserved(class) class(Ruby) operator(<) constant(Scanner)
+
+ constant(RESERVED_WORDS) operator(=) operator([)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ stringoperator(,) stringoperator(,)
+ operator(])
+
+ constant(DEF_KEYWORDS) operator(=) operator([)stringoperator(])
+ constant(MODULE_KEYWORDS) operator(=) operator([)stringoperator(,) stringoperator(])
+ constant(DEF_NEW_STATE) operator(=) constant(WordList)operator(.)ident(new)operator(()symbol(:initial)operator(\))operator(.)
+ ident(add)operator(()constant(DEF_KEYWORDS)operator(,) symbol(:def_expected)operator(\))operator(.)
+ ident(add)operator(()constant(MODULE_KEYWORDS)operator(,) symbol(:module_expected)operator(\))
+
+ constant(WORDS_ALLOWING_REGEXP) operator(=) operator([)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) string
+ operator(])
+ constant(REGEXP_ALLOWED) operator(=) constant(WordList)operator(.)ident(new)operator(()pre_constant(false)operator(\))operator(.)
+ ident(add)operator(()constant(WORDS_ALLOWING_REGEXP)operator(,) symbol(:set)operator(\))
+
+ constant(PREDEFINED_CONSTANTS) operator(=) operator([)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,) stringoperator(,)
+ operator(])
+
+ constant(IDENT_KIND) operator(=) constant(WordList)operator(.)ident(new)operator(()symbol(:ident)operator(\))operator(.)
+ ident(add)operator(()constant(RESERVED_WORDS)operator(,) symbol(:reserved)operator(\))operator(.)
+ ident(add)operator(()constant(PREDEFINED_CONSTANTS)operator(,) symbol(:pre_constant)operator(\))
+
+ constant(METHOD_NAME) operator(=) regexpcontent( [?!]? )delimiter(/)modifier(xo)>
+ constant(METHOD_NAME_EX) operator(=) regexpcontent( # common methods: split, foo=, empty?, gsub!
+ | )char(\\*)char(\\*)content(? # multiplication and power
+ | [-+~]@? # plus, minus
+ | [)char(\\/)content(%&|^`] # division, modulo or format strings, &and, |or, ^xor, `system`
+ | )char(\\[)char(\\])content(=? # array getter and setter
+ | <=?>? | >=? # comparison, rocket operator
+ | << | >> # append or shift left, shift right
+ | ===? # simple equality and case equality
+ )delimiter(/)modifier(ox)>
+ constant(GLOBAL_VARIABLE) operator(=) regexpcontent( | )char(\\d)content(+ | [~&+`'=)char(\\/)content(,;_.<>!@0$?*":F)char(\\\\)content(] | -[a-zA-Z_0-9] \) )delimiter(/)modifier(ox)>
+
+ constant(DOUBLEQ) operator(=) regexp
+ constant(SINGLEQ) operator(=) regexp
+ constant(STRING) operator(=) regexpcontent( | )inlinecontent( )delimiter(/)modifier(ox)>
+ constant(SHELL) operator(=) regexp
+ constant(REGEXP) operator(=) regexp
+
+ constant(DECIMAL) operator(=) regexp comment(# doesn't recognize 09 as octal error)
+ constant(OCTAL) operator(=) regexp
+ constant(HEXADECIMAL) operator(=) regexp
+ constant(BINARY) operator(=) regexp
+
+ constant(EXPONENT) operator(=) regexpcontent( )delimiter(/)modifier(ox)>
+ constant(FLOAT) operator(=) regexpcontent( (?: )inlinecontent( | )char(\\.)content( )inlinecontent( )inlinecontent(? \) )delimiter(/)>
+ constant(INTEGER) operator(=) regexpcontent(|)inlinecontent(|)inlinecontent(|)inlinedelimiter(/)>
+
+ reserved(def) method(reset)
+ reserved(super)
+ instance_variable(@regexp_allowed) operator(=) pre_constant(false)
+ reserved(end)
+
+ reserved(def) method(next_token)
+ reserved(return) reserved(if) instance_variable(@scanner)operator(.)ident(eos?)
+
+ ident(kind) operator(=) symbol(:error)
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\)) comment(# in every state)
+ ident(kind) operator(=) symbol(:space)
+ instance_variable(@regexp_allowed) operator(=) symbol(:set) reserved(if) instance_variable(@regexp_allowed) reserved(or) instance_variable(@scanner)operator(.)ident(matched)operator(.)ident(index)operator(()integer(?\\n)operator(\)) comment(# delayed flag setting)
+
+ reserved(elsif) instance_variable(@state) operator(==) symbol(:def_expected)
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpcontent((?:)char(\\.)content(|::\)\)* | (?:@@?|$\)? )inlinecontent((?:)char(\\.)content(|::\) \) )inlinecontent( )delimiter(/)modifier(ox)>operator(\))
+ ident(kind) operator(=) symbol(:method)
+ instance_variable(@state) operator(=) symbol(:initial)
+ reserved(else)
+ instance_variable(@scanner)operator(.)ident(getch)
+ reserved(end)
+ instance_variable(@state) operator(=) symbol(:initial)
+
+ reserved(elsif) instance_variable(@state) operator(==) symbol(:module_expected)
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(kind) operator(=) symbol(:operator)
+ reserved(else)
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpcontent( (?:)char(\\.)content(|::\)\)* )inlinecontent( )delimiter(/)modifier(ox)>operator(\))
+ ident(kind) operator(=) symbol(:method)
+ reserved(else)
+ instance_variable(@scanner)operator(.)ident(getch)
+ reserved(end)
+ instance_variable(@state) operator(=) symbol(:initial)
+ reserved(end)
+
+ reserved(elsif) comment(# state == :initial)
+ comment(# IDENTIFIERS, KEYWORDS)
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(GLOBAL_VARIABLE)operator(\))
+ ident(kind) operator(=) symbol(:global_variable)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpcontent( )delimiter(/)modifier(ox)>operator(\))
+ ident(kind) operator(=) symbol(:class_variable)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpcontent( )delimiter(/)modifier(ox)>operator(\))
+ ident(kind) operator(=) symbol(:instance_variable)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(kind) operator(=) symbol(:comment)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(METHOD_NAME)operator(\))
+ reserved(if) instance_variable(@last_token_dot)
+ ident(kind) operator(=) symbol(:ident)
+ reserved(else)
+ ident(matched) operator(=) instance_variable(@scanner)operator(.)ident(matched)
+ ident(kind) operator(=) constant(IDENT_KIND)operator([)ident(matched)operator(])
+ reserved(if) ident(kind) operator(==) symbol(:ident) reserved(and) ident(matched) operator(=)operator(~) regexp
+ ident(kind) operator(=) symbol(:constant)
+ reserved(elsif) ident(kind) operator(==) symbol(:reserved)
+ instance_variable(@state) operator(=) constant(DEF_NEW_STATE)operator([)ident(matched)operator(])
+ instance_variable(@regexp_allowed) operator(=) constant(REGEXP_ALLOWED)operator([)ident(matched)operator(])
+ reserved(end)
+ reserved(end)
+
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(STRING)operator(\))
+ ident(kind) operator(=) symbol(:string)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(SHELL)operator(\))
+ ident(kind) operator(=) symbol(:shell)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(kind) operator(=) symbol(:string)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\)) reserved(and) instance_variable(@regexp_allowed)
+ instance_variable(@scanner)operator(.)ident(unscan)
+ instance_variable(@scanner)operator(.)ident(scan)operator(()constant(REGEXP)operator(\))
+ ident(kind) operator(=) symbol(:regexp)
+regexp#)char(\\\\)char(\\\\)content(]*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)[^>#)char(\\\\)char(\\\\)content(]*\)*>?|([^a-zA-Z)char(\\\\)char(\\\\)content(]\)(?:(?!)char(\\1)content(\)[^#)char(\\\\)char(\\\\)content(]\)*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)(?:(?!)char(\\1)content(\)[^#)char(\\\\)char(\\\\)content(]\)*\)*)char(\\1)content(?\)|)char(\\()content([^\)#)char(\\\\)char(\\\\)content(]*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)[^\)#)char(\\\\)char(\\\\)content(]*\)*)char(\\\))content(?|)char(\\[)content([^)char(\\])content(#)char(\\\\)char(\\\\)content(]*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)[^)char(\\])content(#)char(\\\\)char(\\\\)content(]*\)*)char(\\])content(?|)char(\\{)content([^}#)char(\\\\)char(\\\\)content(]*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)[^}#)char(\\\\)char(\\\\)content(]*\)*)char(\\})content(?|<[^>#)char(\\\\)char(\\\\)content(]*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)[^>#)char(\\\\)char(\\\\)content(]*\)*>?|([^a-zA-Z)char(\\s)char(\\\\)char(\\\\)content(]\)(?:(?!)char(\\2)content(\)[^#)char(\\\\)char(\\\\)content(]\)*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#|)char(\\\\)char(\\\\)content(.\)(?:(?!)char(\\2)content(\)[^#)char(\\\\)char(\\\\)content(]\)*\)*)char(\\2)content(?|)char(\\\\)char(\\\\)content([^#)char(\\\\)char(\\\\)content(]*(?:(?:#)char(\\{)content(.*?)char(\\})content(|#\)[^#)char(\\\\)char(\\\\)content(]*\)*)char(\\\\)char(\\\\)content(?\))delimiter(/)>
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpcontent(|)inlinecontent(|)inlinecontent(\))delimiter(/)modifier(ox)>operator(\))
+ ident(kind) operator(=) symbol(:symbol)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(kind) operator(=) symbol(:integer)
+
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()regexp;,|&!(\))char(\\[)char(\\])content({}~?] | )char(\\.)char(\\.)content(?)char(\\.)content(? | ::? )delimiter(/)modifier(x)>operator(\))
+ ident(kind) operator(=) symbol(:operator)
+ instance_variable(@regexp_allowed) operator(=) symbol(:set) reserved(if) instance_variable(@scanner)operator(.)ident(matched)operator([)integer(-1)operator(,)integer(1)operator(]) operator(=)operator(~) regexp|&^,)char(\\()char(\\[)content(+)char(\\-)char(\\/)char(\\*)content(%])char(\\z)delimiter(/)>
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(FLOAT)operator(\))
+ ident(kind) operator(=) symbol(:float)
+ reserved(elsif) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(INTEGER)operator(\))
+ ident(kind) operator(=) symbol(:integer)
+ reserved(else)
+ instance_variable(@scanner)operator(.)ident(getch)
+ reserved(end)
+ reserved(end)
+
+ ident(token) operator(=) constant(Token)operator(.)ident(new) instance_variable(@scanner)operator(.)ident(matched)operator(,) ident(kind)
+
+ reserved(if) ident(kind) operator(==) symbol(:regexp)
+ ident(token)operator(.)ident(text) operator(<<) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ reserved(end)
+
+ instance_variable(@regexp_allowed) operator(=) operator(()instance_variable(@regexp_allowed) operator(==) symbol(:set)operator(\)) comment(# delayed flag setting)
+
+ ident(token)
+ reserved(end)
+reserved(end)
+
+ident(register) constant(Ruby)operator(,) stringoperator(,) string
+
+ reserved(end)
+reserved(end)
+reserved(class) class(Set)
+ ident(include) constant(Enumerable)
+
+ comment(# Creates a new set containing the given objects.)
+ reserved(def) pre_constant(self)operator(.)operator([])operator(()operator(*)ident(ary)operator(\))
+ ident(new)operator(()ident(ary)operator(\))
+ reserved(end)
+
+ comment(# Creates a new set containing the elements of the given enumerable)
+ comment(# object.)
+ comment(#)
+ comment(# If a block is given, the elements of enum are preprocessed by the)
+ comment(# given block.)
+ reserved(def) method(initialize)operator(()ident(enum) operator(=) pre_constant(nil)operator(,) operator(&)ident(block)operator(\)) comment(# :yields: o)
+ instance_variable(@hash) operator(||=) constant(Hash)operator(.)ident(new)
+
+ ident(enum)operator(.)ident(nil?) reserved(and) reserved(return)
+
+ reserved(if) ident(block)
+ ident(enum)operator(.)ident(each) operator({) operator(|)ident(o)operator(|) ident(add)operator(()ident(block)operator([)ident(o)operator(])operator(\)) operator(})
+ reserved(else)
+ ident(merge)operator(()ident(enum)operator(\))
+ reserved(end)
+ reserved(end)
+
+ comment(# Copy internal hash.)
+ reserved(def) method(initialize_copy)operator(()ident(orig)operator(\))
+ instance_variable(@hash) operator(=) ident(orig)operator(.)ident(instance_eval)operator({)instance_variable(@hash)operator(})operator(.)ident(dup)
+ reserved(end)
+
+ comment(# Returns the number of elements.)
+ reserved(def) method(size)
+ instance_variable(@hash)operator(.)ident(size)
+ reserved(end)
+ reserved(alias) ident(length) ident(size)
+
+ comment(# Returns true if the set contains no elements.)
+ reserved(def) method(empty?)
+ instance_variable(@hash)operator(.)ident(empty?)
+ reserved(end)
+
+ comment(# Removes all elements and returns self.)
+ reserved(def) method(clear)
+ instance_variable(@hash)operator(.)ident(clear)
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Replaces the contents of the set with the contents of the given)
+ comment(# enumerable object and returns self.)
+ reserved(def) method(replace)operator(()ident(enum)operator(\))
+ reserved(if) ident(enum)operator(.)ident(class) operator(==) pre_constant(self)operator(.)ident(class)
+ instance_variable(@hash)operator(.)ident(replace)operator(()ident(enum)operator(.)ident(instance_eval) operator({) instance_variable(@hash) operator(})operator(\))
+ reserved(else)
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(clear)
+ ident(enum)operator(.)ident(each) operator({) operator(|)ident(o)operator(|) ident(add)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Converts the set to an array. The order of elements is uncertain.)
+ reserved(def) method(to_a)
+ instance_variable(@hash)operator(.)ident(keys)
+ reserved(end)
+
+ reserved(def) method(flatten_merge)operator(()ident(set)operator(,) ident(seen) operator(=) constant(Set)operator(.)ident(new)operator(\))
+ ident(set)operator(.)ident(each) operator({) operator(|)ident(e)operator(|)
+ reserved(if) ident(e)operator(.)ident(is_a?)operator(()constant(Set)operator(\))
+ reserved(if) ident(seen)operator(.)ident(include?)operator(()ident(e_id) operator(=) ident(e)operator(.)ident(object_id)operator(\))
+ ident(raise) constant(ArgumentError)operator(,) string
+ reserved(end)
+
+ ident(seen)operator(.)ident(add)operator(()ident(e_id)operator(\))
+ ident(flatten_merge)operator(()ident(e)operator(,) ident(seen)operator(\))
+ ident(seen)operator(.)ident(delete)operator(()ident(e_id)operator(\))
+ reserved(else)
+ ident(add)operator(()ident(e)operator(\))
+ reserved(end)
+ operator(})
+
+ pre_constant(self)
+ reserved(end)
+ ident(protected) symbol(:flatten_merge)
+
+ comment(# Returns a new set that is a copy of the set, flattening each)
+ comment(# containing set recursively.)
+ reserved(def) method(flatten)
+ pre_constant(self)operator(.)ident(class)operator(.)ident(new)operator(.)ident(flatten_merge)operator(()pre_constant(self)operator(\))
+ reserved(end)
+
+ comment(# Equivalent to Set#flatten, but replaces the receiver with the)
+ comment(# result in place. Returns nil if no modifications were made.)
+ reserved(def) method(flatten!)
+ reserved(if) ident(detect) operator({) operator(|)ident(e)operator(|) ident(e)operator(.)ident(is_a?)operator(()constant(Set)operator(\)) operator(})
+ ident(replace)operator(()ident(flatten)operator(()operator(\))operator(\))
+ reserved(else)
+ pre_constant(nil)
+ reserved(end)
+ reserved(end)
+
+ comment(# Returns true if the set contains the given object.)
+ reserved(def) method(include?)operator(()ident(o)operator(\))
+ instance_variable(@hash)operator(.)ident(include?)operator(()ident(o)operator(\))
+ reserved(end)
+ reserved(alias) ident(member?) ident(include?)
+
+ comment(# Returns true if the set is a superset of the given set.)
+ reserved(def) method(superset?)operator(()ident(set)operator(\))
+ ident(set)operator(.)ident(is_a?)operator(()constant(Set)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ reserved(return) pre_constant(false) reserved(if) ident(size) operator(<) ident(set)operator(.)ident(size)
+ ident(set)operator(.)ident(all?) operator({) operator(|)ident(o)operator(|) ident(include?)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ comment(# Returns true if the set is a proper superset of the given set.)
+ reserved(def) method(proper_superset?)operator(()ident(set)operator(\))
+ ident(set)operator(.)ident(is_a?)operator(()constant(Set)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ reserved(return) pre_constant(false) reserved(if) ident(size) operator(<=) ident(set)operator(.)ident(size)
+ ident(set)operator(.)ident(all?) operator({) operator(|)ident(o)operator(|) ident(include?)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ comment(# Returns true if the set is a subset of the given set.)
+ reserved(def) method(subset?)operator(()ident(set)operator(\))
+ ident(set)operator(.)ident(is_a?)operator(()constant(Set)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ reserved(return) pre_constant(false) reserved(if) ident(set)operator(.)ident(size) operator(<) ident(size)
+ ident(all?) operator({) operator(|)ident(o)operator(|) ident(set)operator(.)ident(include?)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ comment(# Returns true if the set is a proper subset of the given set.)
+ reserved(def) method(proper_subset?)operator(()ident(set)operator(\))
+ ident(set)operator(.)ident(is_a?)operator(()constant(Set)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ reserved(return) pre_constant(false) reserved(if) ident(set)operator(.)ident(size) operator(<=) ident(size)
+ ident(all?) operator({) operator(|)ident(o)operator(|) ident(set)operator(.)ident(include?)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ comment(# Calls the given block once for each element in the set, passing)
+ comment(# the element as parameter.)
+ reserved(def) method(each)
+ instance_variable(@hash)operator(.)ident(each_key) operator({) operator(|)ident(o)operator(|) reserved(yield)operator(()ident(o)operator(\)) operator(})
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Adds the given object to the set and returns self. Use +merge+ to)
+ comment(# add several elements at once.)
+ reserved(def) method(add)operator(()ident(o)operator(\))
+ instance_variable(@hash)operator([)ident(o)operator(]) operator(=) pre_constant(true)
+ pre_constant(self)
+ reserved(end)
+ reserved(alias) operator(<<) ident(add)
+
+ comment(# Adds the given object to the set and returns self. If the)
+ comment(# object is already in the set, returns nil.)
+ reserved(def) method(add?)operator(()ident(o)operator(\))
+ reserved(if) ident(include?)operator(()ident(o)operator(\))
+ pre_constant(nil)
+ reserved(else)
+ ident(add)operator(()ident(o)operator(\))
+ reserved(end)
+ reserved(end)
+
+ comment(# Deletes the given object from the set and returns self. Use +subtract+ to)
+ comment(# delete several items at once.)
+ reserved(def) method(delete)operator(()ident(o)operator(\))
+ instance_variable(@hash)operator(.)ident(delete)operator(()ident(o)operator(\))
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Deletes the given object from the set and returns self. If the)
+ comment(# object is not in the set, returns nil.)
+ reserved(def) method(delete?)operator(()ident(o)operator(\))
+ reserved(if) ident(include?)operator(()ident(o)operator(\))
+ ident(delete)operator(()ident(o)operator(\))
+ reserved(else)
+ pre_constant(nil)
+ reserved(end)
+ reserved(end)
+
+ comment(# Deletes every element of the set for which block evaluates to)
+ comment(# true, and returns self.)
+ reserved(def) method(delete_if)
+ instance_variable(@hash)operator(.)ident(delete_if) operator({) operator(|)ident(o)operator(,)operator(|) reserved(yield)operator(()ident(o)operator(\)) operator(})
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Do collect(\) destructively.)
+ reserved(def) method(collect!)
+ ident(set) operator(=) pre_constant(self)operator(.)ident(class)operator(.)ident(new)
+ ident(each) operator({) operator(|)ident(o)operator(|) ident(set) operator(<<) reserved(yield)operator(()ident(o)operator(\)) operator(})
+ ident(replace)operator(()ident(set)operator(\))
+ reserved(end)
+ reserved(alias) ident(map!) ident(collect!)
+
+ comment(# Equivalent to Set#delete_if, but returns nil if no changes were)
+ comment(# made.)
+ reserved(def) method(reject!)
+ ident(n) operator(=) ident(size)
+ ident(delete_if) operator({) operator(|)ident(o)operator(|) reserved(yield)operator(()ident(o)operator(\)) operator(})
+ ident(size) operator(==) ident(n) operator(?) pre_constant(nil) operator(:) pre_constant(self)
+ reserved(end)
+
+ comment(# Merges the elements of the given enumerable object to the set and)
+ comment(# returns self.)
+ reserved(def) method(merge)operator(()ident(enum)operator(\))
+ reserved(if) ident(enum)operator(.)ident(is_a?)operator(()constant(Set)operator(\))
+ instance_variable(@hash)operator(.)ident(update)operator(()ident(enum)operator(.)ident(instance_eval) operator({) instance_variable(@hash) operator(})operator(\))
+ reserved(else)
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(enum)operator(.)ident(each) operator({) operator(|)ident(o)operator(|) ident(add)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Deletes every element that appears in the given enumerable object)
+ comment(# and returns self.)
+ reserved(def) method(subtract)operator(()ident(enum)operator(\))
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(enum)operator(.)ident(each) operator({) operator(|)ident(o)operator(|) ident(delete)operator(()ident(o)operator(\)) operator(})
+ pre_constant(self)
+ reserved(end)
+
+ comment(# Returns a new set built by merging the set and the elements of the)
+ comment(# given enumerable object.)
+ reserved(def) method(|)operator(()ident(enum)operator(\))
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(dup)operator(.)ident(merge)operator(()ident(enum)operator(\))
+ reserved(end)
+ reserved(alias) operator(+) operator(|) comment(##)
+ reserved(alias) ident(union) operator(|) comment(##)
+
+ comment(# Returns a new set built by duplicating the set, removing every)
+ comment(# element that appears in the given enumerable object.)
+ reserved(def) method(-)operator(()ident(enum)operator(\))
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(dup)operator(.)ident(subtract)operator(()ident(enum)operator(\))
+ reserved(end)
+ reserved(alias) ident(difference) operator(-) comment(##)
+
+ comment(# Returns a new array containing elements common to the set and the)
+ comment(# given enumerable object.)
+ reserved(def) method(&)operator(()ident(enum)operator(\))
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(n) operator(=) pre_constant(self)operator(.)ident(class)operator(.)ident(new)
+ ident(enum)operator(.)ident(each) operator({) operator(|)ident(o)operator(|) ident(n)operator(.)ident(add)operator(()ident(o)operator(\)) reserved(if) ident(include?)operator(()ident(o)operator(\)) operator(})
+ ident(n)
+ reserved(end)
+ reserved(alias) ident(intersection) operator(&) comment(##)
+
+ comment(# Returns a new array containing elements exclusive between the set)
+ comment(# and the given enumerable object. (set ^ enum\) is equivalent to)
+ comment(# ((set | enum\) - (set & enum\)\).)
+ reserved(def) method(^)operator(()ident(enum)operator(\))
+ ident(enum)operator(.)ident(is_a?)operator(()constant(Enumerable)operator(\)) reserved(or) ident(raise) constant(ArgumentError)operator(,) string
+ ident(n) operator(=) ident(dup)
+ ident(enum)operator(.)ident(each) operator({) operator(|)ident(o)operator(|) reserved(if) ident(n)operator(.)ident(include?)operator(()ident(o)operator(\)) reserved(then) ident(n)operator(.)ident(delete)operator(()ident(o)operator(\)) reserved(else) ident(n)operator(.)ident(add)operator(()ident(o)operator(\)) reserved(end) operator(})
+ ident(n)
+ reserved(end)
+
+ comment(# Returns true if two sets are equal. The equality of each couple)
+ comment(# of elements is defined according to Object#eql?.)
+ reserved(def) method(==)operator(()ident(set)operator(\))
+ ident(equal?)operator(()ident(set)operator(\)) reserved(and) reserved(return) pre_constant(true)
+
+ ident(set)operator(.)ident(is_a?)operator(()constant(Set)operator(\)) operator(&&) ident(size) operator(==) ident(set)operator(.)ident(size) reserved(or) reserved(return) pre_constant(false)
+
+ ident(hash) operator(=) instance_variable(@hash)operator(.)ident(dup)
+ ident(set)operator(.)ident(all?) operator({) operator(|)ident(o)operator(|) ident(hash)operator(.)ident(include?)operator(()ident(o)operator(\)) operator(})
+ reserved(end)
+
+ reserved(def) method(hash) comment(# :nodoc:)
+ instance_variable(@hash)operator(.)ident(hash)
+ reserved(end)
+
+ reserved(def) method(eql?)operator(()ident(o)operator(\)) comment(# :nodoc:)
+ reserved(return) pre_constant(false) reserved(unless) ident(o)operator(.)ident(is_a?)operator(()constant(Set)operator(\))
+ instance_variable(@hash)operator(.)ident(eql?)operator(()ident(o)operator(.)ident(instance_eval)operator({)instance_variable(@hash)operator(})operator(\))
+ reserved(end)
+
+ comment(# Classifies the set by the return value of the given block and)
+ comment(# returns a hash of {value => set of elements} pairs. The block is)
+ comment(# called once for each element of the set, passing the element as)
+ comment(# parameter.)
+ comment(#)
+ comment(# e.g.:)
+ comment(#)
+ comment(# require 'set')
+ comment(# files = Set.new(Dir.glob("*.rb"\)\))
+ comment(# hash = files.classify { |f| File.mtime(f\).year })
+ comment(# p hash # => {2000=>#,)
+ comment(# # 2001=>#,)
+ comment(# # 2002=>#})
+ reserved(def) method(classify) comment(# :yields: o)
+ ident(h) operator(=) operator({)operator(})
+
+ ident(each) operator({) operator(|)ident(i)operator(|)
+ ident(x) operator(=) reserved(yield)operator(()ident(i)operator(\))
+ operator(()ident(h)operator([)ident(x)operator(]) operator(||=) pre_constant(self)operator(.)ident(class)operator(.)ident(new)operator(\))operator(.)ident(add)operator(()ident(i)operator(\))
+ operator(})
+
+ ident(h)
+ reserved(end)
+
+ comment(# Divides the set into a set of subsets according to the commonality)
+ comment(# defined by the given block.)
+ comment(#)
+ comment(# If the arity of the block is 2, elements o1 and o2 are in common)
+ comment(# if block.call(o1, o2\) is true. Otherwise, elements o1 and o2 are)
+ comment(# in common if block.call(o1\) == block.call(o2\).)
+ comment(#)
+ comment(# e.g.:)
+ comment(#)
+ comment(# require 'set')
+ comment(# numbers = Set[1, 3, 4, 6, 9, 10, 11])
+ comment(# set = numbers.divide { |i,j| (i - j\).abs == 1 })
+ comment(# p set # => #,)
+ comment(# # #,)
+ comment(# # #,)
+ comment(# # #}>)
+ reserved(def) method(divide)operator(()operator(&)ident(func)operator(\))
+ reserved(if) ident(func)operator(.)ident(arity) operator(==) integer(2)
+ ident(require) string
+
+ reserved(class) operator(<<) class(dig) operator(=) operator({)operator(}) comment(# :nodoc:)
+ ident(include) constant(TSort)
+
+ reserved(alias) ident(tsort_each_node) ident(each_key)
+ reserved(def) method(tsort_each_child)operator(()ident(node)operator(,) operator(&)ident(block)operator(\))
+ ident(fetch)operator(()ident(node)operator(\))operator(.)ident(each)operator(()operator(&)ident(block)operator(\))
+ reserved(end)
+ reserved(end)
+
+ ident(each) operator({) operator(|)ident(u)operator(|)
+ ident(dig)operator([)ident(u)operator(]) operator(=) ident(a) operator(=) operator([)operator(])
+ ident(each)operator({) operator(|)ident(v)operator(|) ident(func)operator(.)ident(call)operator(()ident(u)operator(,) ident(v)operator(\)) reserved(and) ident(a) operator(<<) ident(v) operator(})
+ operator(})
+
+ ident(set) operator(=) constant(Set)operator(.)ident(new)operator(()operator(\))
+ ident(dig)operator(.)ident(each_strongly_connected_component) operator({) operator(|)ident(css)operator(|)
+ ident(set)operator(.)ident(add)operator(()pre_constant(self)operator(.)ident(class)operator(.)ident(new)operator(()ident(css)operator(\))operator(\))
+ operator(})
+ ident(set)
+ reserved(else)
+ constant(Set)operator(.)ident(new)operator(()ident(classify)operator(()operator(&)ident(func)operator(\))operator(.)ident(values)operator(\))
+ reserved(end)
+ reserved(end)
+
+ constant(InspectKey) operator(=) symbol(:__inspect_key__) comment(# :nodoc:)
+
+ comment(# Returns a string containing a human-readable representation of the)
+ comment(# set. ("#"\))
+ reserved(def) method(inspect)
+ ident(ids) operator(=) operator(()constant(Thread)operator(.)ident(current)operator([)constant(InspectKey)operator(]) operator(||=) operator([)operator(])operator(\))
+
+ reserved(if) ident(ids)operator(.)ident(include?)operator(()ident(object_id)operator(\))
+ reserved(return) ident(sprintf)operator(()string)delimiter(')>operator(,) pre_constant(self)operator(.)ident(class)operator(.)ident(name)operator(\))
+ reserved(end)
+
+ reserved(begin)
+ ident(ids) operator(<<) ident(object_id)
+ reserved(return) ident(sprintf)operator(()string)delimiter(')>operator(,) pre_constant(self)operator(.)ident(class)operator(,) ident(to_a)operator(.)ident(inspect)operator([)integer(1)operator(..)integer(-2)operator(])operator(\))
+ reserved(ensure)
+ ident(ids)operator(.)ident(pop)
+ reserved(end)
+ reserved(end)
+
+ reserved(def) method(pretty_print)operator(()ident(pp)operator(\)) comment(# :nodoc:)
+ ident(pp)operator(.)ident(text) ident(sprintf)operator(()stringoperator(,) pre_constant(self)operator(.)ident(class)operator(.)ident(name)operator(\))
+ ident(pp)operator(.)ident(nest)operator(()integer(1)operator(\)) operator({)
+ ident(pp)operator(.)ident(seplist)operator(()pre_constant(self)operator(\)) operator({) operator(|)ident(o)operator(|)
+ ident(pp)operator(.)ident(pp) ident(o)
+ operator(})
+ operator(})
+ ident(pp)operator(.)ident(text) string)delimiter(")>
+ reserved(end)
+
+ reserved(def) method(pretty_print_cycle)operator(()ident(pp)operator(\)) comment(# :nodoc:)
+ ident(pp)operator(.)ident(text) ident(sprintf)operator(()string)delimiter(')>operator(,) pre_constant(self)operator(.)ident(class)operator(.)ident(name)operator(,) ident(empty?) operator(?) string operator(:) stringoperator(\))
+ reserved(end)
+reserved(end)
+
+comment(# SortedSet implements a set which elements are sorted in order. See Set.)
+reserved(class) class(SortedSet) operator(<) constant(Set)
+ class_variable(@@setup) operator(=) pre_constant(false)
+
+ reserved(class) operator(<<) class(self)
+ reserved(def) method([])operator(()operator(*)ident(ary)operator(\)) comment(# :nodoc:)
+ ident(new)operator(()ident(ary)operator(\))
+ reserved(end)
+
+ reserved(def) method(setup) comment(# :nodoc:)
+ class_variable(@@setup) reserved(and) reserved(return)
+
+ reserved(begin)
+ ident(require) string
+
+ ident(module_eval) string
+ reserved(rescue) constant(LoadError)
+ ident(module_eval) string
+ reserved(end)
+
+ class_variable(@@setup) operator(=) pre_constant(true)
+ reserved(end)
+ reserved(end)
+
+ reserved(def) method(initialize)operator(()operator(*)ident(args)operator(,) operator(&)ident(block)operator(\)) comment(# :nodoc:)
+ constant(SortedSet)operator(.)ident(setup)
+ ident(initialize)operator(()operator(*)ident(args)operator(,) operator(&)ident(block)operator(\))
+ reserved(end)
+reserved(end)
+
+reserved(module) class(Enumerable)
+ comment(# Makes a set from the enumerable object with given arguments.)
+ reserved(def) method(to_set)operator(()ident(klass) operator(=) constant(Set)operator(,) operator(*)ident(args)operator(,) operator(&)ident(block)operator(\))
+ ident(klass)operator(.)ident(new)operator(()pre_constant(self)operator(,) operator(*)ident(args)operator(,) operator(&)ident(block)operator(\))
+ reserved(end)
+reserved(end)
+
+comment(# =begin)
+comment(# == RestricedSet class)
+comment(# RestricedSet implements a set with restrictions defined by a given)
+comment(# block.)
+comment(#)
+comment(# === Super class)
+comment(# Set)
+comment(#)
+comment(# === Class Methods)
+comment(# --- RestricedSet::new(enum = nil\) { |o| ... })
+comment(# --- RestricedSet::new(enum = nil\) { |rset, o| ... })
+comment(# Creates a new restricted set containing the elements of the given)
+comment(# enumerable object. Restrictions are defined by the given block.)
+comment(#)
+comment(# If the block's arity is 2, it is called with the RestrictedSet)
+comment(# itself and an object to see if the object is allowed to be put in)
+comment(# the set.)
+comment(#)
+comment(# Otherwise, the block is called with an object to see if the object)
+comment(# is allowed to be put in the set.)
+comment(#)
+comment(# === Instance Methods)
+comment(# --- restriction_proc)
+comment(# Returns the restriction procedure of the set.)
+comment(#)
+comment(# =end)
+comment(#)
+comment(# class RestricedSet < Set)
+comment(# def initialize(*args, &block\))
+comment(# @proc = block or raise ArgumentError, "missing a block")
+comment(#)
+comment(# if @proc.arity == 2)
+comment(# instance_eval %{)
+comment(# def add(o\))
+comment(# @hash[o] = true if @proc.call(self, o\))
+comment(# self)
+comment(# end)
+comment(# alias << add)
+comment(#)
+comment(# def add?(o\))
+comment(# if include?(o\) || !@proc.call(self, o\))
+comment(# nil)
+comment(# else)
+comment(# @hash[o] = true)
+comment(# self)
+comment(# end)
+comment(# end)
+comment(#)
+comment(# def replace(enum\))
+comment(# enum.is_a?(Enumerable\) or raise ArgumentError, "value must be enumerable")
+comment(# clear)
+comment(# enum.each { |o| add(o\) })
+comment(#)
+comment(# self)
+comment(# end)
+comment(#)
+comment(# def merge(enum\))
+comment(# enum.is_a?(Enumerable\) or raise ArgumentError, "value must be enumerable")
+comment(# enum.each { |o| add(o\) })
+comment(#)
+comment(# self)
+comment(# end)
+comment(# })
+comment(# else)
+comment(# instance_eval %{)
+comment(# def add(o\))
+comment(# if @proc.call(o\))
+comment(# @hash[o] = true)
+comment(# end)
+comment(# self)
+comment(# end)
+comment(# alias << add)
+comment(#)
+comment(# def add?(o\))
+comment(# if include?(o\) || !@proc.call(o\))
+comment(# nil)
+comment(# else)
+comment(# @hash[o] = true)
+comment(# self)
+comment(# end)
+comment(# end)
+comment(# })
+comment(# end)
+comment(#)
+comment(# super(*args\))
+comment(# end)
+comment(#)
+comment(# def restriction_proc)
+comment(# @proc)
+comment(# end)
+comment(# end)
+
+reserved(if) global_variable($0) operator(==) pre_constant(__FILE__)
+ ident(eval) pre_constant(DATA)operator(.)ident(read)operator(,) pre_constant(nil)operator(,) global_variable($0)operator(,) pre_constant(__LINE__)integer(+4)
+reserved(end)
+
+comment(# = rweb - CGI Support Library)
+comment(#)
+comment(# Author:: Johannes Barre (mailto:rweb@igels.net\))
+comment(# Copyright:: Copyright (c\) 2003, 04 by Johannes Barre)
+comment(# License:: GNU Lesser General Public License (COPYING, http://www.gnu.org/copyleft/lesser.html\))
+comment(# Version:: 0.1.0)
+comment(# CVS-ID:: $Id: rweb.rb 6 2004-06-16 15:56:26Z igel $)
+comment(#)
+comment(# == What is Rweb?)
+comment(# Rweb is a replacement for the cgi class included in the ruby distribution.)
+comment(#)
+comment(# == How to use)
+comment(#)
+comment(# === Basics)
+comment(#)
+comment(# This class is made to be as easy as possible to use. An example:)
+comment(#)
+comment(# require "rweb")
+comment(#)
+comment(# web = Rweb.new)
+comment(# web.out do)
+comment(# web.puts "Hello world!")
+comment(# end)
+comment(#)
+comment(# The visitor will get a simple "Hello World!" in his browser. Please notice,)
+comment(# that won't set html-tags for you, so you should better do something like this:)
+comment(#)
+comment(# require "rweb")
+comment(#)
+comment(# web = Rweb.new)
+comment(# web.out do)
+comment(# web.puts "Hello world!")
+comment(# end)
+comment(#)
+comment(# === Set headers)
+comment(# Of course, it's also possible to tell the browser, that the content of this)
+comment(# page is plain text instead of html code:)
+comment(#)
+comment(# require "rweb")
+comment(#)
+comment(# web = Rweb.new)
+comment(# web.out do)
+comment(# web.header("content-type: text/plain"\))
+comment(# web.puts "Hello plain world!")
+comment(# end)
+comment(#)
+comment(# Please remember, headers can't be set after the page content has been send.)
+comment(# You have to set all nessessary headers before the first puts oder print. It's)
+comment(# possible to cache the content until everything is complete. Doing it this)
+comment(# way, you can set headers everywhere.)
+comment(#)
+comment(# If you set a header twice, the second header will replace the first one. The)
+comment(# header name is not casesensitive, it will allways converted in to the)
+comment(# capitalised form suggested by the w3c (http://w3.org\))
+comment(#)
+comment(# === Set cookies)
+comment(# Setting cookies is quite easy:)
+comment(# include 'rweb')
+comment(#)
+comment(# web = Rweb.new)
+comment(# Cookie.new("Visits", web.cookies['visits'].to_i +1\))
+comment(# web.out do)
+comment(# web.puts "Welcome back! You visited this page #{web.cookies['visits'].to_i +1} times")
+comment(# end)
+comment(#)
+comment(# See the class Cookie for more details.)
+comment(#)
+comment(# === Get form and cookie values)
+comment(# There are four ways to submit data from the browser to the server and your)
+comment(# ruby script: via GET, POST, cookies and file upload. Rweb doesn't support)
+comment(# file upload by now.)
+comment(#)
+comment(# include 'rweb')
+comment(#)
+comment(# web = Rweb.new)
+comment(# web.out do)
+comment(# web.print "action: #{web.get['action']} ")
+comment(# web.puts "The value of the cookie 'visits' is #{web.cookies['visits']}")
+comment(# web.puts "The post parameter 'test['x']' is #{web.post['test']['x']}")
+comment(# end)
+
+constant(RWEB_VERSION) operator(=) string
+constant(RWEB) operator(=) stringdelimiter(")>
+
+comment(#require 'rwebcookie' -> edit by bunny :-\))
+
+reserved(class) class(Rweb)
+ comment(# All parameter submitted via the GET method are available in attribute)
+ comment(# get. This is Hash, where every parameter is available as a key-value)
+ comment(# pair.)
+ comment(#)
+ comment(# If your input tag has a name like this one, it's value will be available)
+ comment(# as web.get["fieldname"])
+ comment(# )
+ comment(# You can submit values as a Hash)
+ comment(# )
+ comment(# )
+ comment(# will be available as)
+ comment(# web.get["text"]["index"])
+ comment(# web.get["text"]["index2"])
+ comment(# Integers are also possible)
+ comment(# )
+ comment(# )
+ comment(# )
+ comment(# will be available as)
+ comment(# web.get["int"][0] # First Field)
+ comment(# web.get["int"][1] # Second one)
+ comment(# Please notice, this doesn'd work like you might expect:)
+ comment(# )
+ comment(# It will not be available as web.get["text"]["index"] but)
+ comment(# web.get["text[index]"])
+ ident(attr_reader) symbol(:get)
+
+ comment(# All parameters submitted via POST are available in the attribute post. It)
+ comment(# works like the get attribute.)
+ comment(# )
+ comment(# will be available as)
+ comment(# web.post["text"][0])
+ ident(attr_reader) symbol(:post)
+
+ comment(# All cookies submitted by the browser are available in cookies. This is a)
+ comment(# Hash, where every cookie is a key-value pair.)
+ ident(attr_reader) symbol(:cookies)
+
+ comment(# The name of the browser identification is submitted as USER_AGENT and)
+ comment(# available in this attribute.)
+ ident(attr_reader) symbol(:user_agent)
+
+ comment(# The IP address of the client.)
+ ident(attr_reader) symbol(:remote_addr)
+
+ comment(# Creates a new Rweb object. This should only done once. You can set various)
+ comment(# options via the settings hash.)
+ comment(#)
+ comment(# "cache" => true: Everything you script send to the client will be cached)
+ comment(# until the end of the out block or until flush is called. This way, you)
+ comment(# can modify headers and cookies even after printing something to the client.)
+ comment(#)
+ comment(# "safe" => level: Changes the $SAFE attribute. By default, $SAFE will be set)
+ comment(# to 1. If $SAFE is already higher than this value, it won't be changed.)
+ comment(#)
+ comment(# "silend" => true: Normaly, Rweb adds automaticly a header like this)
+ comment(# "X-Powered-By: Rweb/x.x.x (Ruby/y.y.y\)". With the silend option you can)
+ comment(# suppress this.)
+ reserved(def) method(initialize) operator(()ident(settings) operator(=) operator({)operator(})operator(\))
+ comment(# {{{)
+ instance_variable(@header) operator(=) operator({)operator(})
+ instance_variable(@cookies) operator(=) operator({)operator(})
+ instance_variable(@get) operator(=) operator({)operator(})
+ instance_variable(@post) operator(=) operator({)operator(})
+
+ comment(# Internal attributes)
+ instance_variable(@status) operator(=) pre_constant(nil)
+ instance_variable(@reasonPhrase) operator(=) pre_constant(nil)
+ instance_variable(@setcookies) operator(=) operator([)operator(])
+ instance_variable(@output_started) operator(=) pre_constant(false)operator(;)
+ instance_variable(@output_allowed) operator(=) pre_constant(false)operator(;)
+
+ instance_variable(@mod_ruby) operator(=) pre_constant(false)
+ instance_variable(@env) operator(=) constant(ENV)operator(.)ident(to_hash)
+
+ reserved(if) reserved(defined?)operator(()constant(MOD_RUBY)operator(\))
+ instance_variable(@output_method) operator(=) string
+ instance_variable(@mod_ruby) operator(=) pre_constant(true)
+ reserved(elsif) instance_variable(@env)operator([)stringoperator(]) operator(=)operator(~) regexp
+ instance_variable(@output_method) operator(=) string
+ reserved(else)
+ instance_variable(@output_method) operator(=) string
+ reserved(end)
+
+ reserved(unless) ident(settings)operator(.)ident(is_a?)operator(()constant(Hash)operator(\))
+ ident(raise) constant(TypeError)operator(,) string
+ reserved(end)
+ instance_variable(@settings) operator(=) ident(settings)
+
+ reserved(unless) instance_variable(@settings)operator(.)ident(has_key?)operator(()stringoperator(\))
+ instance_variable(@settings)operator([)stringoperator(]) operator(=) integer(1)
+ reserved(end)
+
+ reserved(if) global_variable($SAFE) operator(<) instance_variable(@settings)operator([)stringoperator(])
+ global_variable($SAFE) operator(=) instance_variable(@settings)operator([)stringoperator(])
+ reserved(end)
+
+ reserved(unless) instance_variable(@settings)operator(.)ident(has_key?)operator(()stringoperator(\))
+ instance_variable(@settings)operator([)stringoperator(]) operator(=) pre_constant(false)
+ reserved(end)
+
+ comment(# mod_ruby sets no QUERY_STRING variable, if no GET-Parameters are given)
+ reserved(unless) instance_variable(@env)operator(.)ident(has_key?)operator(()stringoperator(\))
+ instance_variable(@env)operator([)stringoperator(]) operator(=) string
+ reserved(end)
+
+ comment(# Now we split the QUERY_STRING by the seperators & and ; or, if)
+ comment(# specified, settings['get seperator'])
+ reserved(unless) instance_variable(@settings)operator(.)ident(has_key?)operator(()stringoperator(\))
+ ident(get_args) operator(=) instance_variable(@env)operator([)stringoperator(])operator(.)ident(split)operator(()regexpoperator(\))
+ reserved(else)
+ ident(get_args) operator(=) instance_variable(@env)operator([)stringoperator(])operator(.)ident(split)operator(()instance_variable(@settings)operator([)stringoperator(])operator(\))
+ reserved(end)
+
+ ident(get_args)operator(.)ident(each) reserved(do) operator(|) ident(arg) operator(|)
+ ident(arg_key)operator(,) ident(arg_val) operator(=) ident(arg)operator(.)ident(split)operator(()regexpoperator(,) integer(2)operator(\))
+ ident(arg_key) operator(=) constant(Rweb)operator(::)ident(unescape)operator(()ident(arg_key)operator(\))
+ ident(arg_val) operator(=) constant(Rweb)operator(::)ident(unescape)operator(()ident(arg_val)operator(\))
+
+ comment(# Parse names like name[0], name['text'] or name[])
+ ident(pattern) operator(=) regexp
+ ident(keys) operator(=) operator([)operator(])
+ reserved(while) ident(match) operator(=) ident(pattern)operator(.)ident(match)operator(()ident(arg_key)operator(\))
+ ident(arg_key) operator(=) ident(match)operator([)integer(1)operator(])
+ ident(keys) operator(=) operator([)ident(match)operator([)integer(2)operator(])operator(]) operator(+) ident(keys)
+ reserved(end)
+ ident(keys) operator(=) operator([)ident(arg_key)operator(]) operator(+) ident(keys)
+
+ ident(akt) operator(=) instance_variable(@get)
+ ident(last) operator(=) pre_constant(nil)
+ ident(lastkey) operator(=) pre_constant(nil)
+ ident(keys)operator(.)ident(each) reserved(do) operator(|)ident(key)operator(|)
+ reserved(if) ident(key) operator(==) string
+ comment(# No key specified (like in "test[]"\), so we use the)
+ comment(# lowerst unused Integer as key)
+ ident(key) operator(=) integer(0)
+ reserved(while) ident(akt)operator(.)ident(has_key?)operator(()ident(key)operator(\))
+ ident(key) operator(+=) integer(1)
+ reserved(end)
+ reserved(elsif) regexp operator(=)operator(~) ident(key)
+ comment(# If the index is numerical convert it to an Integer)
+ ident(key) operator(=) ident(key)operator(.)ident(to_i)
+ reserved(elsif) ident(key)operator([)integer(0)operator(])operator(.)ident(chr) operator(==) string operator(||) ident(key)operator([)integer(0)operator(])operator(.)ident(chr) operator(==) string
+ ident(key) operator(=) ident(key)operator([)integer(1)operator(,) ident(key)operator(.)ident(length)operator(()operator(\)) integer(-2)operator(])
+ reserved(end)
+ reserved(if) operator(!)ident(akt)operator(.)ident(has_key?)operator(()ident(key)operator(\)) operator(||) operator(!)ident(akt)operator([)ident(key)operator(])operator(.)ident(class) operator(==) constant(Hash)
+ comment(# create an empty Hash if there isn't already one)
+ ident(akt)operator([)ident(key)operator(]) operator(=) operator({)operator(})
+ reserved(end)
+ ident(last) operator(=) ident(akt)
+ ident(lastkey) operator(=) ident(key)
+ ident(akt) operator(=) ident(akt)operator([)ident(key)operator(])
+ reserved(end)
+ ident(last)operator([)ident(lastkey)operator(]) operator(=) ident(arg_val)
+ reserved(end)
+
+ reserved(if) instance_variable(@env)operator([)stringoperator(]) operator(==) string
+ reserved(if) instance_variable(@env)operator(.)ident(has_key?)operator(()stringoperator(\)) operator(&&) instance_variable(@env)operator([)stringoperator(]) operator(==) string operator(&&) instance_variable(@env)operator(.)ident(has_key?)operator(()stringoperator(\))
+ reserved(unless) instance_variable(@settings)operator(.)ident(has_key?)operator(()stringoperator(\))
+ ident(post_args) operator(=) global_variable($stdin)operator(.)ident(read)operator(()instance_variable(@env)operator([)stringoperator(])operator(.)ident(to_i)operator(\))operator(.)ident(split)operator(()regexpoperator(\))
+ reserved(else)
+ ident(post_args) operator(=) global_variable($stdin)operator(.)ident(read)operator(()instance_variable(@env)operator([)stringoperator(])operator(.)ident(to_i)operator(\))operator(.)ident(split)operator(()instance_variable(@settings)operator([)stringoperator(])operator(\))
+ reserved(end)
+ ident(post_args)operator(.)ident(each) reserved(do) operator(|) ident(arg) operator(|)
+ ident(arg_key)operator(,) ident(arg_val) operator(=) ident(arg)operator(.)ident(split)operator(()regexpoperator(,) integer(2)operator(\))
+ ident(arg_key) operator(=) constant(Rweb)operator(::)ident(unescape)operator(()ident(arg_key)operator(\))
+ ident(arg_val) operator(=) constant(Rweb)operator(::)ident(unescape)operator(()ident(arg_val)operator(\))
+
+ comment(# Parse names like name[0], name['text'] or name[])
+ ident(pattern) operator(=) regexp
+ ident(keys) operator(=) operator([)operator(])
+ reserved(while) ident(match) operator(=) ident(pattern)operator(.)ident(match)operator(()ident(arg_key)operator(\))
+ ident(arg_key) operator(=) ident(match)operator([)integer(1)operator(])
+ ident(keys) operator(=) operator([)ident(match)operator([)integer(2)operator(])operator(]) operator(+) ident(keys)
+ reserved(end)
+ ident(keys) operator(=) operator([)ident(arg_key)operator(]) operator(+) ident(keys)
+
+ ident(akt) operator(=) instance_variable(@post)
+ ident(last) operator(=) pre_constant(nil)
+ ident(lastkey) operator(=) pre_constant(nil)
+ ident(keys)operator(.)ident(each) reserved(do) operator(|)ident(key)operator(|)
+ reserved(if) ident(key) operator(==) string
+ comment(# No key specified (like in "test[]"\), so we use)
+ comment(# the lowerst unused Integer as key)
+ ident(key) operator(=) integer(0)
+ reserved(while) ident(akt)operator(.)ident(has_key?)operator(()ident(key)operator(\))
+ ident(key) operator(+=) integer(1)
+ reserved(end)
+ reserved(elsif) regexp operator(=)operator(~) ident(key)
+ comment(# If the index is numerical convert it to an Integer)
+ ident(key) operator(=) ident(key)operator(.)ident(to_i)
+ reserved(elsif) ident(key)operator([)integer(0)operator(])operator(.)ident(chr) operator(==) string operator(||) ident(key)operator([)integer(0)operator(])operator(.)ident(chr) operator(==) string
+ ident(key) operator(=) ident(key)operator([)integer(1)operator(,) ident(key)operator(.)ident(length)operator(()operator(\)) integer(-2)operator(])
+ reserved(end)
+ reserved(if) operator(!)ident(akt)operator(.)ident(has_key?)operator(()ident(key)operator(\)) operator(||) operator(!)ident(akt)operator([)ident(key)operator(])operator(.)ident(class) operator(==) constant(Hash)
+ comment(# create an empty Hash if there isn't already one)
+ ident(akt)operator([)ident(key)operator(]) operator(=) operator({)operator(})
+ reserved(end)
+ ident(last) operator(=) ident(akt)
+ ident(lastkey) operator(=) ident(key)
+ ident(akt) operator(=) ident(akt)operator([)ident(key)operator(])
+ reserved(end)
+ ident(last)operator([)ident(lastkey)operator(]) operator(=) ident(arg_val)
+ reserved(end)
+ reserved(else)
+ comment(# Maybe we should print a warning here?)
+ global_variable($stderr)operator(.)ident(print)operator(()stringoperator(\))
+ reserved(end)
+ reserved(end)
+
+ reserved(if) instance_variable(@env)operator(.)ident(has_key?)operator(()stringoperator(\))
+ ident(cookie) operator(=) instance_variable(@env)operator([)stringoperator(])operator(.)ident(split)operator(()regexpoperator(\))
+ ident(cookie)operator(.)ident(each) reserved(do) operator(|) ident(c) operator(|)
+ ident(cookie_key)operator(,) ident(cookie_val) operator(=) ident(c)operator(.)ident(split)operator(()regexpoperator(,) integer(2)operator(\))
+
+ instance_variable(@cookies) operator([)constant(Rweb)operator(::)ident(unescape)operator(()ident(cookie_key)operator(\))operator(]) operator(=) constant(Rweb)operator(::)ident(unescape)operator(()ident(cookie_val)operator(\))
+ reserved(end)
+ reserved(end)
+
+ reserved(if) reserved(defined?)operator(()instance_variable(@env)operator([)stringoperator(])operator(\))
+ instance_variable(@user_agent) operator(=) instance_variable(@env)operator([)stringoperator(])
+ reserved(else)
+ instance_variable(@user_agent) operator(=) pre_constant(nil)operator(;)
+ reserved(end)
+
+ reserved(if) reserved(defined?)operator(()instance_variable(@env)operator([)stringoperator(])operator(\))
+ instance_variable(@remote_addr) operator(=) instance_variable(@env)operator([)stringoperator(])
+ reserved(else)
+ instance_variable(@remote_addr) operator(=) pre_constant(nil)
+ reserved(end)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Prints a String to the client. If caching is enabled, the String will)
+ comment(# buffered until the end of the out block ends.)
+ reserved(def) method(print)operator(()ident(str) operator(=) stringoperator(\))
+ comment(# {{{)
+ reserved(unless) instance_variable(@output_allowed)
+ ident(raise) string
+ reserved(end)
+
+ reserved(if) instance_variable(@settings)operator([)stringoperator(])
+ instance_variable(@buffer) operator(+=) operator([)ident(str)operator(.)ident(to_s)operator(])
+ reserved(else)
+ reserved(unless) instance_variable(@output_started)
+ ident(sendHeaders)
+ reserved(end)
+ global_variable($stdout)operator(.)ident(print)operator(()ident(str)operator(\))
+ reserved(end)
+ pre_constant(nil)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Prints a String to the client and adds a line break at the end. Please)
+ comment(# remember, that a line break is not visible in HTML, use the
HTML-Tag)
+ comment(# for this. If caching is enabled, the String will buffered until the end)
+ comment(# of the out block ends.)
+ reserved(def) method(puts)operator(()ident(str) operator(=) stringoperator(\))
+ comment(# {{{)
+ pre_constant(self)operator(.)ident(print)operator(()ident(str) operator(+) stringoperator(\))
+ comment(# }}})
+ reserved(end)
+
+ comment(# Alias to print.)
+ reserved(def) method(write)operator(()ident(str) operator(=) stringoperator(\))
+ comment(# {{{)
+ pre_constant(self)operator(.)ident(print)operator(()ident(str)operator(\))
+ comment(# }}})
+ reserved(end)
+
+ comment(# If caching is enabled, all cached data are send to the cliend and the)
+ comment(# cache emptied.)
+ reserved(def) method(flush)
+ comment(# {{{)
+ reserved(unless) instance_variable(@output_allowed)
+ ident(raise) string
+ reserved(end)
+ ident(buffer) operator(=) instance_variable(@buffer)operator(.)ident(join)
+
+ reserved(unless) instance_variable(@output_started)
+ ident(sendHeaders)
+ reserved(end)
+ global_variable($stdout)operator(.)ident(print)operator(()ident(buffer)operator(\))
+
+ instance_variable(@buffer) operator(=) operator([)operator(])
+ comment(# }}})
+ reserved(end)
+
+ comment(# Sends one or more header to the client. All headers are cached just)
+ comment(# before body data are send to the client. If the same header are set)
+ comment(# twice, only the last value is send.)
+ comment(#)
+ comment(# Example:)
+ comment(# web.header("Last-Modified: Mon, 16 Feb 2004 20:15:41 GMT"\))
+ comment(# web.header("Location: http://www.ruby-lang.org"\))
+ comment(#)
+ comment(# You can specify more than one header at the time by doing something like)
+ comment(# this:)
+ comment(# web.header("Content-Type: text/plain\\nContent-Length: 383"\))
+ comment(# or)
+ comment(# web.header(["Content-Type: text/plain", "Content-Length: 383"]\))
+ reserved(def) method(header)operator(()ident(str)operator(\))
+ comment(# {{{)
+ reserved(if) instance_variable(@output_started)
+ ident(raise) string
+ reserved(end)
+ reserved(unless) instance_variable(@output_allowed)
+ ident(raise) string
+ reserved(end)
+ reserved(if) ident(str)operator(.)ident(is_a?)constant(Array)
+ ident(str)operator(.)ident(each) reserved(do) operator(|) ident(value) operator(|)
+ pre_constant(self)operator(.)ident(header)operator(()ident(value)operator(\))
+ reserved(end)
+
+ reserved(elsif) ident(str)operator(.)ident(split)operator(()regexpoperator(\))operator(.)ident(length) operator(>) integer(1)
+ ident(str)operator(.)ident(split)operator(()regexpoperator(\))operator(.)ident(each) reserved(do) operator(|) ident(value) operator(|)
+ pre_constant(self)operator(.)ident(header)operator(()ident(value)operator(\))
+ reserved(end)
+
+ reserved(elsif) ident(str)operator(.)ident(is_a?) constant(String)
+ ident(str)operator(.)ident(gsub!)operator(()regexpoperator(,) stringoperator(\))
+
+ reserved(if) operator(()ident(str) operator(=)operator(~) regexpoperator(\)) operator(==) integer(0)
+ ident(pattern) operator(=) regexp
+
+ ident(result) operator(=) ident(pattern)operator(.)ident(match)operator(()ident(str)operator(\))
+ pre_constant(self)operator(.)ident(setstatus)operator(()ident(result)operator([)integer(0)operator(])operator(,) ident(result)operator([)integer(1)operator(])operator(\))
+ reserved(elsif) operator(()ident(str) operator(=)operator(~) regexpoperator(\)) operator(==) integer(0)
+ ident(pattern) operator(=) regexp
+
+ ident(result) operator(=) ident(pattern)operator(.)ident(match)operator(()ident(str)operator(\))
+ pre_constant(self)operator(.)ident(setstatus)operator(()ident(result)operator([)integer(0)operator(])operator(,) ident(result)operator([)integer(1)operator(])operator(\))
+ reserved(else)
+ ident(a) operator(=) ident(str)operator(.)ident(split)operator(()regexpoperator(,) integer(2)operator(\))
+
+ instance_variable(@header)operator([)ident(a)operator([)integer(0)operator(])operator(.)ident(downcase)operator(]) operator(=) ident(a)operator([)integer(1)operator(])
+ reserved(end)
+ reserved(end)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Changes the status of this page. There are several codes like "200 OK",)
+ comment(# "302 Found", "404 Not Found" or "500 Internal Server Error". A list of)
+ comment(# all codes is available at)
+ comment(# http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10)
+ comment(#)
+ comment(# You can just send the code number, the reason phrase will be added)
+ comment(# automaticly with the recommendations from the w3c if not specified. If)
+ comment(# you set the status twice or more, only the last status will be send.)
+ comment(# Examples:)
+ comment(# web.status("401 Unauthorized"\))
+ comment(# web.status("410 Sad but true, this lonely page is gone :("\))
+ comment(# web.status(206\))
+ comment(# web.status("400"\))
+ comment(#)
+ comment(# The default status is "200 OK". If a "Location" header is set, the)
+ comment(# default status is "302 Found".)
+ reserved(def) method(status)operator(()ident(str)operator(\))
+ comment(# {{{)
+ reserved(if) instance_variable(@output_started)
+ ident(raise) string
+ reserved(end)
+ reserved(unless) instance_variable(@output_allowed)
+ ident(raise) string
+ reserved(end)
+ reserved(if) ident(str)operator(.)ident(is_a?)constant(Integer)
+ instance_variable(@status) operator(=) ident(str)
+ reserved(elsif) ident(str)operator(.)ident(is_a?)constant(String)
+ ident(p1) operator(=) regexp
+ ident(p2) operator(=) regexp
+ ident(p3) operator(=) regexp
+
+ reserved(if) operator(()ident(a) operator(=) ident(p1)operator(.)ident(match)operator(()ident(str)operator(\))operator(\)) operator(==) pre_constant(nil)
+ reserved(if) operator(()ident(a) operator(=) ident(p2)operator(.)ident(match)operator(()ident(str)operator(\))operator(\)) operator(==) pre_constant(nil)
+ reserved(if) operator(()ident(a) operator(=) ident(p3)operator(.)ident(match)operator(()ident(str)operator(\))operator(\)) operator(==) pre_constant(nil)
+ ident(raise) constant(ArgumentError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ reserved(end)
+ reserved(end)
+ instance_variable(@status) operator(=) ident(a)operator([)integer(1)operator(])operator(.)ident(to_i)
+ reserved(if) ident(a)operator([)integer(2)operator(]) operator(!=) string
+ instance_variable(@reasonPhrase) operator(=) ident(a)operator([)integer(2)operator(])
+ reserved(else)
+ instance_variable(@reasonPhrase) operator(=) ident(getReasonPhrase)operator(()instance_variable(@status)operator(\))
+ reserved(end)
+ reserved(else)
+ ident(raise) constant(ArgumentError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Handles the output of your content and rescues all exceptions. Send all)
+ comment(# data in the block to this method. For example:)
+ comment(# web.out do)
+ comment(# web.header("Content-Type: text/plain"\))
+ comment(# web.puts("Hello, plain world!"\))
+ comment(# end)
+ reserved(def) method(out)
+ comment(# {{{)
+ instance_variable(@output_allowed) operator(=) pre_constant(true)
+ instance_variable(@buffer) operator(=) operator([)operator(])operator(;) comment(# We use an array as buffer, because it's more performant :\))
+
+ reserved(begin)
+ reserved(yield)
+ reserved(rescue) constant(Exception) operator(=)operator(>) ident(exception)
+ global_variable($stderr)operator(.)ident(puts) stringcontent(\): )inlinedelimiter(")>
+ global_variable($stderr)operator(.)ident(puts) ident(exception)operator(.)ident(backtrace)operator(.)ident(join)operator(()stringoperator(\))
+
+ reserved(unless) instance_variable(@output_started)
+ pre_constant(self)operator(.)ident(setstatus)operator(()integer(500)operator(\))
+ instance_variable(@header) operator(=) operator({)operator(})
+ reserved(end)
+
+ reserved(unless) operator(()instance_variable(@settings)operator(.)ident(has_key?)operator(()stringoperator(\)) reserved(and) instance_variable(@settings)operator([)stringoperator(]) operator(==) pre_constant(true)operator(\))
+ reserved(unless) instance_variable(@output_started)
+ pre_constant(self)operator(.)ident(header)operator(()stringoperator(\))
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string500 Internal Server Error)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ reserved(end)
+ reserved(if) instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\)) reserved(and) operator(()instance_variable(@header)operator([)stringoperator(]) operator(=)operator(~) regexpoperator(\)) operator(==) integer(0)
+ pre_constant(self)operator(.)ident(puts) stringInternal Server Error)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) stringThe server encountered an exception and was unable to complete your request.
)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) stringThe exception has provided the following information:)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)inlinecontent(: )inlinecontent( on)delimiter(")>
+ pre_constant(self)operator(.)ident(puts)
+ pre_constant(self)operator(.)ident(puts) stringoperator(\))delimiter(})>content()delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ pre_constant(self)operator(.)ident(puts) string)delimiter(")>
+ reserved(else)
+ pre_constant(self)operator(.)ident(puts) string
+ pre_constant(self)operator(.)ident(puts) string
+ pre_constant(self)operator(.)ident(puts) stringcontent(: )inlinedelimiter(")>
+ pre_constant(self)operator(.)ident(puts)
+ pre_constant(self)operator(.)ident(puts) ident(exception)operator(.)ident(backtrace)operator(.)ident(join)operator(()stringoperator(\))
+ reserved(end)
+ reserved(end)
+ reserved(end)
+
+ reserved(if) instance_variable(@settings)operator([)stringoperator(])
+ ident(buffer) operator(=) instance_variable(@buffer)operator(.)ident(join)
+
+ reserved(unless) instance_variable(@output_started)
+ reserved(unless) instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\))
+ pre_constant(self)operator(.)ident(header)operator(()stringdelimiter(")>operator(\))
+ reserved(end)
+
+ ident(sendHeaders)
+ reserved(end)
+ global_variable($stdout)operator(.)ident(print)operator(()ident(buffer)operator(\))
+ reserved(elsif) operator(!)instance_variable(@output_started)
+ ident(sendHeaders)
+ reserved(end)
+ instance_variable(@output_allowed) operator(=) pre_constant(false)operator(;)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Decodes URL encoded data, %20 for example stands for a space.)
+ reserved(def) constant(Rweb)operator(.)ident(unescape)operator(()ident(str)operator(\))
+ comment(# {{{)
+ reserved(if) reserved(defined?) ident(str) reserved(and) ident(str)operator(.)ident(is_a?) constant(String)
+ ident(str)operator(.)ident(gsub!)operator(()regexpoperator(,) stringoperator(\))
+ ident(str)operator(.)ident(gsub)operator(()regexpoperator(\)) reserved(do) operator(|) ident(s) operator(|)
+ ident(s)operator([)integer(1)operator(,)integer(2)operator(])operator(.)ident(hex)operator(.)ident(chr)
+ reserved(end)
+ reserved(end)
+ comment(# }}})
+ reserved(end)
+
+ ident(protected)
+ reserved(def) method(sendHeaders)
+ comment(# {{{)
+
+ constant(Cookie)operator(.)ident(disallow) comment(# no more cookies can be set or modified)
+ reserved(if) operator(!)operator(()instance_variable(@settings)operator(.)ident(has_key?)operator(()stringoperator(\)) reserved(and) instance_variable(@settings)operator([)stringoperator(]) operator(==) pre_constant(true)operator(\)) reserved(and) operator(!)instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\))
+ reserved(if) instance_variable(@mod_ruby)
+ ident(header)operator(()stringcontent( (Ruby/)inlinecontent(, )inlinecontent(\))delimiter(")>operator(\))operator(;)
+ reserved(else)
+ ident(header)operator(()stringcontent( (Ruby/)inlinecontent(\))delimiter(")>operator(\))operator(;)
+ reserved(end)
+ reserved(end)
+
+ reserved(if) instance_variable(@output_method) operator(==) string
+ reserved(if) operator(()operator(()instance_variable(@status) operator(==) pre_constant(nil) reserved(or) instance_variable(@status) operator(==) integer(200)operator(\)) reserved(and) operator(!)instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\)) reserved(and) operator(!)instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\))operator(\))
+ ident(header)operator(()stringoperator(\))
+ reserved(end)
+
+ reserved(if) instance_variable(@status) operator(!=) pre_constant(nil)
+ global_variable($stdout)operator(.)ident(print) stringcontent( )inlinechar(\\r)char(\\n)delimiter(")>
+ reserved(end)
+
+ instance_variable(@header)operator(.)ident(each) reserved(do) operator(|)ident(key)operator(,) ident(value)operator(|)
+ ident(key) operator(=) ident(key) operator(*)integer(1) comment(# "unfreeze" key :\))
+ ident(key)operator([)integer(0)operator(]) operator(=) ident(key)operator([)integer(0)operator(,)integer(1)operator(])operator(.)ident(upcase!)operator([)integer(0)operator(])
+
+ ident(key) operator(=) ident(key)operator(.)ident(gsub)operator(()regexpoperator(\)) reserved(do) operator(|)ident(char)operator(|)
+ string operator(+) ident(char)operator([)integer(1)operator(,)integer(1)operator(])operator(.)ident(upcase)
+ reserved(end)
+
+ global_variable($stdout)operator(.)ident(print) stringcontent(: )inlinechar(\\r)char(\\n)delimiter(")>
+ reserved(end)
+ ident(cookies) operator(=) constant(Cookie)operator(.)ident(getHttpHeader) comment(# Get all cookies as an HTTP Header)
+ reserved(if) ident(cookies)
+ global_variable($stdout)operator(.)ident(print) ident(cookies)
+ reserved(end)
+
+ global_variable($stdout)operator(.)ident(print) string
+
+ reserved(elsif) instance_variable(@output_method) operator(==) string
+ reserved(elsif) instance_variable(@output_method) operator(==) string
+ ident(r) operator(=) constant(Apache)operator(.)ident(request)
+
+ reserved(if) operator(()operator(()instance_variable(@status) operator(==) pre_constant(nil) reserved(or) instance_variable(@status) operator(==) integer(200)operator(\)) reserved(and) operator(!)instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\)) reserved(and) operator(!)instance_variable(@header)operator(.)ident(has_key?)operator(()stringoperator(\))operator(\))
+ ident(header)operator(()stringoperator(\))
+ reserved(end)
+
+ reserved(if) instance_variable(@status) operator(!=) pre_constant(nil)
+ ident(r)operator(.)ident(status_line) operator(=) stringcontent( )inlinedelimiter(")>
+ reserved(end)
+
+ ident(r)operator(.)ident(send_http_header)
+ instance_variable(@header)operator(.)ident(each) reserved(do) operator(|)ident(key)operator(,) ident(value)operator(|)
+ ident(key) operator(=) ident(key) operator(*)integer(1) comment(# "unfreeze" key :\))
+
+ ident(key)operator([)integer(0)operator(]) operator(=) ident(key)operator([)integer(0)operator(,)integer(1)operator(])operator(.)ident(upcase!)operator([)integer(0)operator(])
+ ident(key) operator(=) ident(key)operator(.)ident(gsub)operator(()regexpoperator(\)) reserved(do) operator(|)ident(char)operator(|)
+ string operator(+) ident(char)operator([)integer(1)operator(,)integer(1)operator(])operator(.)ident(upcase)
+ reserved(end)
+ ident(puts) stringcontent(: )inlinedelimiter(")>
+ comment(#r.headers_out[key] = value)
+ reserved(end)
+ reserved(end)
+ instance_variable(@output_started) operator(=) pre_constant(true)
+ comment(# }}})
+ reserved(end)
+
+ reserved(def) method(getReasonPhrase) operator(()ident(status)operator(\))
+ comment(# {{{)
+ reserved(if) ident(status) operator(==) integer(100)
+ string
+ reserved(elsif) ident(status) operator(==) integer(101)
+ string
+ reserved(elsif) ident(status) operator(==) integer(200)
+ string
+ reserved(elsif) ident(status) operator(==) integer(201)
+ string
+ reserved(elsif) ident(status) operator(==) integer(202)
+ string
+ reserved(elsif) ident(status) operator(==) integer(203)
+ string
+ reserved(elsif) ident(status) operator(==) integer(204)
+ string
+ reserved(elsif) ident(status) operator(==) integer(205)
+ string
+ reserved(elsif) ident(status) operator(==) integer(206)
+ string
+ reserved(elsif) ident(status) operator(==) integer(300)
+ string
+ reserved(elsif) ident(status) operator(==) integer(301)
+ string
+ reserved(elsif) ident(status) operator(==) integer(302)
+ string
+ reserved(elsif) ident(status) operator(==) integer(303)
+ string
+ reserved(elsif) ident(status) operator(==) integer(304)
+ string
+ reserved(elsif) ident(status) operator(==) integer(305)
+ string
+ reserved(elsif) ident(status) operator(==) integer(307)
+ string
+ reserved(elsif) ident(status) operator(==) integer(400)
+ string
+ reserved(elsif) ident(status) operator(==) integer(401)
+ string
+ reserved(elsif) ident(status) operator(==) integer(402)
+ string
+ reserved(elsif) ident(status) operator(==) integer(403)
+ string
+ reserved(elsif) ident(status) operator(==) integer(404)
+ string
+ reserved(elsif) ident(status) operator(==) integer(405)
+ string
+ reserved(elsif) ident(status) operator(==) integer(406)
+ string
+ reserved(elsif) ident(status) operator(==) integer(407)
+ string
+ reserved(elsif) ident(status) operator(==) integer(408)
+ string
+ reserved(elsif) ident(status) operator(==) integer(409)
+ string
+ reserved(elsif) ident(status) operator(==) integer(410)
+ string
+ reserved(elsif) ident(status) operator(==) integer(411)
+ string
+ reserved(elsif) ident(status) operator(==) integer(412)
+ string
+ reserved(elsif) ident(status) operator(==) integer(413)
+ string
+ reserved(elsif) ident(status) operator(==) integer(414)
+ string
+ reserved(elsif) ident(status) operator(==) integer(415)
+ string
+ reserved(elsif) ident(status) operator(==) integer(416)
+ string
+ reserved(elsif) ident(status) operator(==) integer(417)
+ string
+ reserved(elsif) ident(status) operator(==) integer(500)
+ string
+ reserved(elsif) ident(status) operator(==) integer(501)
+ string
+ reserved(elsif) ident(status) operator(==) integer(502)
+ string
+ reserved(elsif) ident(status) operator(==) integer(503)
+ string
+ reserved(elsif) ident(status) operator(==) integer(504)
+ string
+ reserved(elsif) ident(status) operator(==) integer(505)
+ string
+ reserved(else)
+ ident(raise) string
+ reserved(end)
+ comment(# }}})
+ reserved(end)
+reserved(end)
+
+reserved(class) class(Cookie)
+ ident(attr_reader) symbol(:name)operator(,) symbol(:value)operator(,) symbol(:maxage)operator(,) symbol(:path)operator(,) symbol(:domain)operator(,) symbol(:secure)operator(,) symbol(:comment)
+
+ comment(# Sets a cookie. Please see below for details of the attributes.)
+ reserved(def) method(initialize) operator(()ident(name)operator(,) ident(value) operator(=) pre_constant(nil)operator(,) ident(maxage) operator(=) pre_constant(nil)operator(,) ident(path) operator(=) pre_constant(nil)operator(,) ident(domain) operator(=) pre_constant(nil)operator(,) ident(secure) operator(=) pre_constant(false)operator(\))
+ comment(# {{{)
+ comment(# HTTP headers (Cookies are a HTTP header\) can only set, while no content)
+ comment(# is send. So an exception will be raised, when @@allowed is set to false)
+ comment(# and a new cookie has set.)
+ reserved(unless) reserved(defined?)operator(()class_variable(@@allowed)operator(\))
+ class_variable(@@allowed) operator(=) pre_constant(true)
+ reserved(end)
+ reserved(unless) class_variable(@@allowed)
+ ident(raise) string
+ reserved(end)
+
+ reserved(unless) reserved(defined?)operator(()class_variable(@@list)operator(\))
+ class_variable(@@list) operator(=) operator([)operator(])
+ reserved(end)
+ class_variable(@@list) operator(+=) operator([)pre_constant(self)operator(])
+
+ reserved(unless) reserved(defined?)operator(()class_variable(@@type)operator(\))
+ class_variable(@@type) operator(=) string
+ reserved(end)
+
+ reserved(unless) ident(name)operator(.)ident(class) operator(==) constant(String)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ reserved(if) ident(value)operator(.)ident(class)operator(.)ident(superclass) operator(==) constant(Integer) operator(||) ident(value)operator(.)ident(class) operator(==) constant(Float)
+ ident(value) operator(=) ident(value)operator(.)ident(to_s)
+ reserved(elsif) ident(value)operator(.)ident(class) operator(!=) constant(String) operator(&&) ident(value) operator(!=) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ reserved(if) ident(maxage)operator(.)ident(class) operator(==) constant(Time)
+ ident(maxage) operator(=) ident(maxage) operator(-) constant(Time)operator(.)ident(now)
+ reserved(elsif) operator(!)ident(maxage)operator(.)ident(class)operator(.)ident(superclass) operator(==) constant(Integer) operator(||) operator(!)ident(maxage) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ reserved(unless) ident(path)operator(.)ident(class) operator(==) constant(String) operator(||) ident(path) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ reserved(unless) ident(domain)operator(.)ident(class) operator(==) constant(String) operator(||) ident(domain) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ reserved(unless) ident(secure) operator(==) pre_constant(true) operator(||) ident(secure) operator(==) pre_constant(false)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+
+ instance_variable(@name)operator(,) instance_variable(@value)operator(,) instance_variable(@maxage)operator(,) instance_variable(@path)operator(,) instance_variable(@domain)operator(,) instance_variable(@secure) operator(=) ident(name)operator(,) ident(value)operator(,) ident(maxage)operator(,) ident(path)operator(,) ident(domain)operator(,) ident(secure)
+ instance_variable(@comment) operator(=) pre_constant(nil)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Modifies the value of this cookie. The information you want to store. If the)
+ comment(# value is nil, the cookie will be deleted by the client.)
+ comment(#)
+ comment(# This attribute can be a String, Integer or Float object or nil.)
+ reserved(def) method(value=)operator(()ident(value)operator(\))
+ comment(# {{{)
+ reserved(if) ident(value)operator(.)ident(class)operator(.)ident(superclass) operator(==) constant(Integer) operator(||) ident(value)operator(.)ident(class) operator(==) constant(Float)
+ ident(value) operator(=) ident(value)operator(.)ident(to_s)
+ reserved(elsif) ident(value)operator(.)ident(class) operator(!=) constant(String) operator(&&) ident(value) operator(!=) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ instance_variable(@value) operator(=) ident(value)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Modifies the maxage of this cookie. This attribute defines the lifetime of)
+ comment(# the cookie, in seconds. A value of 0 means the cookie should be discarded)
+ comment(# imediatly. If it set to nil, the cookie will be deleted when the browser)
+ comment(# will be closed.)
+ comment(#)
+ comment(# Attention: This is different from other implementations like PHP, where you)
+ comment(# gives the seconds since 1/1/1970 0:00:00 GMT.)
+ comment(#)
+ comment(# This attribute must be an Integer or Time object or nil.)
+ reserved(def) method(maxage=)operator(()ident(maxage)operator(\))
+ comment(# {{{)
+ reserved(if) ident(maxage)operator(.)ident(class) operator(==) constant(Time)
+ ident(maxage) operator(=) ident(maxage) operator(-) constant(Time)operator(.)ident(now)
+ reserved(elsif) ident(maxage)operator(.)ident(class)operator(.)ident(superclass) operator(==) constant(Integer) operator(||) operator(!)ident(maxage) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ instance_variable(@maxage) operator(=) ident(maxage)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Modifies the path value of this cookie. The client will send this cookie)
+ comment(# only, if the requested document is this directory or a subdirectory of it.)
+ comment(#)
+ comment(# The value of the attribute must be a String object or nil.)
+ reserved(def) method(path=)operator(()ident(path)operator(\))
+ comment(# {{{)
+ reserved(unless) ident(path)operator(.)ident(class) operator(==) constant(String) operator(||) ident(path) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ instance_variable(@path) operator(=) ident(path)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Modifies the domain value of this cookie. The client will send this cookie)
+ comment(# only if it's connected with this domain (or a subdomain, if the first)
+ comment(# character is a dot like in ".ruby-lang.org"\))
+ comment(#)
+ comment(# The value of this attribute must be a String or nil.)
+ reserved(def) method(domain=)operator(()ident(domain)operator(\))
+ comment(# {{{)
+ reserved(unless) ident(domain)operator(.)ident(class) operator(==) constant(String) operator(||) ident(domain) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ instance_variable(@domain) operator(=) ident(domain)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Modifies the secure flag of this cookie. If it's true, the client will only)
+ comment(# send this cookie if it is secured connected with us.)
+ comment(#)
+ comment(# The value od this attribute has to be true or false.)
+ reserved(def) method(secure=)operator(()ident(secure)operator(\))
+ comment(# {{{)
+ reserved(unless) ident(secure) operator(==) pre_constant(true) operator(||) ident(secure) operator(==) pre_constant(false)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ instance_variable(@secure) operator(=) ident(secure)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Modifies the comment value of this cookie. The comment won't be send, if)
+ comment(# type is "netscape".)
+ reserved(def) method(comment=)operator(()ident(comment)operator(\))
+ comment(# {{{)
+ reserved(unless) ident(comment)operator(.)ident(class) operator(==) constant(String) operator(||) ident(comment) operator(==) pre_constant(nil)
+ ident(raise) constant(TypeError)operator(,) stringoperator(,) ident(caller)
+ reserved(end)
+ instance_variable(@comment) operator(=) ident(comment)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Changes the type of all cookies.)
+ comment(# Allowed values are RFC2109 and netscape (default\).)
+ reserved(def) constant(Cookie)operator(.)ident(type)operator(=)operator(()ident(type)operator(\))
+ comment(# {{{)
+ reserved(unless) class_variable(@@allowed)
+ ident(raise) string
+ reserved(end)
+ reserved(unless) ident(type)operator(.)ident(downcase) operator(==) string operator(&&) ident(type)operator(.)ident(downcase) operator(==) string
+ ident(raise) string
+ reserved(end)
+ class_variable(@@type) operator(=) ident(type)operator(;)
+ comment(# }}})
+ reserved(end)
+
+ comment(# After sending this message, no cookies can be set or modified. Use it, when)
+ comment(# HTTP-Headers are send. Rweb does this for you.)
+ reserved(def) constant(Cookie)operator(.)ident(disallow)
+ comment(# {{{)
+ class_variable(@@allowed) operator(=) pre_constant(false)
+ pre_constant(true)
+ comment(# }}})
+ reserved(end)
+
+ comment(# Returns a HTTP header (type String\) with all cookies. Rweb does this for)
+ comment(# you.)
+ reserved(def) constant(Cookie)operator(.)ident(getHttpHeader)
+ comment(# {{{)
+ reserved(if) reserved(defined?)operator(()class_variable(@@list)operator(\))
+ reserved(if) class_variable(@@type) operator(==) string
+ ident(str) operator(=) string
+ class_variable(@@list)operator(.)ident(each) reserved(do) operator(|)ident(cookie)operator(|)
+ reserved(if) ident(cookie)operator(.)ident(value) operator(==) pre_constant(nil)
+ ident(cookie)operator(.)ident(maxage) operator(=) integer(0)
+ ident(cookie)operator(.)ident(value) operator(=) string
+ reserved(end)
+ comment(# TODO: Name and value should be escaped!)
+ ident(str) operator(+=) stringcontent(=)inlinedelimiter(")>
+ reserved(unless) ident(cookie)operator(.)ident(maxage) operator(==) pre_constant(nil)
+ ident(expire) operator(=) constant(Time)operator(.)ident(now) operator(+) ident(cookie)operator(.)ident(maxage)
+ ident(expire)operator(.)ident(gmtime)
+ ident(str) operator(+=) stringoperator(\))delimiter(})>delimiter(")>
+ reserved(end)
+ reserved(unless) ident(cookie)operator(.)ident(domain) operator(==) pre_constant(nil)
+ ident(str) operator(+=) stringdelimiter(")>
+ reserved(end)
+ reserved(unless) ident(cookie)operator(.)ident(path) operator(==) pre_constant(nil)
+ ident(str) operator(+=) stringdelimiter(")>
+ reserved(end)
+ reserved(if) ident(cookie)operator(.)ident(secure)
+ ident(str) operator(+=) string
+ reserved(end)
+ ident(str) operator(+=) string
+ reserved(end)
+ reserved(return) ident(str)
+ reserved(else) comment(# type == "RFC2109")
+ ident(str) operator(=) string
+ ident(comma) operator(=) pre_constant(false)operator(;)
+
+ class_variable(@@list)operator(.)ident(each) reserved(do) operator(|)ident(cookie)operator(|)
+ reserved(if) ident(cookie)operator(.)ident(value) operator(==) pre_constant(nil)
+ ident(cookie)operator(.)ident(maxage) operator(=) integer(0)
+ ident(cookie)operator(.)ident(value) operator(=) string
+ reserved(end)
+ reserved(if) ident(comma)
+ ident(str) operator(+=) string
+ reserved(end)
+ ident(comma) operator(=) pre_constant(true)
+
+ ident(str) operator(+=) stringcontent(=)char(\\")inlinechar(\\")delimiter(")>
+ reserved(unless) ident(cookie)operator(.)ident(maxage) operator(==) pre_constant(nil)
+ ident(str) operator(+=) stringchar(\\")delimiter(")>
+ reserved(end)
+ reserved(unless) ident(cookie)operator(.)ident(domain) operator(==) pre_constant(nil)
+ ident(str) operator(+=) stringchar(\\")delimiter(")>
+ reserved(end)
+ reserved(unless) ident(cookie)operator(.)ident(path) operator(==) pre_constant(nil)
+ ident(str) operator(+=) stringchar(\\")delimiter(")>
+ reserved(end)
+ reserved(if) ident(cookie)operator(.)ident(secure)
+ ident(str) operator(+=) string
+ reserved(end)
+ reserved(unless) ident(cookie)operator(.)ident(comment) operator(==) pre_constant(nil)
+ ident(str) operator(+=) stringchar(\\")delimiter(")>
+ reserved(end)
+ ident(str) operator(+=) string
+ reserved(end)
+ ident(str)
+ reserved(end)
+ reserved(else)
+ pre_constant(false)
+ reserved(end)
+ comment(# }}})
+ reserved(end)
+reserved(end)
+
+ident(require) string
+
+reserved(module) class(BBCode)
+ constant(DEBUG) operator(=) pre_constant(true)
+
+ ident(use) stringoperator(,) stringoperator(,) stringoperator(,) string
+
+comment(=begin
+ The Parser class takes care of the encoding.
+ It scans the given BBCode (as plain text\), finds tags
+ and smilies and also makes links of urls in text.
+
+ Normal text is send directly to the encoder.
+
+ If a tag was found, an instance of a Tag subclass is created
+ to handle the case.
+
+ The @tagstack manages tag nesting and ensures valid HTML.
+=end)
+
+ reserved(class) class(Parser)
+ reserved(class) class(Attribute)
+ comment(# flatten and use only one empty_arg)
+ reserved(def) pre_constant(self)operator(.)ident(create) ident(attr)
+ ident(attr) operator(=) ident(flatten) ident(attr)
+ reserved(return) class_variable(@@empty_attr) reserved(if) ident(attr)operator(.)ident(empty?)
+ ident(new) ident(attr)
+ reserved(end)
+
+ ident(private_class_method) symbol(:new)
+
+ comment(# remove leading and trailing whitespace; concat lines)
+ reserved(def) pre_constant(self)operator(.)ident(flatten) ident(attr)
+ ident(attr)operator(.)ident(strip)operator(.)ident(gsub)operator(()regexpoperator(,) stringoperator(\))
+ comment(# -> ^ and $ can only match at begin and end now)
+ reserved(end)
+
+ constant(ATTRIBUTE_SCAN) operator(=) regexp
+
+ reserved(def) pre_constant(self)operator(.)ident(parse) ident(source)
+ ident(source) operator(=) ident(source)operator(.)ident(dup)
+ comment(# empty_tag: the tag looks like [... /])
+ comment(# slice!: this deletes the \\s*/] at the end)
+ comment(# \\s+ because [url=http://rubybb.org/forum/] is NOT an empty tag.)
+ comment(# In RubyBBCode, you can use [url=http://rubybb.org/forum/ /], and this has to be)
+ comment(# interpreted correctly.)
+ ident(empty_tag) operator(=) ident(source)operator(.)ident(sub!)operator(()regexpoperator(,) stringoperator(\)) reserved(or) ident(source)operator(.)ident(slice!)operator(()regexpoperator(\))
+ ident(debug) string operator(+) ident(source)operator(.)ident(inspect) operator(+) string )delimiter(')> operator(+) ident(empty_tag)operator(.)ident(inspect)
+ comment(#-> we have now an attr that's EITHER empty OR begins and ends with non-whitespace.)
+
+ ident(attr) operator(=) constant(Hash)operator(.)ident(new)
+ ident(attr)operator([)symbol(:flags)operator(]) operator(=) operator([)operator(])
+ ident(source)operator(.)ident(scan)operator(()constant(ATTRIBUTE_SCAN)operator(\)) operator({) operator(|)ident(key)operator(,) ident(value)operator(|)
+ reserved(if) reserved(not) ident(value)
+ ident(attr)operator([)symbol(:flags)operator(]) operator(<<) ident(unescape)operator(()ident(key)operator(\))
+ reserved(else)
+ reserved(next) reserved(if) ident(value)operator(.)ident(empty?) reserved(and) ident(key)operator(.)ident(empty?)
+ ident(attr)operator([)ident(unescape)operator(()ident(key)operator(\))operator(]) operator(=) ident(unescape)operator(()ident(value)operator(\))
+ reserved(end)
+ operator(})
+ ident(debug) ident(attr)operator(.)ident(inspect)
+
+ reserved(return) ident(empty_tag)operator(,) ident(attr)
+ reserved(end)
+
+ reserved(def) pre_constant(self)operator(.)ident(unescape_char) ident(esc)
+ ident(esc)operator([)integer(1)operator(])
+ reserved(end)
+
+ reserved(def) pre_constant(self)operator(.)ident(unquote) ident(qt)
+ ident(qt)operator([)integer(1)operator(..)integer(-1)operator(])operator(.)ident(chomp)operator(()stringoperator(\))operator(.)ident(gsub)operator(()regexpoperator(\)) operator({) operator(|)ident(esc)operator(|) ident(unescape_char) ident(esc) operator(})
+ reserved(end)
+
+ reserved(def) pre_constant(self)operator(.)ident(unescape) ident(str)
+ ident(str)operator(.)ident(gsub)operator(()regexpoperator(\)) operator({)
+ reserved(if) global_variable($1)
+ ident(unescape_char) global_variable($1)
+ reserved(else)
+ ident(unquote) global_variable($2)
+ reserved(end)
+ operator(})
+ reserved(end)
+
+ ident(include) constant(Enumerable)
+ reserved(def) method(each) operator(&)ident(block)
+ instance_variable(@args)operator(.)ident(each)operator(()operator(&)ident(block)operator(\))
+ reserved(end)
+
+ ident(attr_reader) symbol(:source)operator(,) symbol(:args)operator(,) symbol(:value)
+
+ reserved(def) method(initialize) ident(source)
+ instance_variable(@source) operator(=) ident(source)
+ ident(debug) string operator(%) ident(source)
+ instance_variable(@empty_tag)operator(,) instance_variable(@attr) operator(=) constant(Attribute)operator(.)ident(parse) ident(source)
+ instance_variable(@value) operator(=) instance_variable(@attr)operator([)stringoperator(])operator(.)ident(to_s)
+ reserved(end)
+
+ reserved(def) method(empty?)
+ pre_constant(self) operator(==) class_variable(@@empty_attr)
+ reserved(end)
+
+ reserved(def) method(empty_tag?)
+ instance_variable(@empty_tag)
+ reserved(end)
+
+ reserved(def) method([]) operator(*)ident(keys)
+ ident(res) operator(=) instance_variable(@attr)operator([)operator(*)ident(keys)operator(])
+ reserved(end)
+
+ reserved(def) method(flags)
+ ident(attr)operator([)symbol(:flags)operator(])
+ reserved(end)
+
+ reserved(def) method(to_s)
+ instance_variable(@attr)
+ reserved(end)
+
+ reserved(def) method(inspect)
+ string operator(+) instance_variable(@attr)operator(.)ident(inspect) operator(+) operator(()instance_variable(@empty_tag) operator(?) string operator(:) stringoperator(\)) operator(+) string
+ reserved(end)
+ reserved(end)
+ reserved(class) class(Attribute)
+ class_variable(@@empty_attr) operator(=) ident(new) string
+ reserved(end)
+ reserved(end)
+
+ reserved(class) class(Parser)
+ reserved(def) constant(Parser)operator(.)ident(flatten) ident(str)
+ comment(# replace mac & dos newlines with unix style)
+ ident(str)operator(.)ident(gsub)operator(()regexpoperator(,) stringoperator(\))
+ reserved(end)
+
+ reserved(def) method(initialize) ident(input) operator(=) string
+ comment(# input manager)
+ instance_variable(@scanner) operator(=) constant(StringScanner)operator(.)ident(new) string
+ comment(# output manager)
+ instance_variable(@encoder) operator(=) constant(Encoder)operator(.)ident(new)
+ instance_variable(@output) operator(=) string
+ comment(# tag manager)
+ instance_variable(@tagstack) operator(=) constant(TagStack)operator(.)ident(new)operator(()instance_variable(@encoder)operator(\))
+
+ instance_variable(@do_magic) operator(=) pre_constant(true)
+ comment(# set the input)
+ ident(feed) ident(input)
+ reserved(end)
+
+ comment(# if you want, you can feed a parser instance after creating,)
+ comment(# or even feed it repeatedly.)
+ reserved(def) method(feed) ident(food)
+ instance_variable(@scanner)operator(.)ident(string) operator(=) constant(Parser)operator(.)ident(flatten) ident(food)
+ reserved(end)
+
+ comment(# parse through the string using parse_token)
+ reserved(def) method(parse)
+ ident(parse_token) reserved(until) instance_variable(@scanner)operator(.)ident(eos?)
+ instance_variable(@tagstack)operator(.)ident(close_all)
+ instance_variable(@output) operator(=) ident(parse_magic) instance_variable(@encoder)operator(.)ident(output)
+ reserved(end)
+
+ reserved(def) method(output)
+ instance_variable(@output)
+ reserved(end)
+
+ comment(# ok, internals start here)
+ ident(private)
+ comment(# the default output functions. everything should use them or the tags.)
+ reserved(def) method(add_text) ident(text) operator(=) instance_variable(@scanner)operator(.)ident(matched)
+ instance_variable(@encoder)operator(.)ident(add_text) ident(text)
+ reserved(end)
+
+ comment(# use this carefully)
+ reserved(def) method(add_html) ident(html)
+ instance_variable(@encoder)operator(.)ident(add_html) ident(html)
+ reserved(end)
+
+ comment(# highlights the text as error)
+ reserved(def) method(add_garbage) ident(garbage)
+ ident(add_html) string)delimiter(')> reserved(if) constant(DEBUG)
+ ident(add_text) ident(garbage)
+ ident(add_html) string)delimiter(')> reserved(if) constant(DEBUG)
+ reserved(end)
+
+ comment(# unknown and incorrectly nested tags are ignored and)
+ comment(# sent as plaintext (garbage in - garbage out\).)
+ comment(# in debug mode, garbage is marked with lime background.)
+ reserved(def) method(garbage_out) ident(start)
+ instance_variable(@scanner)operator(.)ident(pos) operator(=) ident(start)
+ ident(garbage) operator(=) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(debug) string operator(+) ident(garbage)
+ ident(add_garbage) ident(garbage)
+ reserved(end)
+
+ comment(# simple text; everything but [, \\[ allowed)
+ constant(SIMPLE_TEXT_SCAN_) operator(=) regexp
+ constant(SIMPLE_TEXT_SCAN) operator(=) regexp
+
+comment(=begin
+
+ WHAT IS A TAG?
+ ==============
+
+ Tags in BBCode can be much more than just a simple [b].
+ I use many terms here to differ the parts of each tag.
+
+ Basic scheme:
+ [ code ]
+ TAG START TAG INFO TAG END
+
+ Most tags need a second tag to close the range it opened.
+ This is done with CLOSING TAGS:
+ [/code]
+ or by using empty tags that have no content and close themselfes:
+ [url=winamp.com /]
+ You surely know this from HTML.
+ These slashes define the TAG KIND = normal|closing|empty and
+ cannot be used together.
+
+ Everything between [ and ] and expluding the slashes is called the
+ TAG INFO. This info may contain:
+ - TAG ID
+ - TAG NAME including the tag id
+ - attributes
+
+ The TAG ID is the first char of the info:
+
+ TAG | ID
+ ----------+----
+ [quote] | q
+ [±] | &
+ ["[b]"] | "
+ [/url] | u
+ [---] | -
+
+ As you can see, the tag id shows the TAG TYPE, it can be a
+ normal tag, a formatting tag or an entity.
+ Therefor, the parser first scans the id to decide how to go
+ on with parsing.
+=end)
+ comment(# tag)
+ comment(# TODO more complex expression allowing)
+ comment(# [quote="[ladico]"] and [quote=\\[ladico\\]] to be correct tags)
+ constant(TAG_BEGIN_SCAN) operator(=) regexp
+ constant(TAG_END_SCAN) operator(=) regexp
+ constant(CLOSE_TAG_SCAN) operator(=) regexp
+ constant(UNCLOSED_TAG_SCAN) operator(=) regexp
+
+ constant(CLASSIC_TAG_SCAN) operator(=) regexp
+
+ constant(SEPARATOR_TAG_SCAN) operator(=) regexp
+
+ constant(FORMAT_TAG_SCAN) operator(=) regexp
+
+ constant(QUOTED_SCAN) operator(=) regexp
+
+ constant(ENTITY_SCAN) operator(=) regexp
+
+ constant(SMILEY_SCAN) operator(=) constant(Smileys)operator(::)constant(SMILEY_PATTERN)
+
+ comment(# this is the main parser loop that separates)
+ comment(# text - everything until "[")
+ comment(# from)
+ comment(# tags - starting with "[", ending with "]")
+ reserved(def) method(parse_token)
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(SIMPLE_TEXT_SCAN)operator(\))
+ ident(add_text)
+ reserved(else)
+ ident(handle_tag)
+ reserved(end)
+ reserved(end)
+
+ reserved(def) method(handle_tag)
+ ident(tag_start) operator(=) instance_variable(@scanner)operator(.)ident(pos)
+
+ reserved(unless) instance_variable(@scanner)operator(.)ident(scan) constant(TAG_BEGIN_SCAN)
+ ident(garbage_out) ident(tag_start)
+ reserved(return)
+ reserved(end)
+
+ ident(closing)operator(,) ident(id) operator(=) instance_variable(@scanner)operator([)integer(1)operator(])operator(,) instance_variable(@scanner)operator([)integer(2)operator(])
+ comment(#debug 'handle_tag(%p\)' % @scanner.matched)
+
+ ident(handled) operator(=)
+ reserved(case) ident(id)
+
+ reserved(when) regexp
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(CLASSIC_TAG_SCAN)operator(\))
+ reserved(if) ident(handle_classic_tag)operator(()ident(id) operator(+) instance_variable(@scanner)operator(.)ident(matched)operator(,) ident(closing)operator(\))
+ ident(already_closed) operator(=) pre_constant(true)
+ reserved(end)
+ reserved(end)
+
+ reserved(when) string
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(SEPARATOR_TAG_SCAN)operator(\))
+ ident(handle_asterisk) ident(tag_start)operator(,) ident(id) operator(+) instance_variable(@scanner)operator(.)ident(matched)
+ pre_constant(true)
+ reserved(end)
+
+ reserved(when) string
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(FORMAT_TAG_SCAN)operator(\))
+ comment(#format = id + @scanner.matched)
+ instance_variable(@encoder)operator(.)ident(add_html) string)char(\\n)delimiter(")>
+ pre_constant(true)
+ reserved(end)
+
+ reserved(when) string
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(QUOTED_SCAN)operator(\))
+ instance_variable(@encoder)operator(.)ident(add_text) ident(unescape)operator(()instance_variable(@scanner)operator([)integer(1)operator(])operator(\))
+ pre_constant(true)
+ reserved(end)
+
+ reserved(when) string
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(ENTITY_SCAN)operator(\))
+ instance_variable(@encoder)operator(.)ident(add_entity) instance_variable(@scanner)operator([)integer(1)operator(])
+ pre_constant(true)
+ reserved(end)
+
+ reserved(when) constant(Smileys)operator(::)constant(SMILEY_START_CHARSET)
+ instance_variable(@scanner)operator(.)ident(pos) operator(=) instance_variable(@scanner)operator(.)ident(pos) operator(-) integer(1) comment(# (ungetch\))
+ reserved(if) instance_variable(@scanner)operator(.)ident(scan)operator(()constant(SMILEY_SCAN)operator(\))
+ instance_variable(@encoder)operator(.)ident(add_html) constant(Smileys)operator(.)ident(smiley_to_image)operator(()instance_variable(@scanner)operator(.)ident(matched)operator(\))
+ pre_constant(true)
+ reserved(end)
+
+ reserved(end) comment(# case)
+
+ reserved(return) ident(garbage_out)operator(()ident(tag_start)operator(\)) reserved(unless) ident(handled)
+
+ instance_variable(@scanner)operator(.)ident(scan)operator(()constant(TAG_END_SCAN)operator(\)) reserved(unless) ident(already_closed)
+ reserved(end)
+
+ constant(ATTRIBUTES_SCAN) operator(=) regexp
+
+ reserved(def) method(handle_classic_tag) ident(name)operator(,) ident(closing)
+ ident(debug) string operator(+) operator(()ident(closing) operator(?) string operator(:) stringoperator(\)) operator(+) ident(name)
+ comment(# flatten)
+ ident(name)operator(.)ident(downcase!)
+ ident(tag_class) operator(=) constant(TAG_LIST)operator([)ident(name)operator(])
+ reserved(return) reserved(unless) ident(tag_class)
+
+ comment(#debug((opening ? 'OPEN ' : 'CLOSE '\) + tag_class.name\))
+
+ comment(# create an attribute object to handle it)
+ instance_variable(@scanner)operator(.)ident(scan)operator(()constant(ATTRIBUTES_SCAN)operator(\))
+ comment(#debug name + ':' + @scanner[1])
+ ident(attr) operator(=) constant(Attribute)operator(.)ident(create) instance_variable(@scanner)operator([)integer(1)operator(])
+ comment(#debug 'ATTRIBUTES %p ' % attr #unless attr.empty?)
+
+ comment(#debug 'closing: %p; name=%s, attr=%p' % [closing, name, attr])
+
+ comment(# OPEN)
+ reserved(if) reserved(not) ident(closing) reserved(and) ident(tag) operator(=) instance_variable(@tagstack)operator(.)ident(try_open_class)operator(()ident(tag_class)operator(,) ident(attr)operator(\))
+ comment(#debug 'opening')
+ ident(tag)operator(.)ident(do_open) instance_variable(@scanner)
+ comment(# this should be done by the tag itself.)
+ reserved(if) ident(attr)operator(.)ident(empty_tag?)
+ ident(tag)operator(.)ident(handle_empty)
+ instance_variable(@tagstack)operator(.)ident(close_tag)
+ reserved(elsif) ident(tag)operator(.)ident(special_content?)
+ ident(handle_special_content)operator(()ident(tag)operator(\))
+ instance_variable(@tagstack)operator(.)ident(close_tag)
+ comment(# # ignore asterisks directly after the opening; these are phpBBCode)
+ comment(# elsif tag.respond_to? :asterisk)
+ comment(# debug 'SKIP ASTERISKS: ' if @scanner.skip(ASTERISK_TAGS_SCAN\))
+ reserved(end)
+
+ comment(# CLOSE)
+ reserved(elsif) instance_variable(@tagstack)operator(.)ident(try_close_class)operator(()ident(tag_class)operator(\))
+ comment(#debug 'closing')
+ comment(# GARBAGE)
+ reserved(else)
+ reserved(return)
+ reserved(end)
+
+ pre_constant(true)
+ reserved(end)
+
+ reserved(def) method(handle_asterisk) ident(tag_start)operator(,) ident(stars)
+ comment(#debug 'ASTERISK: ' + stars.to_s)
+ comment(# rule for asterisk tags: they belong to the last tag)
+ comment(# that handles them. tags opened after this tag are closed.)
+ comment(# if no open tag uses them, all are closed.)
+ ident(tag) operator(=) instance_variable(@tagstack)operator(.)ident(close_all_until) operator({) operator(|)ident(tag)operator(|) ident(tag)operator(.)ident(respond_to?) symbol(:asterisk) operator(})
+ reserved(unless) ident(tag) reserved(and) ident(tag)operator(.)ident(asterisk) ident(stars)operator(,) instance_variable(@scanner)
+ ident(garbage_out) ident(tag_start)
+ reserved(end)
+ reserved(end)
+
+ reserved(def) method(handle_special_content) ident(tag)
+ ident(scanned) operator(=) instance_variable(@scanner)operator(.)ident(scan_until)operator(()ident(tag)operator(.)ident(closing_tag)operator(\))
+ reserved(if) ident(scanned)
+ ident(scanned)operator(.)ident(slice!)operator(()operator(-)operator(()instance_variable(@scanner)operator(.)ident(matched)operator(.)ident(size)operator(\))operator(..)integer(-1)operator(\))
+ reserved(else)
+ ident(scanned) operator(=) instance_variable(@scanner)operator(.)ident(scan)operator(()regexpoperator(\))operator(.)ident(to_s)
+ reserved(end)
+ comment(#debug 'SPECIAL CONTENT: ' + scanned)
+ ident(tag)operator(.)ident(handle_content)operator(()ident(scanned)operator(\))
+ reserved(end)
+
+ reserved(def) method(unescape) ident(text)
+ comment(# input: correctly formatted quoted string (without the quotes\))
+ ident(text)operator(.)ident(gsub)operator(()regexpoperator(\)) operator({) global_variable($1) reserved(or) global_variable($&) operator(})
+ reserved(end)
+
+
+ comment(# MAGIC FEAUTURES)
+
+ constant(URL_PATTERN) operator(=) regexp)char(\\w)content({3,}\):)char(\\/)char(\\/)content(\))char(\\S)content(+)delimiter(/)>
+ constant(EMAIL_PATTERN) operator(=) regexp[)char(\\w)char(\\-)content(_.]+\)@[)char(\\w)char(\\-)char(\\.)content(]+)char(\\.)char(\\w)content(+)delimiter(/)>
+
+ constant(HAS_MAGIC) operator(=) regexpcontent(]|(?i:www|ftp\))delimiter(/)>
+
+ constant(MAGIC_PATTERN) operator(=) constant(Regexp)operator(.)ident(new)operator(()string operator(%)
+ operator([)constant(Smileys)operator(::)constant(MAGIC_SMILEY_PATTERN)operator(,) constant(URL_PATTERN)operator(,) constant(EMAIL_PATTERN)operator(])operator(.)ident(map) operator({) operator(|)ident(pattern)operator(|)
+ ident(pattern)operator(.)ident(to_s)
+ operator(})operator(.)ident(join)operator(()stringoperator(\)) operator(\))
+
+ constant(IS_SMILEY_PATTERN) operator(=) constant(Regexp)operator(.)ident(new)operator(()string operator(%) constant(Smileys)operator(::)constant(SMILEY_START_CHARSET)operator(.)ident(to_s) operator(\))
+ constant(IS_URL_PATTERN) operator(=) regexp)char(\\w)content(+\):)char(\\/)char(\\/)content(\))delimiter(/)>
+ constant(URL_STARTS_WITH_PROTOCOL) operator(=) regexp
+ constant(IS_EMAIL_PATTERN) operator(=) regexp
+
+ reserved(def) method(to_magic) ident(text)
+ comment(# debug MAGIC_PATTERN.to_s)
+ ident(text)operator(.)ident(gsub!)operator(()constant(MAGIC_PATTERN)operator(\)) operator({)
+ ident(magic) operator(=) global_variable($2)
+ global_variable($1) operator(+) reserved(case) ident(magic)
+ reserved(when) constant(IS_SMILEY_PATTERN)
+ constant(Smileys)operator(.)ident(smiley_to_img) ident(magic)
+ reserved(when) constant(IS_URL_PATTERN)
+ ident(last) operator(=) ident(magic)operator(.)ident(slice_punctation!) comment(# no punctation in my URL)
+ ident(href) operator(=) ident(magic)
+ ident(href)operator(.)ident(insert)operator(()integer(0)operator(,) stringoperator(\)) reserved(unless) ident(magic) operator(=)operator(~) constant(URL_STARTS_WITH_PROTOCOL)
+ string)delimiter(')> operator(+) ident(magic) operator(+) string)delimiter(')> operator(+) ident(last)
+ reserved(when) constant(IS_EMAIL_PATTERN)
+ ident(last) operator(=) ident(magic)operator(.)ident(slice_punctation!)
+ string)delimiter(')> operator(+) ident(magic) operator(+) string)delimiter(')> operator(+) ident(last)
+ reserved(else)
+ ident(raise) string operator(+) ident(magic) operator(+) string
+ reserved(end)
+ operator(})
+ ident(text)
+ reserved(end)
+
+ comment(# handles smileys and urls)
+ reserved(def) method(parse_magic) ident(html)
+ reserved(return) ident(html) reserved(unless) instance_variable(@do_magic)
+ ident(scanner) operator(=) constant(StringScanner)operator(.)ident(new) ident(html)
+ ident(out) operator(=) string
+ reserved(while) ident(scanner)operator(.)ident(rest?)
+ reserved(if) ident(scanner)operator(.)ident(scan)operator(()regexp | pre)char(\\W)content( .*? <)char(\\/)content(pre> | [^>]* > \) )delimiter(/)modifier(mx)>operator(\))
+ ident(out) operator(<<) ident(scanner)operator(.)ident(matched)
+ reserved(elsif) ident(scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(out) operator(<<) ident(to_magic)operator(()ident(scanner)operator(.)ident(matched)operator(\))
+
+ comment(# this should never happen)
+ reserved(elsif) ident(scanner)operator(.)ident(scan)operator(()regexpoperator(\))
+ ident(raise) string
+ reserved(end)
+ reserved(end)
+ ident(out)
+ reserved(end)
+ reserved(end) comment(# Parser)
+reserved(end)
+
+reserved(class) class(String)
+ reserved(def) method(slice_punctation!)
+ ident(slice!)operator(()regexpoperator(\))operator(.)ident(to_s) comment(# return '' instead of nil)
+ reserved(end)
+reserved(end)
+
+comment(#)
+comment(# = Grammar)
+comment(#)
+comment(# An implementation of common algorithms on grammars.)
+comment(#)
+comment(# This is used by Shinobu, a visualization tool for educating compiler-building.)
+comment(#)
+comment(# Thanks to Andreas Kunert for his wonderful LR(k\) Pamphlet (German, see http://www.informatik.hu-berlin.de/~kunert/papers/lr-analyse\), and Aho/Sethi/Ullman for their Dragon Book.)
+comment(#)
+comment(# Homepage:: http://shinobu.cYcnus.de (not existing yet\))
+comment(# Author:: murphy (Kornelius Kalnbach\))
+comment(# Copyright:: (cc\) 2005 cYcnus)
+comment(# License:: GPL)
+comment(# Version:: 0.2.0 (2005-03-27\))
+
+ident(require) string
+ident(require) string
+ident(require) string
+ident(require) string
+ident(require) string
+
+ident(require) string
+ident(require) string
+
+comment(# = Grammar)
+comment(#)
+comment(# == Syntax)
+comment(#)
+comment(# === Rules)
+comment(#)
+comment(# Each line is a rule.)
+comment(# The syntax is)
+comment(#)
+comment(# left - right)
+comment(#)
+comment(# where +left+ and +right+ can be uppercase and lowercase letters,)
+comment(# and -
can be any combination of <, >, - or whitespace.)
+comment(#)
+comment(# === Symbols)
+comment(#)
+comment(# Uppercase letters stand for meta symbols, lowercase for terminals.)
+comment(#)
+comment(# You can make epsilon-derivations by leaving
empty.)
+comment(#)
+comment(# === Example)
+comment(# S - Ac)
+comment(# A - Sc)
+comment(# A - b)
+comment(# A -)
+reserved(class) class(Grammar)
+
+ ident(attr_reader) symbol(:tracer)
+ comment(# Creates a new Grammar.)
+ comment(# If $trace is true, the algorithms explain (textual\) what they do to $stdout.)
+ reserved(def) method(initialize) ident(data)operator(,) ident(tracer) operator(=) constant(Tracer)operator(.)ident(new)
+ instance_variable(@tracer) operator(=) ident(tracer)
+ instance_variable(@rules) operator(=) constant(Rules)operator(.)ident(new)
+ instance_variable(@terminals)operator(,) instance_variable(@meta_symbols) operator(=) constant(SortedSet)operator(.)ident(new)operator(,) constant(Array)operator(.)ident(new)
+ instance_variable(@start_symbol) operator(=) pre_constant(nil)
+ ident(add_rules) ident(data)
+ reserved(end)
+
+ ident(attr_reader) symbol(:meta_symbols)operator(,) symbol(:terminals)operator(,) symbol(:rules)operator(,) symbol(:start_symbol)
+
+ ident(alias_method) symbol(:sigma)operator(,) symbol(:terminals)
+ ident(alias_method) symbol(:alphabet)operator(,) symbol(:terminals)
+ ident(alias_method) symbol(:variables)operator(,) symbol(:meta_symbols)
+ ident(alias_method) symbol(:nonterminals)operator(,) symbol(:meta_symbols)
+
+ comment(# A string representation of the grammar for debugging.)
+ reserved(def) method(inspect) ident(productions_too) operator(=) pre_constant(false)
+ string operator(%)
+ operator([)
+ ident(meta_symbols)operator(.)ident(join)operator(()stringoperator(\))operator(,)
+ ident(terminals)operator(.)ident(join)operator(()stringoperator(\))operator(,)
+ reserved(if) ident(productions_too)
+ instance_variable(@rules)operator(.)ident(inspect)
+ reserved(else)
+ instance_variable(@rules)operator(.)ident(size)
+ reserved(end)operator(,)
+ ident(start_symbol)
+ operator(])
+ reserved(end)
+
+ comment(# Add rules to the grammar. +rules+ should be a String or respond to +scan+ in a similar way.)
+ comment(#)
+ comment(# Syntax: see Grammar.)
+ reserved(def) method(add_rules) ident(grammar)
+ instance_variable(@rules) operator(=) constant(Rules)operator(.)ident(parse) ident(grammar) reserved(do) operator(|)ident(rule)operator(|)
+ instance_variable(@start_symbol) operator(||=) ident(rule)operator(.)ident(left)
+ instance_variable(@meta_symbols) operator(<<) ident(rule)operator(.)ident(left)
+ instance_variable(@terminals)operator(.)ident(merge) ident(rule)operator(.)ident(right)operator(.)ident(split)operator(()stringoperator(\))operator(.)ident(select) operator({) operator(|)ident(s)operator(|) ident(terminal?) ident(s) operator(})
+ reserved(end)
+ instance_variable(@meta_symbols)operator(.)ident(uniq!)
+ ident(update)
+ reserved(end)
+
+ comment(# Returns a hash acting as FIRST operator, so that)
+ comment(# first["ABC"]
is FIRST(ABC\).)
+ comment(# See http://en.wikipedia.org/wiki/LL_parser "Constructing an LL(1\) parsing table" for details.)
+ reserved(def) method(first)
+ ident(first_operator)
+ reserved(end)
+
+ comment(# Returns a hash acting as FOLLOW operator, so that)
+ comment(# first["A"]
is FOLLOW(A\).)
+ comment(# See http://en.wikipedia.org/wiki/LL_parser "Constructing an LL(1\) parsing table" for details.)
+ reserved(def) method(follow)
+ ident(follow_operator)
+ reserved(end)
+
+ constant(LLError) operator(=) constant(Class)operator(.)ident(new)operator(()constant(Exception)operator(\))
+ constant(LLErrorType1) operator(=) constant(Class)operator(.)ident(new)operator(()constant(LLError)operator(\))
+ constant(LLErrorType2) operator(=) constant(Class)operator(.)ident(new)operator(()constant(LLError)operator(\))
+
+ comment(# Tests if the grammar is LL(1\).)
+ reserved(def) method(ll1?)
+ reserved(begin)
+ reserved(for) ident(meta) reserved(in) instance_variable(@meta_symbols)
+ ident(first_sets) operator(=) instance_variable(@rules)operator([)ident(meta)operator(])operator(.)ident(map) operator({) operator(|)ident(alpha)operator(|) ident(first)operator([)ident(alpha)operator(]) operator(})
+ ident(first_sets)operator(.)ident(inject)operator(()constant(Set)operator([)operator(])operator(\)) reserved(do) operator(|)ident(already_used)operator(,) ident(another_first_set)operator(|)
+ reserved(unless) ident(already_used)operator(.)ident(disjoint?) ident(another_first_set)
+ ident(raise) constant(LLErrorType1)
+ reserved(end)
+ ident(already_used)operator(.)ident(merge) ident(another_first_set)
+ reserved(end)
+
+ reserved(if) ident(first)operator([)ident(meta)operator(])operator(.)ident(include?) constant(EPSILON) reserved(and) reserved(not) ident(first)operator([)ident(meta)operator(])operator(.)ident(disjoint?) ident(follow)operator([)ident(meta)operator(])
+ ident(raise) constant(LLErrorType2)
+ reserved(end)
+ reserved(end)
+ reserved(rescue) constant(LLError)
+ pre_constant(false)
+ reserved(else)
+ pre_constant(true)
+ reserved(end)
+ reserved(end)
+
+ident(private)
+
+ reserved(def) method(first_operator)
+ instance_variable(@first) operator(||=) constant(FirstOperator)operator(.)ident(new) pre_constant(self)
+ reserved(end)
+
+ reserved(def) method(follow_operator)
+ instance_variable(@follow) operator(||=) constant(FollowOperator)operator(.)ident(new) pre_constant(self)
+ reserved(end)
+
+ reserved(def) method(update)
+ instance_variable(@first) operator(=) instance_variable(@follow) operator(=) pre_constant(nil)
+ reserved(end)
+
+reserved(end)
+
+reserved(if) global_variable($0) operator(==) pre_constant(__FILE__)
+ ident(eval) pre_constant(DATA)operator(.)ident(read)operator(,) pre_constant(nil)operator(,) global_variable($0)operator(,) pre_constant(__LINE__)integer(+4)
+reserved(end)
+
+ident(require) string
+
+reserved(class) class(TestCaseGrammar) operator(<) constant(Test)operator(::)constant(Unit)operator(::)constant(TestCase)
+
+ ident(include) constant(Grammar)operator(::)constant(Symbols)
+
+ reserved(def) method(fifo) ident(s)
+ constant(Set)operator([)operator(*)ident(s)operator(.)ident(split)operator(()stringoperator(\))operator(])
+ reserved(end)
+
+ reserved(def) method(test_fifo)
+ ident(assert_equal) constant(Set)operator([)operator(])operator(,) ident(fifo)operator(()stringoperator(\))
+ ident(assert_equal) constant(Set)operator([)constant(EPSILON)operator(,) constant(END_OF_INPUT)operator(,) stringoperator(,) stringoperator(])operator(,) ident(fifo)operator(()stringoperator(\))
+ reserved(end)
+
+ constant(TEST_GRAMMAR_1) operator(=) stringstring
+
+ reserved(def) method(test_symbols)
+ ident(assert) constant(EPSILON)
+ ident(assert) constant(END_OF_INPUT)
+ reserved(end)
+
+ reserved(def) method(test_first_1)
+ ident(g) operator(=) constant(Grammar)operator(.)ident(new) constant(TEST_GRAMMAR_1)
+
+ ident(f) operator(=) pre_constant(nil)
+ ident(assert_nothing_raised) operator({) ident(f) operator(=) ident(g)operator(.)ident(first) operator(})
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) constant(EPSILON)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) constant(EPSILON)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) constant(EPSILON)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) stringoperator(,) stringoperator(,) constant(EPSILON)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()ident(f)operator([)stringoperator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ reserved(end)
+
+ reserved(def) method(test_follow_1)
+ ident(g) operator(=) constant(Grammar)operator(.)ident(new) constant(TEST_GRAMMAR_1)
+
+ ident(f) operator(=) pre_constant(nil)
+ ident(assert_nothing_raised) operator({) ident(f) operator(=) ident(g)operator(.)ident(follow) operator(})
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) stringoperator(,) stringoperator(,) constant(END_OF_INPUT)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) stringoperator(,) stringoperator(,) constant(END_OF_INPUT)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) stringoperator(,) stringoperator(,) constant(END_OF_INPUT)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)constant(END_OF_INPUT)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ ident(assert_equal)operator(()constant(Set)operator([)constant(END_OF_INPUT)operator(])operator(,) ident(f)operator([)stringoperator(])operator(\))
+ reserved(end)
+
+
+ constant(TEST_GRAMMAR_2) operator(=) stringstring
+
+ reserved(def) method(test_first_2)
+ ident(g) operator(=) constant(Grammar)operator(.)ident(new) constant(TEST_GRAMMAR_2)
+
+ ident(f) operator(=) pre_constant(nil)
+ ident(assert_nothing_raised) operator({) ident(f) operator(=) ident(g)operator(.)ident(first) operator(})
+ ident(assert_equal)operator(()constant(Set)operator([)stringoperator(,) stringoperator(,) string