Class: Processor
Overview
Class Processor does the actual work of processing input.
Constant Summary
collapse
- Disallowed =
i[ __binding__ __id__ __send__ class
clone display dup enum_for
eql? equal? extend freeze
frozen? hash inspect instance_eval
instance_exec instance_of? is_a? kind_of?
method methods nil? object_id
pretty_inspect private_methods protected_methods public_method
public_methods public_send respond_to? send
singleton_class singleton_method singleton_methods taint
tainted? tap to_enum to_s
trust untaint untrust untrusted?
define_singleton_method instance_variable_defined?
instance_variable_get instance_variable_set
remove_instance_variable instance_variables ]
Livetext::Standard::SimpleFormats, Livetext::Standard::TTY
Livetext::Helpers::Comment, Livetext::Helpers::DollarDot, Livetext::Helpers::DotCmd, Livetext::Helpers::ESCAPING, Livetext::Helpers::Sigil, Livetext::Helpers::Space, Livetext::Helpers::TTY
Instance Attribute Summary collapse
#data
Instance Method Summary
collapse
#backtrace, #banner, #bits, #br, #cinclude, #cleanup, #comment, #copy, #debug, #dlist, #dot_def, #dot_include, #errout, #func, #h1, #h2, #h3, #h4, #h5, #h6, #heading, #heredoc, #heredoc!, #image, #import, #inherit, #link, #list, #list!, #mixin, #mono, #newpage, #nopara, #nopass, #para, #passthru, #quit, #r, #raw, #reflection, #say, #seek, #set, #shell, #shell!, #table, #ttyout, #variables, #variables!, #xtable
#check_disallowed, #check_file_exists, #debug, #escape_html, #find_file, #friendly_error, #get_name_data, #grab_file, #graceful_error, #handle_dollar_dot, #handle_dotcmd, #handle_scomment, #include_file, #invoke_dotcmd, #onoff, #process_file, #process_line, #read_variables, rx, #search_upward, #set_variables, #setfile, #setfile!, #setvar, #showme
Constructor Details
#initialize(parent, output = nil) ⇒ Processor
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/livetext/processor.rb', line 26
def initialize(parent, output = nil)
@parent = parent || self
@parent.api ||= Livetext::UserAPI.new(@parent)
@nopass = false
@nopara = false
@output = ::Livetext.output = (output || File.open("/dev/null", "w"))
@sources = []
@indentation = @parent.indentation
@_mixins = []
@_imports = []
@html = HTML.new(@parent.api)
end
|
Instance Attribute Details
Returns the value of attribute parent.
24
25
26
|
# File 'lib/livetext/processor.rb', line 24
def parent
@parent
end
|
Returns the value of attribute sources.
24
25
26
|
# File 'lib/livetext/processor.rb', line 24
def sources
@sources
end
|
Instance Method Details
41
42
43
|
# File 'lib/livetext/processor.rb', line 41
def api
@parent.api
end
|
#disallowed?(name) ⇒ Boolean
57
58
59
60
|
# File 'lib/livetext/processor.rb', line 57
def disallowed?(name)
flag = Disallowed.include?(name.to_sym)
flag
end
|
#error(*args) ⇒ Object
53
54
55
|
# File 'lib/livetext/processor.rb', line 53
def error(*args)
::STDERR.puts *args
end
|
45
46
47
|
# File 'lib/livetext/processor.rb', line 45
def html
@html
end
|
79
80
81
82
83
84
85
86
87
|
# File 'lib/livetext/processor.rb', line 79
def nextline
return nil if @sources.empty?
line = @sources.last[0].next
@sources.last[2] += 1
line
rescue StopIteration
@sources.pop
nil
end
|
#output=(io) ⇒ Object
49
50
51
|
# File 'lib/livetext/processor.rb', line 49
def output=(io)
@output = io
end
|
#peek_nextline ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/livetext/processor.rb', line 66
def peek_nextline
return nil if @sources.empty?
source = @sources.last
line = source[0].peek
line
rescue StopIteration
@sources.pop
nil
rescue => err
TTY.puts "#{__method__}: RESCUE err = #{err.inspect}"
nil
end
|
#source(enum, file, line) ⇒ Object
62
63
64
|
# File 'lib/livetext/processor.rb', line 62
def source(enum, file, line)
@sources.push([enum, file, line])
end
|