Logo Search packages:      
Sourcecode: ktechlab version File versions

SourceLineList Parser::getBracedCode ( SourceLineList::const_iterator *  it,
SourceLineList::const_iterator  end 

Returns the lines between the braces, excluding the braces, e.g. defproc name { more code some more code } returns ("more code","some more code"). Note that Microbe has already put the braces on separate lines for us.

it is the iterator at the position of the first brace, this function will return with it pointing at the matching closing brace.
end is the iterator pointing to the end of the source line list, so that we don't search past it.
The braced code (excluding the braces).

Definition at line 559 of file parser.cpp.

Referenced by parse().

      // Note: The sourceline list has the braces on separate lines.
      // This function should only be called when the parser comes across a line that is a brace.
      assert( (**it).text() == "{" );
      SourceLineList braced;
      // Jump past the first brace
      unsigned level = 1;
      for ( ; *it != end; ++(*it) )
            if ( (**it).text() == "{" )
            else if ( (**it).text() == "}" )
            if ( level == 0 )
                  return braced;
            braced << **it;
      // TODO Error: mismatched bracing
      return braced;

Generated by  Doxygen 1.6.0   Back to index