In general, the form of a raise statement is:
*raise* object *at* address
So, IOW, you should not raise an exception (what a circular thing to say) ever, but accept it in the above form (and nowhere else) as part of a statement.
What a screw-up for our beatiful language of Pascal..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
It seems JCF has problems with constructs such as
Inc(AValue, BValue);
Dec(AValue, BValue);
Also, with something like below where it says (tok_ident: AT; tok_string: 'AT'; tok_version: 1), JCF has problems and aborts.
This stuff is from JvUIBSQLParser.pas
Const
MaxTokens = 247;
tokens: Array[0..MaxTokens - 1] Of tok =
((tok_ident: SQL; tok_string: 'SQL'; tok_version: 0),
(tok_ident: DIALECT; tok_string: 'DIALECT'; tok_version: 0),
(tok_ident: AUTODDL; tok_string: 'AUTODDL'; tok_version: 0),
(tok_ident: CONNECT; tok_string: 'CONNECT'; tok_version: 0),
(tok_ident: ACTION; tok_string: 'ACTION'; tok_version: 1),
(tok_ident: ACTIVE; tok_string: 'ACTIVE'; tok_version: 1),
(tok_ident: ADD; tok_string: 'ADD'; tok_version: 1),
(tok_ident: ADMIN; tok_string: 'ADMIN'; tok_version: 1),
(tok_ident: AFTER; tok_string: 'AFTER'; tok_version: 1),
(tok_ident: ALL; tok_string: 'ALL'; tok_version: 1),
(tok_ident: ALTER; tok_string: 'ALTER'; tok_version: 1),
(tok_ident: KW_AND; tok_string: 'AND'; tok_version: 1),
(tok_ident: ANY; tok_string: 'ANY'; tok_version: 1),
(tok_ident: KW_AS; tok_string: 'AS'; tok_version: 1),
(tok_ident: ASC; tok_string: 'ASC'; tok_version: 1), (* Alias of ASCENDING *)
(tok_ident: ASC; tok_string: 'ASCENDING'; tok_version: 1),
(tok_ident: AT; tok_string: 'AT'; tok_version: 1),
(tok_ident: AUTO; tok_string: 'AUTO'; tok_version: 1),
(tok_ident: AVG; tok_string: 'AVG'; tok_version: 1),
(tok_ident: BACKUP; tok_string: 'BACKUP'; tok_version: 2),
(tok_ident: BASENAME; tok_string: 'BASE_NAME'; tok_version: 1), (* ??? *)
(tok_ident: BEFORE; tok_string: 'BEFORE'; tok_version: 1),
(tok_ident: KW_BEGIN; tok_string: 'BEGIN'; tok_version: 1),
(tok_ident: BETWEEN; tok_string: 'BETWEEN'; tok_version: 1),
(tok_ident: BIGINT; tok_string: 'BIGINT'; tok_version: 2),
(tok_ident: BLOB; tok_string: 'BLOB'; tok_version: 1),
(tok_ident: KW_BREAK; tok_string: 'BREAK'; tok_version: 2),
(tok_ident: BY; tok_string: 'BY'; tok_version: 1),
(tok_ident: CACHE; tok_string: 'CACHE'; tok_version: 1),
(tok_ident: CASCADE; tok_string: 'CASCADE'; tok_version: 1),
(tok_ident: KW_CASE; tok_string: 'CASE'; tok_version: 2),
(tok_ident: CAST; tok_string: 'CAST'; tok_version: 1),
(tok_ident: KW_CHAR; tok_string: 'CHAR'; tok_version: 1),
(tok_ident: CHARACTER; tok_string: 'CHARACTER'; tok_version: 1),
(tok_ident: CHECK; tok_string: 'CHECK'; tok_version: 1),
(tok_ident: CHECK_POINT_LEN; tok_string: 'CHECK_POINT_LENGTH'; tok_version: 1),
(tok_ident: COALESCE; tok_string: 'COALESCE'; tok_version: 2),
(tok_ident: COLLATE; tok_string: 'COLLATE'; tok_version: 1),
(tok_ident: COLUMN; tok_string: 'COLUMN'; tok_version: 2),
(tok_ident: COMMIT; tok_string: 'COMMIT'; tok_version: 1),
(tok_ident: COMMITTED; tok_string: 'COMMITTED'; tok_version: 1),
(tok_ident: COMPUTED; tok_string: 'COMPUTED'; tok_version: 1),
(tok_ident: CONDITIONAL; tok_string: 'CONDITIONAL'; tok_version: 1),
(tok_ident: CONSTRAINT; tok_string: 'CONSTRAINT'; tok_version: 1),
(tok_ident: CONTAINING; tok_string: 'CONTAINING'; tok_version: 1),
(tok_ident: COUNT; tok_string: 'COUNT'; tok_version: 1),
(tok_ident: KW_CREATE; tok_string: 'CREATE'; tok_version: 1),
(tok_ident: CSTRING; tok_string: 'CSTRING'; tok_version: 1),
(tok_ident: CURRENT; tok_string: 'CURRENT'; tok_version: 1),
(tok_ident: CURRENT_CONNECTION; tok_string: 'CURRENT_CONNECTION'; tok_version: 2),
(tok_ident: CURRENT_DATE; tok_string: 'CURRENT_DATE'; tok_version: 2),
(tok_ident: CURRENT_ROLE; tok_string: 'CURRENT_ROLE'; tok_version: 2),
(tok_ident: CURRENT_TIME; tok_string: 'CURRENT_TIME'; tok_version: 2),
(tok_ident: CURRENT_TIMESTAMP; tok_string: 'CURRENT_TIMESTAMP'; tok_version: 2),
(tok_ident: CURRENT_TRANSACTION; tok_string: 'CURRENT_TRANSACTION'; tok_version: 2),
(tok_ident: CURRENT_USER; tok_string: 'CURRENT_USER'; tok_version: 2),
(tok_ident: CURSOR; tok_string: 'CURSOR'; tok_version: 1),
(tok_ident: DATABASE; tok_string: 'DATABASE'; tok_version: 1),
(tok_ident: KW_DATE; tok_string: 'DATE'; tok_version: 1),
(tok_ident: DAY; tok_string: 'DAY'; tok_version: 2),
(tok_ident: KW_DEBUG; tok_string: 'DEBUG'; tok_version: 1),
(tok_ident: KW_DEC; tok_string: 'DEC'; tok_version: 1),
(tok_ident: DECIMAL; tok_string: 'DECIMAL'; tok_version: 1),
(tok_ident: DECLARE; tok_string: 'DECLARE'; tok_version: 1),
(tok_ident: DEFAULT; tok_string: 'DEFAULT'; tok_version: 1),
(tok_ident: KW_DELETE; tok_string: 'DELETE'; tok_version: 1),
(tok_ident: DELETING; tok_string: 'DELETING'; tok_version: 2),
(tok_ident: DESC; tok_string: 'DESC'; tok_version: 1), (* Alias of DESCENDING *)
(tok_ident: DESC; tok_string: 'DESCENDING'; tok_version: 1),
(tok_ident: KW_DESCRIPTOR; tok_string: 'DESCRIPTOR'; tok_version: 2),
(tok_ident: KW_DIFFERENCE; tok_string: 'DIFFERENCE'; tok_version: 2),
(tok_ident: DISTINCT; tok_string: 'DISTINCT'; tok_version: 1),
(tok_ident: KW_DO; tok_string: 'DO'; tok_version: 1),
(tok_ident: DOMAIN; tok_string: 'DOMAIN'; tok_version: 1),
(tok_ident: KW_DOUBLE; tok_string: 'DOUBLE'; tok_version: 1),
(tok_ident: DROP; tok_string: 'DROP'; tok_version: 1),
(tok_ident: KW_ELSE; tok_string: 'ELSE'; tok_version: 1),
(tok_ident: KW_END; tok_string: 'END'; tok_version: 1),
(tok_ident: ENTRY_POINT; tok_string: 'ENTRY_POINT'; tok_version: 1),
(tok_ident: ESCAPE; tok_string: 'ESCAPE'; tok_version: 1),
(tok_ident: KW_EXCEPTION; tok_string: 'EXCEPTION'; tok_version: 1),
(tok_ident: EXECUTE; tok_string: 'EXECUTE'; tok_version: 1),
(tok_ident: EXISTS; tok_string: 'EXISTS'; tok_version: 1),
(tok_ident: KW_EXIT; tok_string: 'EXIT'; tok_version: 1),
(tok_ident: EXTERNAL; tok_string: 'EXTERNAL'; tok_version: 1),
(tok_ident: EXTRACT; tok_string: 'EXTRACT'; tok_version: 2),
(tok_ident: KW_FILE; tok_string: 'FILE'; tok_version: 1),
(tok_ident: FILTER; tok_string: 'FILTER'; tok_version: 1),
(tok_ident: FIRST; tok_string: 'FIRST'; tok_version: 2),
(tok_ident: KW_FLOAT; tok_string: 'FLOAT'; tok_version: 1),
(tok_ident: KW_FOR; tok_string: 'FOR'; tok_version: 1),
(tok_ident: FOREIGN; tok_string: 'FOREIGN'; tok_version: 1),
(tok_ident: FREE_IT; tok_string: 'FREE_IT'; tok_version: 1),
(tok_ident: FROM; tok_string: 'FROM'; tok_version: 1),
(tok_ident: FULL; tok_string: 'FULL'; tok_version: 1),
(tok_ident: KW_FUNCTION; tok_string: 'FUNCTION'; tok_version: 1),
(tok_ident: GDSCODE; tok_string: 'GDSCODE'; tok_version: 1),
(tok_ident: GENERATOR; tok_string: 'GENERATOR'; tok_version: 1),
(tok_ident: GEN_ID; tok_string: 'GEN_ID'; tok_version: 1),
(tok_ident: GRANT; tok_string: 'GRANT'; tok_version: 1),
(tok_ident: GROUP; tok_string: 'GROUP'; tok_version: 1),
(tok_ident: GROUP_COMMIT_WAIT; tok_string: 'GROUP_COMMIT_WAIT_TIME'; tok_version: 1),
(tok_ident: HAVING; tok_string: 'HAVING'; tok_version: 1),
(tok_ident: HOUR; tok_string: 'HOUR'; tok_version: 2),
(tok_ident: KW_IF; tok_string: 'IF'; tok_version: 1),
(tok_ident: KW_IN; tok_string: 'IN'; tok_version: 1),
(tok_ident: INACTIVE; tok_string: 'INACTIVE'; tok_version: 1),
(tok_ident: INDEX; tok_string: 'INDEX'; tok_version: 1),
(tok_ident: INNER; tok_string: 'INNER'; tok_version: 1),
(tok_ident: INPUT_TYPE; tok_string: 'INPUT_TYPE'; tok_version: 1),
(tok_ident: INSERT; tok_string: 'INSERT'; tok_version: 1),
(tok_ident: INSERTING; tok_string: 'INSERTING'; tok_version: 2),
(tok_ident: KW_INT; tok_string: 'INT'; tok_version: 1),
(tok_ident: KW_INTEGER; tok_string: 'INTEGER'; tok_version: 1),
(tok_ident: INTO; tok_string: 'INTO'; tok_version: 1),
(tok_ident: KW_IS; tok_string: 'IS'; tok_version: 1),
(tok_ident: ISOLATION; tok_string: 'ISOLATION'; tok_version: 1),
(tok_ident: JOIN; tok_string: 'JOIN'; tok_version: 1),
(tok_ident: KEY; tok_string: 'KEY'; tok_version: 1),
(tok_ident: LAST; tok_string: 'LAST'; tok_version: 2),
(tok_ident: LEAVE; tok_string: 'LEAVE'; tok_version: 2),
(tok_ident: LEFT; tok_string: 'LEFT'; tok_version: 1),
(tok_ident: KW_LENGTH; tok_string: 'LENGTH'; tok_version: 1),
(tok_ident: LEVEL; tok_string: 'LEVEL'; tok_version: 1),
(tok_ident: LIKE; tok_string: 'LIKE'; tok_version: 1),
(tok_ident: LOGFILE; tok_string: 'LOGFILE'; tok_version: 1),
(tok_ident: LOG_BUF_SIZE; tok_string: 'LOG_BUFFER_SIZE'; tok_version: 1),
(tok_ident: KW_LONG; tok_string: 'LONG'; tok_version: 1),
(tok_ident: MANUAL; tok_string: 'MANUAL'; tok_version: 1),
(tok_ident: MAXIMUM; tok_string: 'MAX'; tok_version: 1),
(tok_ident: MAX_SEGMENT; tok_string: 'MAXIMUM_SEGMENT'; tok_version: 1),
(tok_ident: MERGE; tok_string: 'MERGE'; tok_version: 1),
(tok_ident: MESSAGE_; tok_string: 'MESSAGE'; tok_version: 1),
(tok_ident: MINIMUM; tok_string: 'MIN'; tok_version: 1),
(tok_ident: MINUTE; tok_string: 'MINUTE'; tok_version: 2),
(tok_ident: MODULE_NAME; tok_string: 'MODULE_NAME'; tok_version: 1),
(tok_ident: MONTH; tok_string: 'MONTH'; tok_version: 2),
(tok_ident: NAMES; tok_string: 'NAMES'; tok_version: 1),
(tok_ident: NATIONAL; tok_string: 'NATIONAL'; tok_version: 1),
(tok_ident: NATURAL; tok_string: 'NATURAL'; tok_version: 1),
(tok_ident: NCHAR; tok_string: 'NCHAR'; tok_version: 1),
(tok_ident: NO; tok_string: 'NO'; tok_version: 1),
(tok_ident: KW_NOT; tok_string: 'NOT'; tok_version: 1),
(tok_ident: NULLIF; tok_string: 'NULLIF'; tok_version: 2),
(tok_ident: KW_NULL; tok_string: 'NULL'; tok_version: 1),
(tok_ident: NULLS; tok_string: 'NULLS'; tok_version: 2),
(tok_ident: LOCK; tok_string: 'LOCK'; tok_version: 2),
(tok_ident: KW_NUMERIC; tok_string: 'NUMERIC'; tok_version: 1),
(tok_ident: NUM_LOG_BUFS; tok_string: 'NUM_LOG_BUFFERS'; tok_version: 1),
(tok_ident: KW_OF; tok_string: 'OF'; tok_version: 1),
(tok_ident: ON_; tok_string: 'ON'; tok_version: 1),
(tok_ident: ONLY; tok_string: 'ONLY'; tok_version: 1),
(tok_ident: OPTION; tok_string: 'OPTION'; tok_version: 1),
(tok_ident: KW_OR; tok_string: 'OR'; tok_version: 1),
(tok_ident: ORDER; tok_string: 'ORDER'; tok_version: 1),
(tok_ident: OUTER; tok_string: 'OUTER'; tok_version: 1),
(tok_ident: OUTPUT_TYPE; tok_string: 'OUTPUT_TYPE'; tok_version: 1),
(tok_ident: OVERFLOW; tok_string: 'OVERFLOW'; tok_version: 1),
(tok_ident: PAGE; tok_string: 'PAGE'; tok_version: 1),
(tok_ident: PAGES; tok_string: 'PAGES'; tok_version: 1),
(tok_ident: PAGE_SIZE; tok_string: 'PAGE_SIZE'; tok_version: 1),
(tok_ident: PARAMETER; tok_string: 'PARAMETER'; tok_version: 1),
(tok_ident: PASSWORD; tok_string: 'PASSWORD'; tok_version: 1),
(tok_ident: PLAN; tok_string: 'PLAN'; tok_version: 1),
(tok_ident: POSITION; tok_string: 'POSITION'; tok_version: 1),
(tok_ident: POST_EVENT; tok_string: 'POST_EVENT'; tok_version: 1),
(tok_ident: PRECISION; tok_string: 'PRECISION'; tok_version: 1),
(tok_ident: PRIMARY; tok_string: 'PRIMARY'; tok_version: 1),
(tok_ident: PRIVILEGES; tok_string: 'PRIVILEGES'; tok_version: 1),
(tok_ident: KW_PROCEDURE; tok_string: 'PROCEDURE'; tok_version: 1),
(tok_ident: PROTECTED; tok_string: 'PROTECTED'; tok_version: 1),
(tok_ident: RAW_PARTITIONS; tok_string: 'RAW_PARTITIONS'; tok_version: 1),
(tok_ident: DB_KEY; tok_string: 'RDB$DB_KEY'; tok_version: 1),
(tok_ident: READ; tok_string: 'READ'; tok_version: 1),
(tok_ident: REAL; tok_string: 'REAL'; tok_version: 1),
(tok_ident: VERSION; tok_string: 'RECORD_VERSION'; tok_version: 1),
(tok_ident: RECREATE; tok_string: 'RECREATE'; tok_version: 2),
(tok_ident: REFERENCES; tok_string: 'REFERENCES'; tok_version: 1),
(tok_ident: RELEASE; tok_string: 'RELEASE'; tok_version: 2),
(tok_ident: RESERVING; tok_string: 'RESERV'; tok_version: 1), (* Alias of RESERVING *)
(tok_ident: RESERVING; tok_string: 'RESERVING'; tok_version: 1),
(tok_ident: RESTRICT; tok_string: 'RESTRICT'; tok_version: 1),
(tok_ident: RETAIN; tok_string: 'RETAIN'; tok_version: 1),
(tok_ident: RETURNING_VALUES; tok_string: 'RETURNING_VALUES'; tok_version: 1),
(tok_ident: RETURNS; tok_string: 'RETURNS'; tok_version: 1),
(tok_ident: REVOKE; tok_string: 'REVOKE'; tok_version: 1),
(tok_ident: RIGHT; tok_string: 'RIGHT'; tok_version: 1),
(tok_ident: ROLE; tok_string: 'ROLE'; tok_version: 1),
(tok_ident: ROLLBACK; tok_string: 'ROLLBACK'; tok_version: 1),
(tok_ident: ROW_COUNT; tok_string: 'ROW_COUNT'; tok_version: 2),
(tok_ident: SAVEPOINT; tok_string: 'SAVEPOINT'; tok_version: 2),
(tok_ident: DATABASE; tok_string: 'SCHEMA'; tok_version: 1), (* Alias of DATABASE *)
(tok_ident: SECOND; tok_string: 'SECOND'; tok_version: 2),
(tok_ident: SEGMENT; tok_string: 'SEGMENT'; tok_version: 1),
(tok_ident: SELECT; tok_string: 'SELECT'; tok_version: 1),
(tok_ident: KW_SET; tok_string: 'SET'; tok_version: 1),
(tok_ident: SHADOW; tok_string: 'SHADOW'; tok_version: 1),
(tok_ident: KW_SHARED; tok_string: 'SHARED'; tok_version: 1),
(tok_ident: SINGULAR; tok_string: 'SINGULAR'; tok_version: 1),
(tok_ident: KW_SIZE; tok_string: 'SIZE'; tok_version: 1),
(tok_ident: SKIP; tok_string: 'SKIP'; tok_version: 2),
(tok_ident: KW_SMALLINT; tok_string: 'SMALLINT'; tok_version: 1),
(tok_ident: SNAPSHOT; tok_string: 'SNAPSHOT'; tok_version: 1),
(tok_ident: SOME; tok_string: 'SOME'; tok_version: 1),
(tok_ident: SORT; tok_string: 'SORT'; tok_version: 1),
(tok_ident: SQLCODE; tok_string: 'SQLCODE'; tok_version: 1),
(tok_ident: STABILITY; tok_string: 'STABILITY'; tok_version: 1),
(tok_ident: STARTING; tok_string: 'STARTING'; tok_version: 1),
(tok_ident: STARTING; tok_string: 'STARTS'; tok_version: 1), (* Alias of STARTING *)
(tok_ident: STATEMENT; tok_string: 'STATEMENT'; tok_version: 2),
(tok_ident: STATISTICS; tok_string: 'STATISTICS'; tok_version: 1),
(tok_ident: SUBSTRING; tok_string: 'SUBSTRING'; tok_version: 2),
(tok_ident: SUB_TYPE; tok_string: 'SUB_TYPE'; tok_version: 1),
(tok_ident: SUM; tok_string: 'SUM'; tok_version: 1),
(tok_ident: SUSPEND; tok_string: 'SUSPEND'; tok_version: 1),
(tok_ident: TABLE; tok_string: 'TABLE'; tok_version: 1),
(tok_ident: KW_THEN; tok_string: 'THEN'; tok_version: 1),
(tok_ident: KW_TIME; tok_string: 'TIME'; tok_version: 2),
(tok_ident: TIMESTAMP; tok_string: 'TIMESTAMP'; tok_version: 2),
(tok_ident: KW_TO; tok_string: 'TO'; tok_version: 1),
(tok_ident: TRANSACTION; tok_string: 'TRANSACTION'; tok_version: 1),
(tok_ident: TRIGGER; tok_string: 'TRIGGER'; tok_version: 1),
(tok_ident: KW_TYPE; tok_string: 'TYPE'; tok_version: 2),
(tok_ident: UNCOMMITTED; tok_string: 'UNCOMMITTED'; tok_version: 1),
(tok_ident: UNION; tok_string: 'UNION'; tok_version: 1),
(tok_ident: UNIQUE; tok_string: 'UNIQUE'; tok_version: 1),
(tok_ident: UPDATE; tok_string: 'UPDATE'; tok_version: 1),
(tok_ident: UPDATING; tok_string: 'UPDATING'; tok_version: 2),
(tok_ident: KW_UPPER; tok_string: 'UPPER'; tok_version: 1),
(tok_ident: USER; tok_string: 'USER'; tok_version: 1),
(tok_ident: USING; tok_string: 'USING'; tok_version: 2),
(tok_ident: KW_VALUE; tok_string: 'VALUE'; tok_version: 1),
(tok_ident: VALUES; tok_string: 'VALUES'; tok_version: 1),
(tok_ident: VARCHAR; tok_string: 'VARCHAR'; tok_version: 1),
(tok_ident: VARIABLE; tok_string: 'VARIABLE'; tok_version: 1),
(tok_ident: VARYING; tok_string: 'VARYING'; tok_version: 1),
(tok_ident: VIEW; tok_string: 'VIEW'; tok_version: 1),
(tok_ident: WAIT; tok_string: 'WAIT'; tok_version: 1),
(tok_ident: WEEKDAY; tok_string: 'WEEKDAY'; tok_version: 2),
(tok_ident: WHEN; tok_string: 'WHEN'; tok_version: 1),
(tok_ident: WHERE; tok_string: 'WHERE'; tok_version: 1),
(tok_ident: KW_WHILE; tok_string: 'WHILE'; tok_version: 1),
(tok_ident: KW_WITH; tok_string: 'WITH'; tok_version: 1),
(tok_ident: WORK; tok_string: 'WORK'; tok_version: 1),
(tok_ident: WRITE; tok_string: 'WRITE'; tok_version: 1),
(tok_ident: YEAR; tok_string: 'YEAR'; tok_version: 2),
(tok_ident: YEARDAY; tok_string: 'YEARDAY'; tok_version: 2));
The statements
Inc(AValue, BValue);
Dec(AValue, BValue);
Seem to be supported. Can you get it to crash on them?
> Seem to be supported. Can you get it to crash on them?
What do you mean?
I get an exception and it aborts. How do I get it to 'crash on them'?
The following unit parses correctly, without a crash:
unit TestInc;
interface
implementation
procedure Foo;
begin
Inc(a, b);
Inc(c, d);
end;
end.
What input causes an exception?
I am sorry it took me sometime to locate where I had encountered this error.
Here it is:
procedure HateAT;
var
At: Integer;
begin
Inc(At, 1);
Dec(At, 1);
end;
i.e. when JCF meets something like 'at' (is this a keyword?) it barfs, even though it is a declared variable.
Similarly, JCF hates 'at' word in array values, see my prev post above.
Aha! Thanks for that.
At is an obscure directive, used for e.g. in
"raise Exception.Create('Missing parameter') at @MyFunction;"
I will have to allow directives in these cases.
This is now bug # 1355237
I looked it up, Delphi help says this:
In general, the form of a raise statement is:
*raise* object *at* address
So, IOW, you should not raise an exception (what a circular thing to say) ever, but accept it in the above form (and nowhere else) as part of a statement.
What a screw-up for our beatiful language of Pascal..