Class: SydneyParser

Inherits:
Object
  • Object
show all
Defined in:
lib/sydparse.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.unified_sexp(var) ⇒ Object

Generate a sexp which includes comments from var. var is either a String or something that can become an IO object.



7
8
9
10
11
12
13
14
15
16
# File 'lib/sydparse.rb', line 7

def self.unified_sexp(var)
    if String === var
        syd = load_string var, true
    else
        syd = load_file var.to_io, false, true
    end
    
    return syd.unified_sexp
    
end

Instance Method Details

#unified_sexpObject

Generate a sexp which includes comments from var.



19
20
21
22
23
# File 'lib/sydparse.rb', line 19

def unified_sexp
    comms = collapse_per_line comments()
    x = sexp(true)
    insert_comments(x, comms)
end