module DataMetaParse

Grammar parsing commons for the dataMeta Project.

For command line details either check the new method's source or the README.rdoc file, the usage section.

Constants

VERSION

Current version

Public Class Methods

loadBaseRulz() click to toggle source

Loads the base rules from dataMetaParse/basic.treetop

# File lib/dataMetaParse.rb, line 40
def loadBaseRulz
    Treetop.load("#{File.dirname(__FILE__)}/dataMetaParse/basic")
end
parse(parser, source) click to toggle source

Parse with error handling, convenience shortcut to the content of this method.

@param [Object] parser Treetop compiled parser whichever class it is. It may be Treetop::Runtime::CompiledParser @param [String] source the data to parse with the given parser @return [Object] either the AST, likely as Treetop::Runtime::SyntaxNode if the parsing was successful or {Err} if it was not

or +nil+ if there is no match. It's not very consistent of when you get an Err or when you get a +nil+, it's
not exact science. One way to get a +nil+ is to cause mismatch in the very first token.
# File lib/dataMetaParse.rb, line 53
def parse(parser, source)
    parser.parse(source) || ( parser.failure_reason ? Err.new(source, parser) : nil)
end

Private Instance Methods

loadBaseRulz() click to toggle source

Loads the base rules from dataMetaParse/basic.treetop

# File lib/dataMetaParse.rb, line 40
def loadBaseRulz
    Treetop.load("#{File.dirname(__FILE__)}/dataMetaParse/basic")
end
parse(parser, source) click to toggle source

Parse with error handling, convenience shortcut to the content of this method.

@param [Object] parser Treetop compiled parser whichever class it is. It may be Treetop::Runtime::CompiledParser @param [String] source the data to parse with the given parser @return [Object] either the AST, likely as Treetop::Runtime::SyntaxNode if the parsing was successful or {Err} if it was not

or +nil+ if there is no match. It's not very consistent of when you get an Err or when you get a +nil+, it's
not exact science. One way to get a +nil+ is to cause mismatch in the very first token.
# File lib/dataMetaParse.rb, line 53
def parse(parser, source)
    parser.parse(source) || ( parser.failure_reason ? Err.new(source, parser) : nil)
end