Class: BELParser::Language::Semantics::DeeplyNestedStatementWarning

Inherits:
SemanticsWarning show all
Defined in:
lib/bel_parser/language/semantics/deeply_nested_statement.rb

Overview

DeeplyNestedStatementWarning defines a SemanticsWarning that indicates the nested statement threshold was exceeded.

Instance Attribute Summary collapse

Attributes inherited from SemanticsResult

#expression_node, #specification

Instance Method Summary collapse

Methods inherited from SemanticsWarning

#failure?, #success?

Methods inherited from SemanticsResult

#failure?, #msg, #success?

Constructor Details

#initialize(stmt_node, spec, nested_threshold, nested_number) ⇒ DeeplyNestedStatementWarning

Returns a new instance of DeeplyNestedStatementWarning.



50
51
52
53
54
# File 'lib/bel_parser/language/semantics/deeply_nested_statement.rb', line 50

def initialize(stmt_node, spec, nested_threshold, nested_number)
  super(stmt_node, spec)
  @nested_number    = nested_number
  @nested_threshold = nested_threshold
end

Instance Attribute Details

#nested_numberObject (readonly)

Returns the value of attribute nested_number.



48
49
50
# File 'lib/bel_parser/language/semantics/deeply_nested_statement.rb', line 48

def nested_number
  @nested_number
end

#nested_thresholdObject (readonly)

Returns the value of attribute nested_threshold.



48
49
50
# File 'lib/bel_parser/language/semantics/deeply_nested_statement.rb', line 48

def nested_threshold
  @nested_threshold
end

Instance Method Details

#to_sObject



56
57
58
59
60
61
# File 'lib/bel_parser/language/semantics/deeply_nested_statement.rb', line 56

def to_s
  <<-MSG.gsub(/ {12}/, '').delete("\n")
    Statement contains more than #{nested_threshold} nested statements
     (#{nested_number} nested statements).
  MSG
end