Ignore:
Timestamp:
Jun 26, 2023, 6:08:23 PM (17 months ago)
Author:
chronos
Message:
  • Added: Support for procedures.
  • Added: Project pascal file can be opened from main menu. Last file name is remembered.
  • Modified: Improved XML output of source structure.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/xpascal/Tokenizer.pas

    r224 r233  
    6262implementation
    6363
     64resourcestring
     65  SUnknownToken = 'Unknown token %s';
     66  SUnsupportedTokenizerState = 'Unsupported tokenizer state.';
     67  SExpectedButFound = 'Expected %s but %s found.';
     68
    6469{ TToken }
    6570
     
    155160  (Text = 'else') or (Text = 'while') or (Text = 'do') or (Text = 'for') or
    156161  (Text = 'to') or (Text = 'repeat') or (Text = 'until') or (Text = 'break') or
    157   (Text = 'continue') or (Text = 'function');
     162  (Text = 'continue') or (Text = 'function') or (Text = 'procedure');
    158163end;
    159164
     
    203208        Pos.Increment;
    204209      end else begin
    205         Error('Unknown token ' + C);
     210        Error(Format(SUnknownToken, [C]));
    206211        Break;
    207212      end;
     
    260265      end;
    261266    end else
    262       raise Exception.Create('Unsupported tokenizer state.');
     267      raise Exception.Create(SUnsupportedTokenizerState);
    263268  end;
    264269end;
     
    314319  Token := GetNext;
    315320  if (Token.Text <> Text) or (Token.Kind <> Kind) then
    316     Error('Expected ' + Text + ' but ' + Token.Text + ' found.');
     321    Error(Format(SExpectedButFound, [Text, Token.Text]));
    317322end;
    318323
Note: See TracChangeset for help on using the changeset viewer.