Class: Treetop::Runtime::SyntaxNode

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

Direct Known Subclasses

Idl::ArrayLiteralSyntaxNode, Idl::ArraySizeSyntaxNode, Idl::AryAccessSyntaxNode, Idl::AryElementAssignmentSyntaxNode, Idl::AryRangeAssignmentSyntaxNode, Idl::BinaryExpressionRightSyntaxNode, Idl::BitfieldDefinitionSyntaxNode, Idl::BitsCastSyntaxNode, Idl::BuiltinEnumDefinitionSyntaxNode, Idl::BuiltinTypeNameSyntaxNode, Idl::BuiltinVariableSyntaxNode, Idl::CommentSyntaxNode, Idl::ConcatenationExpressionSyntaxNode, Idl::ConditionalReturnStatementSyntaxNode, Idl::ConditionalStatementSyntaxNode, Idl::CsrFieldAssignmentSyntaxNode, Idl::CsrFieldReadExpressionSyntaxNode, Idl::CsrFunctionCallSyntaxNode, Idl::CsrReadExpressionSyntaxNode, Idl::CsrSoftwareWriteSyntaxNode, Idl::CsrWriteSyntaxNode, Idl::DontCareLvalueSyntaxNode, Idl::DontCareReturnSyntaxNode, Idl::EnumArrayCastSyntaxNode, Idl::EnumCastSyntaxNode, Idl::EnumDefinitionSyntaxNode, Idl::EnumElementSizeSyntaxNode, Idl::EnumRefSyntaxNode, Idl::EnumSizeSyntaxNode, Idl::FieldAccessExpressionSyntaxNode, Idl::FieldAssignmentSyntaxNode, Idl::ForLoopSyntaxNode, Idl::FunctionBodySyntaxNode, Idl::FunctionCallExpressionSyntaxNode, Idl::FunctionDefSyntaxNode, Idl::GlobalSyntaxNode, Idl::GlobalWithInitializationSyntaxNode, Idl::IdSyntaxNode, Idl::IfSyntaxNode, Idl::IncludeStatementSyntaxNode, Idl::InstructionOperationSyntaxNode, Idl::IsaSyntaxNode, Idl::MultiVariableAssignmentSyntaxNode, Idl::MultiVariableDeclarationSyntaxNode, Idl::ParenExpressionSyntaxNode, Idl::PcAssignmentSyntaxNode, Idl::PostDecrementExpressionSyntaxNode, Idl::PostIncrementExpressionSyntaxNode, Idl::ReplicationExpressionSyntaxNode, Idl::ReturnExpressionSyntaxNode, Idl::ReturnStatementSyntaxNode, Idl::SignCastSyntaxNode, Idl::StatementSyntaxNode, Idl::StructDefinitionSyntaxNode, Idl::TernaryOperatorExpressionSyntaxNode, Idl::UnaryOperatorExpressionSyntaxNode, Idl::UserTypeNameSyntaxNode, Idl::VariableAssignmentSyntaxNode, Idl::VariableDeclarationSyntaxNode, Idl::VariableDeclarationWithInitializationSyntaxNode

Instance Method Summary collapse

Instance Method Details

#set_input_file(filename, starting_line = 0) ⇒ Object

remember where the code comes from

Parameters:

  • filename (String)

    Filename

  • starting_line (Integer) (defaults to: 0)

    Starting line in the file



27
28
29
30
31
32
33
34
# File 'lib/idl/ast.rb', line 27

def set_input_file(filename, starting_line = 0)
  @input_file = filename
  @starting_line = starting_line
  elements&.each do |child|
    child.set_input_file(filename, starting_line)
  end
  raise "?" if @starting_line.nil?
end

#set_input_file_unless_already_set(filename, starting_line = 0) ⇒ Object

Sets the input file for this syntax node unless it has already been set.

If the input file has not been set, it will be set with the given filename and starting line number.

Parameters:

  • filename (String)

    The name of the input file.

  • starting_line (Integer) (defaults to: 0)

    The starting line number in the input file.



17
18
19
20
21
# File 'lib/idl/ast.rb', line 17

def set_input_file_unless_already_set(filename, starting_line = 0)
  if @input_file.nil?
    set_input(filename, starting_line)
  end
end

#space?Boolean

Returns:

  • (Boolean)


36
# File 'lib/idl/ast.rb', line 36

def space? = false