genius257 Posted April 1, 2023 Share Posted April 1, 2023 (edited) So long story short: i am writing a AutoIt3 parser and want some feedback from other AutoIt3 users on this. The following seems to be a valid multi-line comment block: #csA B #ceC What would you consider the content of the comment block? 1: A B C 2: A B 3: B Or maybe something else? Edited April 1, 2023 by genius257 argumentum 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Danp2 Posted April 1, 2023 Share Posted April 1, 2023 I would assume that it would behave the same as #region, which treats any text after the keyword as a comment -- Quote There is an additional folding keyword #region...#endregion to permit really large blocks of code to be compressed. Any text following these special keywords is considered a comment: Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
pixelsearch Posted April 1, 2023 Share Posted April 1, 2023 I always use the following syntax to make it clearer : #cs 1st line of comment 2nd line ... #ce e.g. nothing written on the #cs and #ce lines, to get a neat display. Just my 2cts... Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted April 1, 2023 Share Posted April 1, 2023 (edited) I personally write the first comment line in the second line of the multiline comment (like @pixelsearch). But what I expect is the comment content AB, like I voted above. This would match several other programming language implementations of multiline comments. Each charater between the keywords/signs is a part of the comment content. Thanks @genius257 for your work 👍 . Best regards Sven Edited April 1, 2023 by SOLVE-SMART Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
OJBakker Posted April 1, 2023 Share Posted April 1, 2023 I usually keep the directives on separate lines. My preference would be to consider the example as invalid code. #csA and #ceC should be reported as invalid directives. using comment on directive lines can be done with existing syntax without ambiguity. #cs ;A B #ce ;C or implicit comment (not my preference) #cs A B #ce C I have voted for AB because that seems to be the current implementation but my preference would be it would be just B. I prefer to see comment on a directives line not as part of the comment. It has to major functions 1: remark why did I comment this code 2: add a marker to both begin comment and end comment to pair both, especially used with nested comments or large blocks of code. TheDcoder 1 Link to comment Share on other sites More sharing options...
genius257 Posted April 2, 2023 Author Share Posted April 2, 2023 Hi all Thanks for the answers so far! So i think i will go with the AB solution. I agree that most if not all people will use multi-line comments, where the text content always starts at line two in the block (me included). It does make the most sense. But from a parser perspective, all content after the #cs, and before the #ce that works in the native AutoIt3 executable should be included. 16 hours ago, OJBakker said: My preference would be to consider the example as invalid code. I can see why you think that, bout my current parser needs to be a one to one implementation of the parser rules AutoIt version 3.3.14.5 uses. I apologize that i did not make clear what my current target AutoIt version was. I do plan to make parsers for future AutoIt3 versions also, but choose 3.3.14.5 as my starting point. If they "patch" the multi-line syntax in a later version, that specific parser implementation will of course reflect that I thank you all! You have saved me days of time wasted on this "simple" implementation choice TheDcoder and SOLVE-SMART 2 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Developers Jos Posted April 2, 2023 Developers Share Posted April 2, 2023 (edited) Just a little off-topic remark and only FYI: I see that there is an issue in the current au3lexer and it doesn't do correct syntax highlighting for these: On 4/1/2023 at 10:48 AM, OJBakker said: My preference would be to consider the example as invalid code. #csA and #ceC should be reported as invalid directives. The lexer should not recognize them as Start/Stop of commentblocks and should simply be colored as some PREPROCESSOR statement. Will be fixed. Edited April 2, 2023 by Jos SOLVE-SMART and genius257 1 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now