Jump to content

Recommended Posts

Posted (edited)

It is about the keyword #Region. In the SciTE help it says:

  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:

Expand  

But if I write #Region in the first line and write a space+underscore " _" at the end of the line, the compiler considers it a line continuation character. Is this a bug?

This only occurs in the first line of a script! If I write a blank line in front of it, it does not happen and the script runs without errors.

To test this example insert it into the first line of an Au3 script.

  Reveal hidden contents

Currently I have written a function to read function heads from an Au3 script and format them in syntax notation. I discovered this behaviour when I wanted to remove the lines with #Region/#EndRegion and #Region was in the first line of a script.

My guess is that it could be a RegEx pattern. I had used this pattern first and made many attempts to fix it.

$sData = StringRegExpReplace($sData, '(?i)\n\h*(?:#Region|#EndRegion)(?!\w)[^\n]*\n', @LF)

Unfortunately, my RegEx skills are not good enough to change the pattern to make it work or to make such a fancy pattern. So I wrote a simple pattern that seems to do the job.

$sData = StringRegExpReplace($sData, '(?mi)^\h*(?:#Region|#EndRegion).*\R', "")

Can anyone confirm this, or have I done something wrong?

Bernd.

Edited by Professor_Bernd
  • Developers
Posted
  On 7/11/2020 at 4:06 PM, Professor_Bernd said:

Is this a bug?

Expand  

I would say yes, but this is very rare it should happen as not many people use any Directive (#) on line one and an normal syntax line on line 2.

so it is not just with #region but also with #xyz, where AutoIt3 should ignore any line starting with # and not being a Directive it knows like #cs/#ce.

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.
  :)

Posted

I confirm that behaviour.

So yes, since it specifically says any text after it is considered a comment, it looks like a bug to me.

You can submit it here https://www.autoitscript.com/trac/autoit

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
  On 7/11/2020 at 4:21 PM, Jos said:

this is very rare it should happen

Expand  

I agree. I only discovered this because I also considered absurd constellations to secure my feature. Everything that AutoIt allows can be done by the user. :D

 

  On 7/11/2020 at 4:22 PM, careca said:
Expand  

Thanks for the link. I'll try to see if I can do that.

 

Thank you both for your answers! :)

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
  • Recently Browsing   0 members

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