-
|
I'm working on a project involving a PLC that uses ST (Structured Text) for the majority of code. I'm trying to get the source code tracing working and not having much luck. Strictdoc is finding the .st files and getting the correct line count, but not identifying markers. An example .st file: I've tested with a python file in the same project and that works without issue. I've renamed the .st file to .c and then the markers are found. I know there's not direct support for Structured Text files but Is there something obvious I'm missing, or a simple workaround? I will also need to parse .xml files in the future which contain snippets of ST code. I guess I'm looking for a generic way to identify markers in test based files of an unknown type. I am also open to helping add support for .st myself but would need some guidance on where to start looking in the codebase. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
|
Hey @xw-mk, thanks a lot for your feedback and request. I have added reading ST with an integration test fixture and it is working on my end as expected: #2570. The only real change I had to make was to disable the syntax highlighting (.st files were incorrectly recognized as Smalltalk files), see here: https://github.com/strictdoc-project/strictdoc/pull/2570/files#diff-6ae2711c07efb5292a7f10fd2298e57329d1f3165b348d094514f639224ea71eR178. Please review the test fixture setup and double-check if you may be missing any configuration detail, for example, that your config looks similar to what I have in the PR: https://github.com/strictdoc-project/strictdoc/pull/2570/files#diff-540085da07ff4499ac1e9f2759edca28a0b103121a7d1e7e33aad49cece20c9eR1. My fix with the syntax highlighting has not been released yet, so I suggest that you install the nightly version of StrictDoc to not get confused by the incorrect Smalltalk syntax highlighting for This is how it looks like:
Regarding the syntax highlighting: it looks like someone created a Lexer for this ST language but it has never been merged to the Pygments repo: pygments/pygments#1002 (comment). We could enable the syntax highlighting by suggesting @robertobernabe who is the author of that GitHub gist Pygments Lexer for IEC61131 3 Structured Text to open a PR to Pygments. (Preferred and cleaner approach). cc @robertobernabe: I hope I can reach you here by tagging your name: would you be open to creating a Pull Request with your IEC61131 ST Lexer to the official Pygments repository? |
Beta Was this translation helpful? Give feedback.
-
|
@stanislaw firstly, thanks for the fast turnaround! I've tried the nightly build and am still having issues. I've compared the example in your test fixture with our requirements and after some back and forth I believe the source of the issue is that we have requirements with custom prefixes (SF_REQ instead of REQ for example). This doesn't appear to be an issue with .c or .py files, but for anything else (ie .st files) there are some peculiarities. Source code
With these requirements: And this source file: Running strictdoc with the file above I get this: There are 2 things going wrong here:
Appreciate the support, let me know if you need any additional info. |
Beta Was this translation helpful? Give feedback.
-
|
@stanislaw I've just tried with the latest build and all looks good. SF_REQ's are being found correctly and I can't replicate the REQ-002 issue seen above so perhaps that has been fixed with the regex changes. Thanks for the fast turnaround, and appreciate the hard work that's gone into Strictdoc! |
Beta Was this translation helpful? Give feedback.


Hey @xw-mk,
thanks a lot for your feedback and request.
I have added reading ST with an integration test fixture and it is working on my end as expected: #2570. The only real change I had to make was to disable the syntax highlighting (.st files were incorrectly recognized as Smalltalk files), see here: https://github.com/strictdoc-project/strictdoc/pull/2570/files#diff-6ae2711c07efb5292a7f10fd2298e57329d1f3165b348d094514f639224ea71eR178.
Please review the test fixture setup and double-check if you may be missing any configuration detail, for example, that your config looks similar to what I have in the PR: https://github.com/strictdoc-project/strictdoc/pull/2570/files#diff-540085da07ff44…