Jump to content

AutoIt Language Tools


Mat
 Share

Recommended Posts

This is a release of something I wrote as a proof of concept a couple of years ago. I've now put it on github and made a few minor changes to it, mostly so that it now reports errors properly.

It's a lexer and parser for the AutoIt language. The idea is that tools could be written in AutoIt and maintained by the community. In practice, it's probably slow enough on large scripts that it could get annoying. Still, could be of a lot of use to the various projects to work on the language and extend it. 

Usage is pretty simple, _Ault_ParseFile parses a file and returns the syntax tree, or an array describing the error if @error flag is set. 

https://github.com/MattDiesel/Ault

Matt

Link to comment
Share on other sites

Not sure what I would do with this, so just ran test.au3.

Here is the console output, I'm guessing it's not what it's supposed to be.

>Running AU3Check (3.3.14.2)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\Test.au3
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(30,35) : warning: $_AP_STI_COUNT: possibly used before declaration.
    Local $aSt[100][$_AP_STI_COUNT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(55,51) : warning: $AP_BR_FILE: possibly used before declaration.
        $iSt = __AuAST_AddBranch($aSt, $AP_BR_FILE,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(65,43) : warning: $AP_STI_LEFT: possibly used before declaration.
        If $i Then $aSt[$iSt][$AP_STI_LEFT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(130,59) : warning: $AP_BR_GROUP: possibly used before declaration.
            $iStRet = __AuAST_AddBranch($aSt, $AP_BR_GROUP,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(151,56) : warning: $AP_BR_OP: possibly used before declaration.
            $iStRet = __AuAST_AddBranch($aSt, $AP_BR_OP,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(208,40) : warning: $AP_STI_RIGHT: possibly used before declaration.
            $aSt[$iStRet][$AP_STI_RIGHT]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(249,32) : warning: $AP_VARF_LOCAL: possibly used before declaration.
            $i = $AP_VARF_LOCAL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(251,33) : warning: $AP_VARF_Global: possibly used before declaration.
            $i = $AP_VARF_Global
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(253,30) : warning: $AP_VARF_DIM: possibly used before declaration.
            $i = $AP_VARF_DIM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(255,32) : warning: $AP_VARF_CONST: possibly used before declaration.
            $i = $AP_VARF_CONST
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(259,32) : warning: $AP_VARF_BYREF: possibly used before declaration.
            $i = $AP_VARF_BYREF
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(387,49) : warning: $AP_STI_BRTYPE: possibly used before declaration.
                    $aSt[$iStRet][$AP_STI_BRTYPE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(387,64) : warning: $AP_BR_STMT: possibly used before declaration.
                    $aSt[$iStRet][$AP_STI_BRTYPE] = $AP_BR_STMT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(412,70) : warning: $AP_BR_LOOKUP: possibly used before declaration.
                        If $aSt[$i][$AP_STI_BRTYPE] <> $AP_BR_LOOKUP Then
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(450,66) : warning: $AP_BR_DECL: possibly used before declaration.
                    $iStRet = __AuAST_AddBranch($aSt, $AP_BR_DECL,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(455,68) : warning: $AP_STI_VALUE: possibly used before declaration.
                            Case BitAND($aSt[$iStRet][$AP_STI_VALUE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(455,84) : warning: $AP_VARF_ENUM: possibly used before declaration.
                            Case BitAND($aSt[$iStRet][$AP_STI_VALUE], $AP_VARF_ENUM)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(466,119) : warning: $AP_VARF_STATIC: possibly used before declaration.
                                    $aSt[$iStRet][$AP_STI_VALUE] = BitOR($aSt[$iStRet][$AP_STI_VALUE], $AP_VARF_STATIC)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(519,90) : warning: $AP_BR_ENUMDEF: possibly used before declaration.
                        $aSt[$iStRet][$AP_STI_BRTYPE] = $AP_BR_ENUMDEF ; Correct the type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(558,54) : warning: $AP_BR_IF: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_IF,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(648,57) : warning: $AP_BR_WHILE: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_WHILE,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(676,55) : warning: $AP_BR_FOR: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_FOR,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(691,53) : warning: $AP_BR_FORIN: possibly used before declaration.
        $aSt[$iStRet][$AP_STI_BRTYPE] = $AP_BR_FORIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(778,54) : warning: $AP_BR_DO: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_DO,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(808,58) : warning: $AP_BR_SELECT: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_SELECT,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(827,57) : warning: $AP_BR_CASE: possibly used before declaration.
            $iCase = __AuAST_AddBranch($aSt, $AP_BR_CASE,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(870,58) : warning: $AP_BR_SWITCH: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_SWITCH,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(945,60) : warning: $AP_BR_FUNCCALL: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_FUNCCALL,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(1013,53) : warning: $AP_BR_FUNCDEF: possibly used before declaration.
    $iStRet = __AuAST_AddBranch($aSt, $AP_BR_FUNCDEF,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(1067,76) : error: __AuParse_ParseEnumDecls() called by a previous line with 5 arg(s). Max = 4. First previous line calling this Func is 520.
Func __AuParse_ParseEnumDecls(ByRef $lexer, ByRef $aSt, ByRef $tk, $iStRet)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\ault\Parser.au3"(1214,57) : warning: $AP_BR_ARRAY: possibly used before declaration.
    Local $iStRet = __AuAST_AddBranch($aSt, $AP_BR_ARRAY,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\Test.au3 - 1 error(s), 30 warning(s)
!>22:05:37 AU3Check ended. Press F4 to jump to next error.rc:2
+>22:05:37 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 0.8678

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Yeah, I'm not using Au3Check at the moment. I'll get AutoIt installed properly and see what Au3Check is showing. For now just not running Au3Check should let it run. 

Edit: It seems that just switching the order of the includes in test.au3 fixes all the warnings.

Edited by Mat
Link to comment
Share on other sites

Change in AST.au3

;~ #include "Parser.au3"

but then in Parser.au3  when comes to this line:

$iStRet = __AuParse_ParseEnumDecls($lexer, $aSt, $tk, $i, $iStRet)

 

Fires such errors:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\_AutoIt_Tools\Ault-master\Test.au3" /UserParams    
+>23:23:51 Starting AutoIt3Wrapper v.15.920.938.4 SciTE v.3.6.2.0   Keyboard:00000415  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64  Environment(Language:0415)  CodePage:65001  utf8.auto.check:4    # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\user\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\user\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.15.1)  from:C:\Program Files (x86)\AutoIt3  input:Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\_AutoIt_Tools\Ault-master\Test.au3
"Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\_AutoIt_Tools\Ault-master\ault\Parser.au3"(1067,76) : error: __AuParse_ParseEnumDecls() called by a previous line with 5 arg(s). Max = 4. First previous line calling this Func is 520.
Func __AuParse_ParseEnumDecls(ByRef $lexer, ByRef $aSt, ByRef $tk, $iStRet)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Z:\TOOLs\Macro\FORUM\___FORUM -- z forum\_AutoIt_Tools\Ault-master\Test.au3 - 1 error(s), 0 warning(s)
!>23:23:51 AU3Check ended. Press F4 to jump to next error.rc:2
+>23:23:51 AutoIt3Wrapper Finished.
>Exit code: 2    Time: 0.7442

So i change this line to:

$iStRet = __AuParse_ParseEnumDecls($lexer, $aSt, $tk, $iStRet)

Now scirpt is working but I do not know if this is proper results.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Only console output I get now it's working is...

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\User Name\Documents\PC\AU3CODE\Ault-master\Test.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>22:55:48 AutoIt3.exe ended.rc:0
+>22:55:48 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 65.32

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

run test.au3

Edit:... time to sleep .

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Sorry, didn't really have time to document what it does.

Given an input file (ExampleScript.au3) of this:

Local $a = 1, $b = 2
Local $foo = _MyFunction($a, $b)

ConsoleWrite($foo & @LF)

It will generate an array that looks like this:

AultExample.PNG

This is the syntax tree for the script, using an odd flat tree format documented here: https://github.com/MattDiesel/Ault/wiki/AST-Format

The "tree" starts at row 1, with a file. For a file branch, the LEFT value is a comma separated list of child branches, in this case "2,5,8,15" which correspond to rows in the array (these are: the definition of $a, the definition of $b, the definition of $foo and the ConsoleWrite call). If we look at row 15 for example, this is the AST for the function call "ConsoleWrite($foo & @LF)":

AultExampleConsoleWrite.PNG

From this starting point, it would be possible to implement something like Tidy (which is what the messagebox shows afterwards, though a rather naive and not too useful Tidy), or other tools, including executing the code. 

Edited by Mat
Link to comment
Share on other sites

Are you accepting PRs? I could tidy the files for you and fix a couple of bugs in test.au3.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Of course! That's why it's on github (as well as being incredibly easy to manage the code). "Sociable Coding" :) 

Let me know if there is anything else I need to explain. I probably won't be able to actively work on anything now term has started, but I'm not going to drop off the internet entirely for another couple of months yet.

Mat

Link to comment
Share on other sites

From the examples displayed, this looks like an interesting project. :) If you really want to get your head around how code works, this ought to be a great learning tool. Anything more it has to offer is surely a bonus, I put my trust in you, because it makes no sense to invest so much time and effort without reason. BTW, did you invent this Left / Right terminology layout system?

Edit: It's the first time I've come across this, so I'm a bit ignorant on the subject.

Edited by czardas
Link to comment
Share on other sites

From the examples displayed, this looks like an interesting project. :) If you really want to get your head around how code works, this ought to be a great learning tool. Anything more it has to offer is surely a bonus, I put my trust in you, because it makes no sense to invest so much time and effort without reason. BTW, did you invent this Left / Right terminology layout system?

Edit: It's the first time I've come across this, so I'm a bit ignorant on the subject.

An Abstract Syntax Tree (so the left/right tree structure) is how it's always done (well, except LISP maybe, but even that results in a tree like structure). The problem I was trying to solve was that AutoIt is not really that good at storing a tree structure. Nested arrays aren't efficient, and we don't have structures/classes and pointers. So the only new thing, is trying to use one array to describe a tree.

Link to comment
Share on other sites

  • 2 weeks later...

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