Skip to content

Add a 'raise' statement and the ParamCount/ParamStr builtins#310

Open
TetzkatLipHoka wants to merge 1 commit into
remobjects:masterfrom
TetzkatLipHoka:feature/raise-paramstr
Open

Add a 'raise' statement and the ParamCount/ParamStr builtins#310
TetzkatLipHoka wants to merge 1 commit into
remobjects:masterfrom
TetzkatLipHoka:feature/raise-paramstr

Conversation

@TetzkatLipHoka

Copy link
Copy Markdown

raise: scripts could report custom errors only through the
RaiseException builtin and could not re-raise inside except blocks with
the usual Pascal syntax. The identifier RAISE is now handled as a
statement in ProcessSub:

raise; // re-raise: RaiseLastException
raise Exception.Create('message'); // RaiseException(erCustomError, msg)

The class name is parsed but not evaluated (scripts have no exception
objects), the message may be any string expression, and the strict
.Create() grammar keeps the single-token-lookahead parser
deterministic. Both forms work as if/then one-liners and interact with
try/except/finally as expected; ExceptionType/ExceptionParam report
erCustomError and the message.

ParamCount/ParamStr: the host process' command line was not reachable
from scripts. Registered as DefProc indices 49/50 (45-48 are taken by
the StrToUInt64 family and UIntToStr), kept in sync in
DefineStandardProcedures, DefProc and RegisterStandardProcs.

🤖 Generated with Claude Code

raise: scripts could report custom errors only through the
RaiseException builtin and could not re-raise inside except blocks with
the usual Pascal syntax. The identifier RAISE is now handled as a
statement in ProcessSub:

  raise;                              // re-raise: RaiseLastException
  raise Exception.Create('message');  // RaiseException(erCustomError, msg)

The class name is parsed but not evaluated (scripts have no exception
objects), the message may be any string expression, and the strict
<ident>.Create(<expr>) grammar keeps the single-token-lookahead parser
deterministic. Both forms work as if/then one-liners and interact with
try/except/finally as expected; ExceptionType/ExceptionParam report
erCustomError and the message.

ParamCount/ParamStr: the host process' command line was not reachable
from scripts. Registered as DefProc indices 49/50 (45-48 are taken by
the StrToUInt64 family and UIntToStr), kept in sync in
DefineStandardProcedures, DefProc and RegisterStandardProcs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant