Author Topic: Fascinating Mobile Parse Error  (Read 4524 times)

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Fascinating Mobile Parse Error
« on: February 28, 2008, 12:51:21 AM »
OK, I have given it 5 hours, and I am stuck.

I have a parse error
Code: [Select]
[BG1NPC/Phase2/baf/X#MIINT2.BAF] PARSE ERROR at line 302 column 28-33
Near Text: GLOBAL
        syntax error

[BG1NPC/Phase2/baf/X#MIINT2.BAF]  ERROR at line 302 column 28-33
Near Text: GLOBAL
        Parsing.Parse_error
ERROR: parsing [BG1NPC/Phase2/baf/X#MIINT2.BAF]: Parsing.Parse_error

Isolating and commenting out each block one at a time has resulted in moving the error line to 304, 302, 303... but I can't determine a pattern.

Commenting out the tp2 lines compiling and evaluating the file results in everything else in the mod installing fine, and recheck for an oddity with string delimiters and variables shows no troubles.

If someone can show me where I have a problem, I would greatly appreciate the help/extra eyes. I have marked line 302 (and have been concentrating on finding the line before it that causes the trouble).

Code: [Select]
/* Minsc, When first entering the Candlekeep catacombs */
IF %BGT_VAR%
AreaCheck("%Candlekeep_Catacombs_L1%")
Global("X#MWFETCC","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#MWFETCC","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MWFETCC","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Myself)
END

/* Minsc, When Entering The First Level Of The Low Lantern (gambling ship) */
IF %BGT_VAR%
AreaCheck("%BaldursGate_DocksLowLantern_D1%")
Global("X#MWETFLOTLL","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#MWETFLOTLL","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MWETFLOTLL","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Myself)
END

/* Minsc, Upon Entering The Area Where Cloakwood Mines Are Located */
IF %BGT_VAR%
AreaCheck("%CloakwoodMines_MineShed%")
Global("X#MUETAWCMAL","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#MUETAWCMAL","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MUETAWCMAL","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Myself)
END

/* Minsc, Upon entering the Lost City: */
IF %BGT_VAR%
AreaCheck("%Undercity%")
Global("X#MUETLC","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#MUETLC","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MUETLC","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Myself)
END

/* Vitiare */
IF %BGT_VAR%
AreaCheck("%NashkelCarnival_VitiaresTent%")
OR(2)
Global("X#MinscVitiare","GLOBAL",1)
Global("X#MinscVitiare","GLOBAL",4)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
IncrementGlobal("X#MinscVitiare","GLOBAL",1)
END

IF %BGT_VAR%
OR(2)
Global("X#MinscVitiare","GLOBAL",2)
Global("X#MinscVitiare","GLOBAL",5)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* Gnoll's Stronghold, Khalid NIP */
IF %BGT_VAR%
AreaCheck("%GnollStronghold%")
Global("X#MinscStronghold","GLOBAL",0)
GlobalLT("X#DYQJournalTalk","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
!InParty("khalid")
THEN
RESPONSE #100
SetGlobal("X#MinscStronghold","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MinscStronghold","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* BG Sewers */
IF %BGT_VAR%
GlobalGT("X#MUETAWCMAL","GLOBAL",1)
Global("X#MinscSewer","GLOBAL",0)
OR(4)
AreaCheck("%BaldursGate_Undercellars%")
AreaCheck("%WSewers%")
AreaCheck("%CentralSewers%")
AreaCheck("%ESewers%")
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#MinscSewer","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MinscSewer","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* Minsc Edwin Pre-Dynaheir Shutdown */
IF %BGT_VAR%
Global("X#MinscProtestsEdwin","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InParty("dynaheir")
THEN
RESPONSE #100
SetGlobal("X#MinscProtestsEdwin","GLOBAL",5)
END

/* Minsc attacks party if joined Edwin */
IF %BGT_VAR%
Global("X#MinscProtestsEdwin","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InParty("edwin")
!StateCheck("edwin",CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!InParty("dynaheir")
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#MinscProtestsEdwin","GLOBAL",2)
END

IF %BGT_VAR%
Global("X#MinscProtestsEdwin","GLOBAL",2)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InParty("edwin")
!StateCheck("edwin",CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!InParty("dynaheir")
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* Ankhegs */
IF %BGT_VAR%
AreaCheck("%FishingVillage%")
Global("X#MinscAnkhegs","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#MinscAnkhegs","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MinscAnkhegs","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* Lighthouse */

IF %BGT_VAR%
AreaCheck("%Lighthouse%")
Global("X#Minsc3600","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#Minsc3600","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#Minsc3600","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)    // <<<<<<<<THIS IS LINE 302
PlaySound("minsc99")
Dialog(Player1)
END

/* Cloakwood Nest */
IF %BGT_VAR%
Global("X#Minsc2100","GLOBAL",0)
AreaCheck("%CloakwoodNest%")
Global("X#Minsc2100","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#Minsc2100","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#Minsc2100","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* CK Catacombs */
IF %BGT_VAR%
AreaCheck("%Candlekeep_Catacombs_L1%")
Dead("phlydia")
Global("X#MinscPhlydia","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#MinscPhlydia","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#MinscPhlydia","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

/* Gallor */
IF %BGT_VAR%
GlobalGT("X#DynaMinscHelpGallor","GLOBAL",0) //auto-set from Dynaheir interjection
Global("X#MinscHelpGallor,"GLOBAL",0)
InParty(Myself) //No "CombatCounter(0)" here!
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#MinscHelpGallor","GLOBAL",1)
SetLeavePartyDialogFile()
ChangeAIScript("",DEFAULT)
LeaveParty()
Enemy()
END


/* REPLACED MISSING DIALOGUE TRIGGER */

/* Minsc and Boo on Traps and Spiders */
IF %BGT_VAR%
AreaCheck("%Candlekeep_Catacombs_L1%")
Global("X#Minsc2615","GLOBAL",0)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN
RESPONSE #100
SetGlobal("X#Minsc2615","GLOBAL",1)
END

IF %BGT_VAR%
Global("X#Minsc2615","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Player1)
END

Link to nonfunctioning mod (internal 15 E, not for distribution obviously, as it currently fails to install):

EDIT:  //removed link
« Last Edit: February 28, 2008, 05:11:46 PM by cmorgan »

jastey*

  • Guest
Re: Fascinating Mobile Parse Error
« Reply #1 on: February 28, 2008, 01:00:30 AM »
I know this behaviour, usually it is something like a missing " in a completely different location. I spotted a missing " in this block:

/* Gallor */
IF %BGT_VAR%
GlobalGT("X#DynaMinscHelpGallor","GLOBAL",0) //auto-set from Dynaheir interjection
Global("X#MinscHelpGallor,"GLOBAL",0)
InParty(Myself) //No "CombatCounter(0)" here!
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
SetGlobal("X#MinscHelpGallor","GLOBAL",1)
SetLeavePartyDialogFile()
ChangeAIScript("",DEFAULT)
LeaveParty()
Enemy()
END

Maybe that already soves the problem. I can't check right now, unfortunately.

Offline Kulyok

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 6253
  • Gender: Female
  • The perfect moment is now.
Re: Fascinating Mobile Parse Error
« Reply #2 on: February 28, 2008, 01:16:30 AM »
jastey beat me to it.

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Fascinating Mobile Parse Error
« Reply #3 on: February 28, 2008, 01:19:26 AM »
Jastey, you are a Goddess, a wonder, I throw myself at your feet - that was it.

I have spent the last few hours REMing every block *before* the error, not *after* the error, oe at a tiome, opening the file in ASCII errors to find if it was corrupted, searching for problems with " " % % ~ ~ matching - I bet I just learned something about COMPILE EVALUATE_BUFFER.

the bigg, does the line error not evaluate the same way for parse errors on

COMPILE ~mybaf.baf~

where you usually look before the error line to find out where the problem is, so that on

COMPILE ~mybaf.baf~ EVALUATE_BUFFER

it could be anywhere in the file?

(going to bed - eyes burning and too tired to wrap it up, but will check in in the am here [ok, will check in in the PM since it is past 1 am and I have Band rehearsal at 7am] before final testing and such. If this is even the right forum - nope. ok, bed.)
« Last Edit: February 28, 2008, 01:22:05 AM by cmorgan »

jastey*

  • Guest
Re: Fascinating Mobile Parse Error
« Reply #4 on: February 28, 2008, 01:25:17 AM »
Well, let's say I just spent several tedious hours to find such a problem in my own mod recently...

I got this bug report problem in a mod that didn't use EVALUATE_BUFFER, btw.

Glad it's solved! I feel all useful and important now.

Offline berelinde

  • Planewalker
  • *****
  • Posts: 1188
  • Gender: Female
    • Gavin, cleric of Lathander, for Tutu
Re: Fascinating Mobile Parse Error
« Reply #5 on: February 28, 2008, 01:33:44 AM »
Oops. The quote key on my keyboard sticks dreadfully. Time to either take it apart and clean it or just shell out $15 for a new one. Considering that this keyboard is several years old, and that the eventual fate of any keyboard owned by me is death by coffee, I'm probably due for a new one.

Offline Kulyok

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 6253
  • Gender: Female
  • The perfect moment is now.
Re: Fascinating Mobile Parse Error
« Reply #6 on: February 28, 2008, 01:42:47 AM »
There are quote keys on some keyboards? I'm green with envy; I've never seen one.

Offline berelinde

  • Planewalker
  • *****
  • Posts: 1188
  • Gender: Female
    • Gavin, cleric of Lathander, for Tutu
Re: Fascinating Mobile Parse Error
« Reply #7 on: February 28, 2008, 01:48:25 AM »
Well, I don't exactly see it either, because I can't look at the keys while typing or I get terribly confused.

(checks) Oh yeah, there it is, between the semi-colon and the enter key. ;)

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Fascinating Mobile Parse Error
« Reply #8 on: February 29, 2008, 08:00:58 AM »
Your text editor should have shown you the quote mismatch, when you scrolled to the end of the file. (Proper syntax highlighting assumed.) But you probably never went to EOF, right?

the bigg, does the line error not evaluate the same way for parse errors on

COMPILE ~mybaf.baf~

where you usually look before the error line to find out where the problem is, so that on

COMPILE ~mybaf.baf~ EVALUATE_BUFFER

it could be anywhere in the file?
Not sure if I understood you correctly, but my answer would be that the line error should be the same.
As far as I know parsing takes place before evaluating, so you should get the same parse error.

Did that line mismatch lead you to that conclusion?
I really love investigating WeiDU stuff ( ;)), so I tried to find the source of that mismatch this morning.

It looks like WeiDU has a bug counting lines when they start with "!" (NOT, e.g. in a trigger).
Count the number of exclamation marks up to the line where the syntax error is. Should be (real_error_line - reported_line).
I'll take a look at the numerous parser/lexer files in WeiDU source and report to the bigg, if I have some spare time tonight.

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Fascinating Mobile Parse Error
« Reply #9 on: February 29, 2008, 08:23:05 AM »
Sigh. We got around teaching children how to tie their shoes, but people still don't grasp the basic idea that OMFG YOU HAVE TO FUCKING INDENT YOUR FILES NOOB.

If you're curious, this was added to allow people to name their kits C!SHAR or whatever without majorly breaking other people's scripts.

Fixed for 205 anyway.
« Last Edit: February 29, 2008, 08:36:39 AM by the bigg »
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Fascinating Mobile Parse Error
« Reply #10 on: February 29, 2008, 08:59:47 AM »
Puh, saves me some time for sleeping tonight.  :)
Indenting indeed persuades WeiDU to count correctly. (Feels like python here.)

But I'm still not getting it: What does prevent WeiDU from counting the newline when NOT is at BOL?


Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Fascinating Mobile Parse Error
« Reply #11 on: February 29, 2008, 10:32:34 AM »
Short version: believe me.

Long version:
the lexer requires manual prodding to update correctly the line&column info.

src/baflexer.mll:
Code: [Select]
| [^'('')''0'-'9''A'-'Z''a'-'z''#''_''-''!']? '!' { adj lexbuf; NOT }Nothing scary, it says "if you find a ! character, preceded by a blank or similar, call the adjusting function on the `<one character>!' string and say "I found a NOT"".

the adjusting function, v204 and prior:
Code: [Select]
let adj lb =
  let c = the_context () in
  c.lexbuf <- lb ;
  c.delta <- (Lexing.lexeme_end lb) - (Lexing.lexeme_start lb) ;
  c.col <- c.col + c.delta
"if adjusting with a string that is X characters long, keep line info as it is and increment column by X characters".

Now, if I found <newline>!, what it does is "increment column count by 2, and report the not". Of course, it should have instead incremented the line count, thus breaking the line reporting.

Enter the 205+ fixed adj function, which was used before for strings (in case there were new lines in an item description) but nowhere else:
Code: [Select]
let adj lb =
  let c = the_context () in
  c.lexbuf <- lb ;
  let st= Lexing.lexeme lb in
  for i = 0 to (String.length st) - 1 do
    if st.[i] = '\n' then newline ()
    else begin
      c.col <- c.col + 1; c.delta <- c.delta + 1 ;
    end
  done
"iterate over a string, on a newline increment line count and turn column count to 0, otherwise increment column count".
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Fascinating Mobile Parse Error
« Reply #12 on: February 29, 2008, 10:57:34 AM »
Ah thanks, perfectly clear now.

I already found that line in baflexer.mll and also found out how it interacts with the stuff in util.ml.
But I forgot that
Code: [Select]
[^'('')''0'-'9''A'-'Z''a'-'z''#''_''-''!']? also matches newline and so
Code: [Select]
| '\n'  { newline (); initial lexbuf }
is not matched. (At first, I thought it's the newline at the end of the NOT line that is not counted, but it is obviously the newline before.)

What about placing the newline match thingie before the not part? Will it eat up that newline so it's never there to match it in the not part? (/Edit: Or what about adding the newline to the list of excluded chars?)
But if your fix works (and I'm sure it does) it's probably better not to touch this. (I'm not so firm with ocaml lexer anyway.)
« Last Edit: February 29, 2008, 11:08:18 AM by Taimon »

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Fascinating Mobile Parse Error
« Reply #13 on: February 29, 2008, 12:11:03 PM »
The 'longest rule' always wins, you can't decide the order or anything. Excluding the newline would require a second line to enable it, or make invalid non-indented !Triggers(). But forcing NL checks&evaluations in all situations beats including it in a single case  :)
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Fascinating Mobile Parse Error
« Reply #14 on: February 29, 2008, 12:50:12 PM »
The NOT regex should still match a '!' at the start of the line even if newline is excluded. (Because of the '?' modifier. lexbuf would be empty.)
But I'm not sure if the newline is simply eaten up, so we would have solved nothing.
 
But forcing NL checks&evaluations in all situations beats including it in a single case  :)

Absolutely!
Thanks for the clarification and have a nice weekend.

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Fascinating Mobile Parse Error
« Reply #15 on: February 29, 2008, 04:00:35 PM »
I think I understood about 10% of that last set of posts, but let me check and see if I have the final resiults down accurately:

If I want to make sure that the parse errorrs I create are able to be picjed up correctly in terms of line numbers, I shouldn't do Nythrun's famous "everything in a single line" baf:

Code: [Select]
IF %BGT_VAR% Global("X#MWETFLOTLL","GLOBAL",1) InParty(Myself) !StateCheck(Myself,CD_STATE_NOTVALID) InMyArea(Player1) !StateCheck(Player1,CD_STATE_NOTVALID) THEN RESPONSE #100 PlaySong(0) PlaySound("minsc99") Dialog(Myself) END
I shouldn't do my infamous newbie 'cleanup' of code
Code: [Select]
IF %BGT_VAR%
Global("X#MWFETCC","GLOBAL",1)
InParty(Myself)
!StateCheck(Myself,CD_STATE_NOTVALID)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
PlaySong(0)
PlaySound("minsc99")
Dialog(Myself)
END

I should grow cahones and code like The Bigg boyz, with correct indenting (2? 4? \t? )

Code: [Select]
/* Gallor */
IF  %BGT_VAR%
  GlobalGT("X#DynaMinscHelpGallor","GLOBAL",0) //auto-set from Dynaheir interjection
  Global("X#MinscHelpGallor,"GLOBAL",0)
  InParty(Myself) //No "CombatCounter(0)" here!
  !StateCheck(Myself,CD_STATE_NOTVALID)
  InMyArea(Player1)
  !StateCheck(Player1,CD_STATE_NOTVALID)
THEN
RESPONSE #100
  SetGlobal("X#MinscHelpGallor","GLOBAL",1)
  SetLeavePartyDialogFile()
  ChangeAIScript("",DEFAULT)
  LeaveParty()
  Enemy()
END

But since I don't smell that bad and you have a ton of free time on your hands, you just adjusted the parser to allow my newb crap to actually work, thus saving me from going back through and indenting a zillion files for BG1NPC .bafs...

Offline Taimon

  • Planewalker
  • *****
  • Posts: 328
Re: Fascinating Mobile Parse Error
« Reply #16 on: February 29, 2008, 04:17:02 PM »
Correct! :)
Indenting enhances readability (at least for me), so yes, you should probably use it.
But this was clearly a (very minor) bug in WeiDU, so don't be to harsh on yourself.  ;)

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Fascinating Mobile Parse Error
« Reply #17 on: February 29, 2008, 05:09:49 PM »
I'm not being hard on myself - if I was being hard on myself, I'd be angry that there was a parse error to *find* :D

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Fascinating Mobile Parse Error
« Reply #18 on: February 29, 2008, 08:33:36 PM »
I should grow cahones and code like The Bigg boyz, with correct indenting (2? 4? \t? )
Among the nerdy Linux developers, indenting is source of more flame wars than IA vs. B2Fixpack.
My preference is to use \t for indentation and spaces to line up for prettyfying reasons. I use a \t length of 2 (because OCaml and WeiDU pretty much require lots of indentations), but the standard is 8.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Fascinating Mobile Parse Error
« Reply #19 on: February 29, 2008, 08:37:17 PM »
Cool! I'll stick with 2, since the 8 space will seriously require me to move up to a widescreen monitor and the 4 gets auto-converted to a tab in sme text editors (and since I change those around a good bit and foget which ones I have customized, it is just safer to foillow your lead and stick with 2).

Offline the bigg

  • The Avatar of Fighter / Thieves
  • Planewalker
  • *****
  • Posts: 3804
  • Gender: Male
Re: Fascinating Mobile Parse Error
« Reply #20 on: February 29, 2008, 08:42:55 PM »
Any decent editor should allow you to customize tab width and behavior in more ways than you can possibly understand.

Of course, in our community the important thing is that you can understand quickly your files, as it's hard that more than one person works at the same time on a given file, and when a file (or mod) changes maintainer the new one will quickly adapt to working with the new standard.

We're not like the Linux kernel, where the same file can accept patches by three people and be read by one hundred every patch release, meaning that unified look is an absolute requirement.
Author or Co-Author: WeiDU (http://j.mp/bLtjOn) - Widescreen (http://j.mp/aKAiqG) - Generalized Biffing (http://j.mp/aVgw3U) - Refinements (http://j.mp/bLHoCc) - TB#Tweaks (http://j.mp/ba02Eg) - IWD2Tweaks (http://j.mp/98OFYY) - TB#Characters (http://j.mp/ak8J55) - Traify Tool (http://j.mp/g1Ry9A) - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics (http://j.mp/9UeIwB) - Nalia Mod (http://j.mp/dng9l0) - Nvidia Fix (http://j.mp/aRWjjg)
Code dumps: Detect custom secondary types (http://j.mp/hVzzXG) - Stutter Investigator (http://j.mp/gdtBn8)

If possible, send diffs, translations and other contributions using Git (http://j.mp/aBZFrq).

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: