AutoHotkey Community

It is currently May 27th, 2012, 5:17 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 

How many categories of syntax error message boxes are there? (see below)
2
3
4
5+
You may select 1 option

View results
Author Message
PostPosted: January 2nd, 2011, 8:07 pm 
Offline

Joined: February 17th, 2008, 5:01 pm
Posts: 303
Hi, all. I'm trying to categorize the types of syntax errors that AHK finds so that I can scrape the line numbers of the syntax errors from the message box that AHK throws up and write a script to jump to the relevant line of the source code. (Pretty cool, eh?) So far, I've found two categories of errors. In the first, the message box starts with "Error at line nnnn." These are fairly easy to find. In the second catgory, the box starts with "Error: " and at some point has "---> nnnn:" in it. (as a regex; "Error:.+--->\s+(\d+): "). Here are three examples:
Code:
; Error at line 3919. ... Error: This line does not contain a recognized action.
; Error: Call to nonexistent function ... --->     3919: fname()
; Error: Target label does not exist. ... --->     3919: Gosub, subname

Can anyone think of ones that I missed?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2011, 3:39 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
There are currently about 60 unique error messages defined in script.h of the (AutoHotkey_L) source code, plus some that are used directly in calls to Line::LineError() or Script::ScriptError().

More importantly, there are (afaik) two basic forms you will need to parse:
  • Errors occurring at load-time without a specific fully-parsed line to point at; i.e. syntax errors. These begin with "Error at line ".
  • Run-time errors. These show ---> the current line (usually the line on which the error occurred) and surrounding lines (unless the script is compiled).

Btw, these could be detected automatically via a shell hook...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2011, 6:47 am 
Offline

Joined: February 17th, 2008, 5:01 pm
Posts: 303
Many thanks! That was exactly what I was looking for.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], XstatyK, Yahoo [Bot] and 75 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group