Qorus Integration Engine®  4.0.3.p2_git
OMQ::TaggedFileParser Class Referenceabstract

Qorus Source Code parser class. More...

Public Member Methods

 constructor (string n_type, hash n_tags, string n_encoding="utf8", bool n_verbose=False, bool n_quiet=False, bool n_missing_tag_warning=True)
 the constructor only sets internal values and does not do any other processing
 
list< hash< auto > > content ()
 returns a list of hashes with Qorus object information More...
 
 suppressFileAnnouncement ()
 supress output when starting to parse each file
 
 parse (string fn)
 Parse content of the file. More...
 
 parseInput (string fn, AbstractLineIterator i)
 Parse content of the input iterator. More...
 
 finalizeParsing ()
 "virtual" method; to be reimplemented in derived classes
 
 postParsing ()
 "virtual" method; to be reimplemented in derived classes
 
abstract doEnd (bool explicit, *hash< auto > orig_tags)
 to be reimplemented in derived classes
 
bool gotTag (string tag, reference val)
 "virtual" method; to be overloaded in derived classes More...
 

Private Attributes

hash info
 tag info hash
 
string type
 type of object being parsed (ie: "function", "class", etc)
 
hash re
 regex cache
 
string fn
 file name
 
int line = 0
 line number
 
int offset = 0
 line number offset for object
 
int count = 0
 number of objects parsed
 
hash tags
 hash of tags
 
hash uinfo
 hash of parsed user tags values (to be stored in the *_tags table)
 
string buf
 object's string buffer
 
string encoding
 encoding of the file
 
bool verbose
 additional "verbose" output (default False)
 
bool quiet
 suppress all outputs except errors (default False)
 
bool suppress_file_announcement
 suppress file output when starting to parse a file
 
bool do_ok
 output "OK\n" at the end of parsing
 
bool missing_tag_warning
 show missing tag warnings (default True)
 
list< hash< auto > > content
 Keep parsed objects to return wuth content(); see addToContent(); name -> content hash.
 

Detailed Description

Qorus Source Code parser class.

This class verifies metadata (tags) provided in the source file and parse the content to be potentially loaded into Qorus DB.

See also
oload for more information

construct the object, call parse(), and verify it by content()

OMQ::TaggedFileParser p("constant", ConstantTags);
p.parse(ARGV[0]);
printf("INFO: %N\n", p.content());

Member Function Documentation

◆ content()

list<hash<auto> > OMQ::TaggedFileParser::content ( )

returns a list of hashes with Qorus object information

Returns
a list of hashes with the following keys:
  • metainfo: A hash with meta information per object ("name", "version", "patch", ...); its structure depends on the object type
    • buffer: the source code of the object
    • type: the type of the object ("constant", "class", ...)
    • filename: Name of the original file
    • tags: A hash with tags provided to the instance constructor

◆ gotTag()

bool OMQ::TaggedFileParser::gotTag ( string  tag,
reference  val 
)

"virtual" method; to be overloaded in derived classes

Parameters
tagthe tag found
vala reference to the value read; always initially passed as a string, can be modified by the method
Returns
True if the tag was accepted; False if not; if True then the value is saved in the info hash

◆ parse()

OMQ::TaggedFileParser::parse ( string  fn)

Parse content of the file.

Parameters
fnstring, a file name (including path) to be parsed

◆ parseInput()

OMQ::TaggedFileParser::parseInput ( string  fn,
AbstractLineIterator  i 
)

Parse content of the input iterator.

Parameters
fnstring, the file name (including path)
ithe input iterator

The documentation for this class was generated from the following file: