Jump to content

Multiline comment: what is considered the comment content?


Poll  

5 members have voted

  1. 1. What would you expect?



Recommended Posts

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 by genius257
Link to comment
Share on other sites

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 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

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.

 

Link to comment
Share on other sites

Hi all :D Thanks for the answers so far! :D

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! :D You have saved me days of time wasted on this "simple" implementation choice :)

Link to comment
Share on other sites

  • Developers

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 by Jos

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...