Class: BELParser::Script::Syntax::ExpressionValidation
- Inherits:
-
Object
- Object
- BELParser::Script::Syntax::ExpressionValidation
- Extended by:
- Language::Syntax::SyntaxFunction
- Defined in:
- lib/bel_parser/script/syntax/expression_validation.rb
Constant Summary collapse
- TARGET_NODES =
[ BELParser::Parsers::AST::ObservedTerm, BELParser::Parsers::AST::SimpleStatement, BELParser::Parsers::AST::NestedStatement ]
- EXP_VALIDATOR =
BELParser::Language::ExpressionValidator
Class Method Summary collapse
Class Method Details
.expression_validator(script_context) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bel_parser/script/syntax/expression_validation.rb', line 29 def self.expression_validator(script_context) unless defined? @expression_validator spec, namespaces, uri_reader, url_reader = script_context.values_at( :specification, :namespace_definitions, :uri_reader, :url_reader) @expression_validator = EXP_VALIDATOR.new( spec, namespaces, uri_reader, url_reader) end @expression_validator end |
.map(ast_node, script_context) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/bel_parser/script/syntax/expression_validation.rb', line 21 def self.map(ast_node, script_context) return nil unless TARGET_NODES.include?(ast_node.class) return nil unless script_context.key?(:specification) validator = expression_validator(script_context) validator.validate(ast_node) end |