Exception: Synthra::Errors::IndentationError

Inherits:
ParseError show all
Defined in:
lib/synthra/errors.rb

Overview

Indentation error in DSL file

Raised when indentation doesn't match the expected pattern. Synthra uses 2-space indentation consistently.

Examples:

# User:
#    name: text  <- 3 spaces instead of 2

Constant Summary collapse

ERROR_CODE =
"INDENTATION_ERROR"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected:, actual:, **kwargs) ⇒ IndentationError

Create a new IndentationError

Parameters:

  • expected (Integer)

    expected number of spaces

  • actual (Integer)

    actual number of spaces found

  • kwargs (Hash)

    location information (line, column, source_line)



448
449
450
451
452
# File 'lib/synthra/errors.rb', line 448

def initialize(expected:, actual:, **kwargs)
  @expected = expected
  @actual = actual
  super("Invalid indentation: expected #{expected} spaces, got #{actual}", **kwargs)
end

Instance Attribute Details

#actualInteger (readonly)

Returns the actual number of spaces found.

Returns:

  • (Integer)

    the actual number of spaces found



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/synthra/errors.rb', line 436

class IndentationError < ParseError
  ERROR_CODE = "INDENTATION_ERROR"
  attr_reader :expected, :actual


  # Create a new IndentationError
  #
  # @param expected [Integer] expected number of spaces
  # @param actual [Integer] actual number of spaces found
  # @param kwargs [Hash] location information (line, column, source_line)
  #

  def initialize(expected:, actual:, **kwargs)
    @expected = expected
    @actual = actual
    super("Invalid indentation: expected #{expected} spaces, got #{actual}", **kwargs)
  end
end

#expectedInteger (readonly)

Returns the expected number of spaces.

Returns:

  • (Integer)

    the expected number of spaces



436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/synthra/errors.rb', line 436

class IndentationError < ParseError
  ERROR_CODE = "INDENTATION_ERROR"
  attr_reader :expected, :actual


  # Create a new IndentationError
  #
  # @param expected [Integer] expected number of spaces
  # @param actual [Integer] actual number of spaces found
  # @param kwargs [Hash] location information (line, column, source_line)
  #

  def initialize(expected:, actual:, **kwargs)
    @expected = expected
    @actual = actual
    super("Invalid indentation: expected #{expected} spaces, got #{actual}", **kwargs)
  end
end