Skip to content

Parser #270

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

Merged
merged 12 commits into from
May 3, 2025
Merged

Parser #270

merged 12 commits into from
May 3, 2025

Conversation

syntron
Copy link
Contributor

@syntron syntron commented Apr 25, 2025

There are two parsers for OM return values which are used in OMCSessionBase. This PR tries to clean up their usage - use only a single entry point for each - and add some additional cleanup:

  • define OMCSessionBase._ask_with_fallback() - the only use of OMTypedParser
  • fix handling of exceptions raised by pyparsing (use .msg instead of .message)

adeas31 added 2 commits April 30, 2025 11:37
The output of `getComponentModifierValue` is changed so we don't need to strip the result.
And the output of `getExtendsModifierValue` is changed in OpenModelica/OpenModelica#13533

Removed `_ask_with_fallback` and moved the fallback code to `sendExpression`
@adeas31
Copy link
Member

adeas31 commented Apr 30, 2025

@syntron I removed _ask_with_fallback and moved the fallback code to sendExpression.

I think we should also remove all the APIs and def ask. We should just have def sendExpression which users can use to call any API. It is difficult to keep track of the changes done in the API.
I will make an issue about it.

@syntron
Copy link
Contributor Author

syntron commented Apr 30, 2025

I think we should also remove all the APIs and def ask. We should just have def sendExpression which users can use to call any API. It is difficult to keep track of the changes done in the API. I will make an issue about it.

@adeas31 I just added all the commits I prepared for OMCSession.py (see PR #275). It further simplifies OMCSessionBase such that is an independend class which can be used to query OMC based on a session (= OMCSessionZMQ). As side effect, this class could later be removed - however, at the moment it is as simple as possible and - thus - perhaps still useful.

Some small additional cleanups:

  • use pathlib if possible / cleanup
  • add exception handling and use specific exception if possible

@syntron
Copy link
Contributor Author

syntron commented Apr 30, 2025

just noted: this now includes PR #272 ... if needed I can split this put again ...

@syntron syntron force-pushed the parser branch 2 times, most recently from d96bc10 to 0be8325 Compare May 1, 2025 13:32
This was referenced May 1, 2025
@adeas31
Copy link
Member

adeas31 commented May 1, 2025

just noted: this now includes PR #272 ... if needed I can split this put again ...

Lets keep the PRs simple. Adding small chunks of code is better than adding huge block of code. Please split and make several PRs if possible.

@syntron
Copy link
Contributor Author

syntron commented May 2, 2025

just noted: this now includes PR #272 ... if needed I can split this put again ...

Lets keep the PRs simple. Adding small chunks of code is better than adding huge block of code. Please split and make several PRs if possible.

I restored the state of this PR before my change - the modified parser branch is kept in my fork as parserOLD and as PR #280, #281 and #282

@adeas31 adeas31 merged commit 4af7826 into OpenModelica:master May 3, 2025
9 checks passed
@syntron syntron deleted the parser branch May 3, 2025 15:51
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.

2 participants