Changeset 16 for branches/Void/UCompilator.pas
- Timestamp:
- Nov 10, 2009, 10:27:21 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Void/UCompilator.pas
r15 r16 54 54 if Parser.TokenType <> ttWhiteSpace then DoError('Expect white space'); 55 55 Parser.ParseNextToken; 56 if Parser.TokenType <> ttString then DoError('Expect string'); 56 if Parser.TokenType <> ttIdentifier then DoError('Expect program name') 57 else Module.Name := Parser.TokenValue; 57 58 Parser.ParseNextToken; 58 59 if (Parser.TokenType <> ttSymbol) and (Parser.TokenValue <> ';') then DoError('Expect ;'); … … 184 185 if Assigned(Variable) then begin 185 186 Parser.ParseNextToken; 186 if Parser.TokenType <> ttWhiteSpace then DoError('Expected white space'); 187 Parser.ParseNextToken; 187 if Parser.TokenType = ttWhiteSpace then Parser.ParseNextToken; 188 188 if (Parser.TokenType <> ttSymbol) and (Parser.TokenValue = ':=') then 189 189 DoError('Expected :='); 190 190 Parser.ParseNextToken; 191 if Parser.TokenType <> ttWhiteSpace then DoError('Expected white space'); 192 Parser.ParseNextToken; 191 if Parser.TokenType = ttWhiteSpace then Parser.ParseNextToken; 193 192 Value := Parser.TokenValue; 194 193 if Parser.TokenType = ttIdentifier then begin … … 222 221 end; 223 222 end; 224 end else DoError('Expected variable or string') 223 end else if Parser.TokenType = ttNumber then begin 224 with TCommand(Commands[Commands.Add(TCommand.Create)]) do begin 225 Name := 'Assignment'; 226 with TVariableValue(Parameters[Parameters.Add(TVariableValue.Create)]) do begin 227 ValueType := vtVariable; 228 VariableDef := Variable; 229 end; 230 with TVariableValue(Parameters[Parameters.Add(TVariableValue.Create)]) do begin 231 ValueType := vtNumber; 232 NumberConstant := StrToInt(Parser.TokenValue); 233 end; 234 end; 235 end else DoError('Expected variable or string or number') 225 236 end else DoError('Unknown command ' + CommandName); 226 237 end;
Note:
See TracChangeset
for help on using the changeset viewer.