ORIGINAL: berto
Another thing I need to do is to have fewer "syntax error:" and more "warning:" and/or use more 'txterrmsg(_ERROR, ..., <explicit error message> ...)' function calls.
Consider another seeming agelint false positive:
ERROR: in Events/ANMAI.sct, at (or near) line 644: syntax error: #E# (0x45), #EndEvent#
in event evt_nam_ANA_BreakAlliance_Tracker:
635 EvalRgnOwned = $Dobropole;NOT
636
637 Actions
638
639
640
641 SetControl = $Dobropole 5
642
643
644> EndEvent
645
646
647 SelectFaction = $ANM
648 StartEvent = evt_nam_AI_ANMlocalMC11|999|0|NULL|NULL|NULL|NULL
649
650 Conditions
651 EvalEvent = evt_nam_ANA_BreakAlliance_Tracker;=;1
652 CheckAILevel = 1
653 MinDate = 1919/01/01
You might think: "What's the problem? There is an Actions statement, and if you look in the actual Events/ANMAI.sct file, you see too that there are appropriate StartEvent and Conditions statements. Everything seems in order here.
False positive!"
Except it's not a false positive, rather yet another misleading ERROR: line.
The problem is the missing ; field separator in the preceding statement
641 SetControl = $Dobropole 5
It should instead be
641 SetControl = $Dobropole;5
as the usage database shows
[root@telemann agelint]# ./kwddat SetControl
1 SetControl = $Achit;80
1 SetControl = $Chaikovskiy;80
1 SetControl = $Ertarskiy;80
1 SetControl = $Kamensk-Uralskiy;80
1 SetControl = $Kataysk;80
1 SetControl = $Krasnoufimsk;80
1 SetControl = $Kueda;80
1 SetControl = $Kungur;80
1 SetControl = $Miass;80
1 SetControl = $Ozersk;80
1 SetControl = $Redva;80
1 SetControl = $Shalya;80
1 SetControl = $Vassilevsko-Chaitanski;80
1 SetControl = $Vishnevogorsk;80
14 SetControl = 35
22 SetControl = 65
47 SetControl = 45
72 SetControl = 55
91 SetControl = 15
106 SetControl = 95
133 SetControl = 5
156 SetControl = 10
157 SetControl = 90
173 SetControl = 70
180 SetControl = 30
180 SetControl = 85
191 SetControl = 25
252 SetControl = 40
276 SetControl = 60
428 SetControl = 20
434 SetControl = 80
483 SetControl = 75
775 SetControl = 50
5487 SetControl = 0
112441 SetControl = 100
and as the AGEWiki page for the SetControl statement suggests. (But note: the AGEWiki is in error, because it stipulates | as the field separator; but again actual usage shows ; instead!)
In keeping with my vow to add clearer, more numerous explicit txterrmsg() errors and warnings, and reduce the frequency of ambiguous, misleading "syntax error" messages, I have modified the setcontrol parser rule to be:
Code: Select all
setcontrol: _SETCONTROL eq pct
| _SETCONTROL eq alsval sc pct
| _SETCONTROL eq alsval pct { txterrmsg(_ERROR, TRUE, linenorhs, "missing ; field separator"); }
| _SETCONTROL eq alsval { txterrmsg(_ERROR, TRUE, linenorhs, "missing ; field separator, else missing value"); }
{
/*
http://www.ageod.net/agewiki/SetControl
Syntax: SetControl = [RegionUID;]Value
*/
}
;
Why the two different error cases? It's because AGE aliases can contain spaces (
<sigh> [:(]), so the txt.l lexer might view the '$Dobropole 5' as an alsval alone, not an alsval pct.
Do you begin (or continue) to see how difficult this all is, how much detailed attention, care, patience, skill and even artistry is necessary to Do It Right?
With that change, and after recompiling agelint and running it against the Events/ANMAI.sct file, we now get:
ERROR: in Events/ANMAI.sct, at (or near) line 641: missing ; field separator, else missing value
632 CheckAILevel = 1
633 MinDate = 1919/01/01
634 MaxDate = 1923/01/01
635 EvalRgnOwned = $Dobropole;NOT
636
637 Actions
638
639
640
641> SetControl = $Dobropole 5
642
643
644 EndEvent
645
646
647 SelectFaction = $ANM
648 StartEvent = evt_nam_AI_ANMlocalMC11|999|0|NULL|NULL|NULL|NULL
649
650 Conditions
Error pinpointed at the offending SetControl statement, no more misdirection to the correct EndEvent statement, "false positive" eradicated, mission accomplished!
I have lots of work ahead of me. In every case where common AGE script and data file coding errors lead to
ambiguous, contextual "syntax error" complaints, I will have to account for those errors with new txt.y parser cases with meaningful, informative txterrmsg(_ERROR, ...) calls like the above.
Adding all of that will take time. The next official AGElint release will be delayed, I'm sad to say. [:(]
In order to minimize the wait, I will likely -- as pledged -- focus on RUS, ACW & ROP -- and just ignore the other games for now. Work on the other games will follow in the weeks ahead.
The good news is that I have mainly finished the work of adding all actions statements to the parser cond: (Conditions) section, but give txterrmsg() warnings; and adding all conditions statements to the parser act: (Actions) section, and likewise give txterrmsg() warnings.
Thank you for your continuing patience and interest!