Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential eengine bug: Functions and procedures without parameters #23

Open
ronaldtse opened this issue Nov 19, 2020 · 5 comments
Open
Assignees

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Nov 19, 2020

Functions and procedures without parameters

Declaration:

PROCEDURE emptyProcedure; END_PROCEDURE;

Call:

emptyProcedure;

eengine throws Error: ASSIGNMENT_STMT expected ':COLON-EQUAL', got '#\;'

It seems that the spec doesn't explicitly disallow them, or at least I couldn't find where.

ISO 10303-11, 9.5.3 says:

A function or procedure can have formal parameters.

BNF syntax has parameters in [ ], which means optional

function_head = FUNCTION function_id [ ’(’ formal_parameter { ’;’ formal_parameter } ’)’ ] ’:’ parameter_type ’;’ .
procedure_head = PROCEDURE procedure_id [ ’(’ [ VAR ] formal_parameter { ’;’ [ VAR ] formal_parameter } ’)’ ] ’;’ .

actual_parameter_list = ’(’ parameter { ’,’ parameter } ’)’ .
function_call = ( built_in_function | function_ref ) [ actual_parameter_list ] .
procedure_call_stmt = ( built_in_procedure | procedure_ref ) [ actual_parameter_list ] ’;’ .

Are they valid or not?

Originally posted by @zakjan in #11 (comment)

@ronaldtse
Copy link
Contributor Author

Screenshot for 9.5.2.

Screen Shot 2020-11-19 at 3 19 21 PM

@ronaldtse
Copy link
Contributor Author

Reported at: http://bz.pdes-ch.org/show_bug.cgi?id=8482

@ronaldtse
Copy link
Contributor Author

From Robert Swindells: http://bz.pdes-ch.org/show_bug.cgi?id=8482#c1

emptyProcedure;

The error is thrown by the call to the procedure, not the declaration of it.

@ronaldtse
Copy link
Contributor Author

My response:

Thanks Robert! In this case, what should the correct "procedure call" format be?

According to ISO 10303-11, 13.8, the syntax given is:

270 procedure_call_stmt = ( built_in_procedure | procedure_ref )
    [ actual_parameter_list ] ’;’ .
167 actual_parameter_list = ’(’ parameter { ’,’ parameter } ’)’ .
264 parameter = expression .

"actual_parameter_list" is optional.

In 13.8 the example given is:

INSERT (point_list, this_point, here );

@zakjan
Copy link
Contributor

zakjan commented Nov 25, 2020

Yes, a declaration without params is valid, a call without params throws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants