Module: BELParser::Language::Semantics::Builder
- Defined in:
- lib/bel_parser/language/semantics_ast.rb
Overview
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
Class Method Summary collapse
Instance Method Summary collapse
- #amino_acid_of(*amino_acids, **properties) ⇒ Object
- #any(**properties) ⇒ Object
- #argument(param_or_term, **properties) ⇒ Object
- #covalent_protein_modification_of(*mod_types, **properties) ⇒ Object
- #encoding_of(*encoding_types, **properties) ⇒ Object
- #function(identifier, **properties) ⇒ Object
- #function_of(*functions, **properties) ⇒ Object
- #has_encoding(**properties) ⇒ Object
- #has_namespace(**properties) ⇒ Object
- #identifier(*value_patterns, **properties) ⇒ Object
- #is_amino_acid_range_pattern(**properties) ⇒ Object
-
#is_nil(**properties) ⇒ Object
rubocop:disable Style/PredicateName.
- #is_sequence_position(**properties) ⇒ Object
- #namespace_of(*namespaces, **properties) ⇒ Object
- #parameter(prefix, value, **properties) ⇒ Object
- #prefix(*prefix_patterns, **properties) ⇒ Object
- #return_type_of(*return_types, **properties) ⇒ Object
- #term(function, *arguments, **properties) ⇒ Object
- #value(*value_patterns, **properties) ⇒ Object
- #variadic_arguments(*params_or_terms, **properties) ⇒ Object
Class Method Details
.build(&block) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 67 def self.build(&block) raise ArgumentError, 'expecting block' unless block_given? builder = _builder_class.new builder.instance_eval(&block) builder.result end |
Instance Method Details
#amino_acid_of(*amino_acids, **properties) ⇒ Object
158 159 160 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 158 def amino_acid_of(*amino_acids, **properties) SemanticAminoAcidOf.new(amino_acids, **properties) end |
#any(**properties) ⇒ Object
121 122 123 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 121 def any(**properties) SemanticAny.new(**properties) end |
#argument(param_or_term, **properties) ⇒ Object
96 97 98 99 100 101 102 103 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 96 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) ⇒ Object
154 155 156 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 154 def covalent_protein_modification_of(*mod_types, **properties) SemanticCovalentProteinModificationOf.new(mod_types, **properties) end |
#encoding_of(*encoding_types, **properties) ⇒ Object
150 151 152 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 150 def encoding_of(*encoding_types, **properties) SemanticEncodingOf.new(encoding_types, **properties) end |
#function(identifier, **properties) ⇒ Object
92 93 94 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 92 def function(identifier, **properties) SemanticFunction.new([identifier], **properties) end |
#function_of(*functions, **properties) ⇒ Object
138 139 140 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 138 def function_of(*functions, **properties) SemanticFunctionOf.new(functions, **properties) end |
#has_encoding(**properties) ⇒ Object
134 135 136 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 134 def has_encoding(**properties) SemanticHasEncoding.new(**properties) end |
#has_namespace(**properties) ⇒ Object
130 131 132 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 130 def has_namespace(**properties) SemanticHasNamespace.new(**properties) end |
#identifier(*value_patterns, **properties) ⇒ Object
109 110 111 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 109 def identifier(*value_patterns, **properties) SemanticIdentifier.new(value_patterns, **properties) end |
#is_amino_acid_range_pattern(**properties) ⇒ Object
162 163 164 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 162 def is_amino_acid_range_pattern(**properties) SemanticIsAminoAcidRange.new(**properties) end |
#is_nil(**properties) ⇒ Object
rubocop:disable Style/PredicateName
126 127 128 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 126 def is_nil(**properties) SemanticIsNil.new(**properties) end |
#is_sequence_position(**properties) ⇒ Object
166 167 168 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 166 def is_sequence_position(**properties) SemanticIsSequencePosition.new(**properties) end |
#namespace_of(*namespaces, **properties) ⇒ Object
146 147 148 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 146 def namespace_of(*namespaces, **properties) SemanticNamespaceOf.new(namespaces, **properties) end |
#parameter(prefix, value, **properties) ⇒ Object
105 106 107 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 105 def parameter(prefix, value, **properties) SemanticParameter.new([prefix, value], **properties) end |
#prefix(*prefix_patterns, **properties) ⇒ Object
113 114 115 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 113 def prefix(*prefix_patterns, **properties) SemanticPrefix.new(prefix_patterns, **properties) end |
#return_type_of(*return_types, **properties) ⇒ Object
142 143 144 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 142 def return_type_of(*return_types, **properties) SemanticReturnTypeOf.new(return_types, **properties) end |
#term(function, *arguments, **properties) ⇒ Object
88 89 90 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 88 def term(function, *arguments, **properties) SemanticTerm.new([function, *arguments], **properties) end |
#value(*value_patterns, **properties) ⇒ Object
117 118 119 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 117 def value(*value_patterns, **properties) SemanticValue.new(value_patterns, **properties) end |
#variadic_arguments(*params_or_terms, **properties) ⇒ Object
170 171 172 |
# File 'lib/bel_parser/language/semantics_ast.rb', line 170 def variadic_arguments(*params_or_terms, **properties) SemanticVariadicArguments.new(params_or_terms, **properties) end |