Sha256: c7e98abb356e958c314950f9d26eb7de08f704bf879606066abe1db81492139c
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require_relative '../ast_filter' require_relative '../ast_generator' require_relative '../parsers/common' require_relative '../parsers/expression' require_relative '../parsers/bel_script' module BELParser module Script # Parser for BEL Script. class Parser include BELParser::Parsers::Common include BELParser::Parsers::Expression include BELParser::Parsers::BELScript FILTER = BELParser::ASTFilter.new( :simple_statement, :observed_term, :nested_statement, :define_annotation, :define_namespace, :set, :unset, :blank_line, :comment_line ) def each(io) if block_given? filtered_ast = FILTER.each(BELParser::ASTGenerator.new.each(io)) filtered_ast.each do |results| yield results end else enum_for(:each, io) end end end end end if __FILE__ == $PROGRAM_NAME BELParser::Script::Parser.new.each($stdin) do |line_result| line_number, line, ast_results = line_result puts "#{line_number}: #{line}" ast_results.each do |ast| puts ast.to_s(1) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bel_parser-1.0.0.alpha.6 | lib/bel_parser/script/parser.rb |