module BELParser::Language::Semantics::Builder

Builder contains methods to build semantic AST nodes. A convenient {Builder.build} method allows you to use these methods within a block scope.

see Builder.build

Public Class Methods

build(&block) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 69
def self.build(&block)
  raise ArgumentError, 'expecting block' unless block_given?

  builder = _builder_class.new
  builder.instance_eval(&block)
end

Private Class Methods

_builder_class() click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 76
def self._builder_class
  Class.new do
    include Builder
  end
end

Public Instance Methods

amino_acid_of(*amino_acids, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 153
def amino_acid_of(*amino_acids, **properties)
  SemanticAminoAcidOf.new(amino_acids, **properties)
end
any(**properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 116
def any(**properties)
  SemanticAny.new(**properties)
end
argument(param_or_term, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 91
def argument(param_or_term, **properties)
  cls = param_or_term.class
  if cls != SemanticParameter && cls != SemanticTerm
    raise ArgumentError, 'expected SemanticParameter or SemanticTerm'
  end

  SemanticArgument.new([param_or_term], **properties)
end
covalent_protein_modification_of(*mod_types, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 149
def covalent_protein_modification_of(*mod_types, **properties)
  SemanticCovalentProteinModificationOf.new(mod_types, **properties)
end
encoding_of(*encoding_types, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 145
def encoding_of(*encoding_types, **properties)
  SemanticEncodingOf.new(encoding_types, **properties)
end
function(identifier, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 87
def function(identifier, **properties)
  SemanticFunction.new([identifier], **properties)
end
function_of(*functions, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 133
def function_of(*functions, **properties)
  SemanticFunctionOf.new(functions, **properties)
end
has_encoding(**properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 129
def has_encoding(**properties)
  SemanticHasEncoding.new(**properties)
end
has_namespace(**properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 125
def has_namespace(**properties)
  SemanticHasNamespace.new(**properties)
end
identifier(*value_patterns, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 104
def identifier(*value_patterns, **properties)
  SemanticIdentifier.new(value_patterns, **properties)
end
is_amino_acid_range_pattern(**properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 157
def is_amino_acid_range_pattern(**properties)
  SemanticIsAminoAcidRange.new(**properties)
end
is_nil(**properties) click to toggle source

rubocop:disable Style/PredicateName

# File lib/bel_parser/language/semantics_ast.rb, line 121
def is_nil(**properties)
  SemanticIsNil.new(**properties)
end
is_sequence_position(**properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 161
def is_sequence_position(**properties)
  SemanticIsSequencePosition.new(**properties)
end
namespace_of(*namespaces, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 141
def namespace_of(*namespaces, **properties)
  SemanticNamespaceOf.new(namespaces, **properties)
end
parameter(prefix, value, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 100
def parameter(prefix, value, **properties)
  SemanticParameter.new([prefix, value], **properties)
end
prefix(*prefix_patterns, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 108
def prefix(*prefix_patterns, **properties)
  SemanticPrefix.new(prefix_patterns, **properties)
end
return_type_of(*return_types, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 137
def return_type_of(*return_types, **properties)
  SemanticReturnTypeOf.new(return_types, **properties)
end
term(function, *arguments, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 83
def term(function, *arguments, **properties)
  SemanticTerm.new([function, *arguments], **properties)
end
value(*value_patterns, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 112
def value(*value_patterns, **properties)
  SemanticValue.new(value_patterns, **properties)
end
variadic_arguments(*params_or_terms, **properties) click to toggle source
# File lib/bel_parser/language/semantics_ast.rb, line 165
def variadic_arguments(*params_or_terms, **properties)
  SemanticVariadicArguments.new(params_or_terms, **properties)
end