File: setoptions.cc

package info (click to toggle)
simrisc 16.06.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,568 kB
  • sloc: cpp: 6,889; fortran: 669; makefile: 112; ansic: 112; sh: 107
file content (29 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#define XERR
#include "parser.ih"

// OptionsVect: vector of OptionInfo elements, processed by actualize()
// OptionInfo: defined by Parser

// static
void Parser::setOptions(ConfigLines &parser, OptionsVect &optionsVect)
{
    while
    (
        parser.get()                                // got a line and it's not
        and                                         // a top-level parser
        s_map.find(parser.key()) == s_map.end()     // parameter
    )
                                                // store the option spec.
        optionsVect.push_back(                  // long option name and value
                    {
                        parser.key().back() == ':' ?    // rm a final :
                            parser.key().substr(0, parser.key().length() - 1)
                        :
                            parser.key(),
                        parser.value(),
                        parser.lineNr(),
                    }
                );

    parser.redo();             // redo the line not containing a label
}