parser.cxx

changeset 14
bb18fa5af076
parent 13
4a5b86aed1d6
child 15
284c2fc6c1cd
equal deleted inserted replaced
13:4a5b86aed1d6 14:bb18fa5af076
131 if (curarg >= comm->maxargs) { 131 if (curarg >= comm->maxargs) {
132 if (!PeekNext().compare (",")) 132 if (!PeekNext().compare (","))
133 ParserError ("got `,` while expecting command-terminating `)`, are you passing too many parameters? (max %d)", 133 ParserError ("got `,` while expecting command-terminating `)`, are you passing too many parameters? (max %d)",
134 comm->maxargs); 134 comm->maxargs);
135 MustNext (")"); 135 MustNext (")");
136 curarg++;
136 break; 137 break;
137 } 138 }
138 139
139 if (!Next ()) 140 if (!Next ())
140 ParserError ("unexpected end-of-file, unterminated command"); 141 ParserError ("unexpected end-of-file, unterminated command");
155 MustNext (","); 156 MustNext (",");
156 } else if (curarg < comm->maxargs - 1) { 157 } else if (curarg < comm->maxargs - 1) {
157 // Can continue, but can terminate as well. 158 // Can continue, but can terminate as well.
158 if (!PeekNext ().compare (")")) { 159 if (!PeekNext ().compare (")")) {
159 MustNext (")"); 160 MustNext (")");
161 curarg++;
160 break; 162 break;
161 } else 163 } else
162 MustNext (","); 164 MustNext (",");
163 } 165 }
164 166
165 curarg++; 167 curarg++;
166 } 168 }
167 MustNext (";"); 169 MustNext (";");
170
171 // If the script skipped a few arguments, fill in defaults.
172 while (curarg < comm->maxargs) {
173 w->Write<long> (comm->defvals[curarg]);
174 curarg++;
175 }
168 } else 176 } else
169 ParserError ("unknown keyword `%s`!", token.chars()); 177 ParserError ("unknown keyword `%s`!", token.chars());
170 } 178 }
171 } 179 }
172 180

mercurial