Class: DocRSpec::Parser

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

Defined Under Namespace

Classes: InternalError, SyntaxError

Constant Summary collapse

COMMENT =
%r{\A \s* \# \s*}x
EMPTY_LINE =
%r{\A \s* \#+ \s* \z}x
EQUALS_OP =
%r{\s+ => \s+}x
EXAMPLE_LINE =
%r{\A \s* \#+ \s+ (.*)}x
START_EXAMPLE =
%r{\A \s* \#+ \s+ ```spec \s* (\# \s+)?(.*)?}x
START_RDOC_COMMENT =
%r{\A \s* \#\#}x
STOP_EXAMPLE =
%r{\A \s* \#+ \s+ ```}x
STOP_RDOC_COMMENT =
%r{\A \s* [^#]* \z}x

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



21
22
23
# File 'lib/doc_rspec/parser.rb', line 21

def ast
  @ast
end

#linesObject (readonly)

Returns the value of attribute lines.



21
22
23
# File 'lib/doc_rspec/parser.rb', line 21

def lines
  @lines
end

#stateObject (readonly)

Returns the value of attribute state.



21
22
23
# File 'lib/doc_rspec/parser.rb', line 21

def state
  @state
end

Instance Method Details

#parseObject



23
24
25
26
27
28
# File 'lib/doc_rspec/parser.rb', line 23

def parse
  lines.each_with_index do |line, lnb|
    parse_line(line, lnb.succ)
  end
  ast
end