daily pastebin goal
80%
SHARE
TWEET

Untitled

a guest May 16th, 2018 115 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Option {
  2.     string name;
  3.     string value;
  4. };
  5.  
  6. class OptionList {
  7.     vector<Option> options;
  8. };
  9.  
  10. void parseOptionList(OptionList &list) {
  11.     if (lexer.Token() != TOKEN_SQUAREBRACKETON) {
  12.         return; /* kein [, also keine/leere Optionsliste!
  13.     };
  14.    
  15.     lexer.expect(TOKEN_SQUAREBRACKETON); /* weglesen */
  16.    
  17.     while(lexer.Token() != TOKEN_SQUAREBRACKETOFF) {
  18.         Option newOpt;
  19.         parseOption(newOpt);
  20.         list.options.push_back(newOpt);
  21.        
  22.         if (lexer.Token() != TOKEN_SQUAREBRACKETOFF) {
  23.             lexer.expect(TOKEN_KOMMA);
  24.         }
  25.     }
  26.    
  27.     lexer.expect(TOKEN_SQUAREBRACKETOFF);
  28. };
RAW Paste Data
Top