ID:2380605
 
BYOND Version:512.1427
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 68.0.3440.42
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.

code\_globalvars\bitfields.dm:473:error: "TESLA_MACHINE_EXPLOSIVE": missing comma ',' or right-paren ')'
code\_globalvars\bitfields.dm:473:error: "TESLA_MACHINE_EXPLOSIVE": missing comma ',' or right-paren ')'
code\_globalvars\bitfields.dm:327:error: list started here
code\_globalvars\bitfields.dm:473:error: "TESLA_MACHINE_EXPLOSIVE": expected end of statement
code\_globalvars\bitfields.dm:473:error: ,: expected }
code\_globalvars\bitfields.dm:327:error: location of top-most unmatched {


https://github.com/Jalleo/StarTrek13/blob/ 575d964e6704604a92e838d2832add57e20819af/code/_globalvars/ bitfields.dm (time frozon link)

A downstream had issues and asked for help, my power level is not strong enough

The files before and after in #inclsuion order have under 50 lines.
The version that TG and I have are the same (for this file) and we didnt have this file before now. I am in the middle of a rebase to get newer TG code. This didnt occur on my last commit but only once I pulled in the commits from the downstream I am trying to do the rebase for. Its not complete yet I think the error is from elsewhere but I cant work out what....


Edit: SpaceManiac found the cause at the same time as me.
https://github.com/Jalleo/StarTrek13/blob/ 575d964e6704604a92e838d2832add57e20819af/code/__DEFINES/ flags.dm#L68
Appears to have been caused by this mistake earlier in the codebase:

//tesla_zap
#define TESLA_MACHINE_EXPLOSIVE (1<<0)
#define TESLA_ALLOW_DUPLICATES (1<<1)#define TESLA_OBJ_DAMAGE (1<<2)
#define TESLA_MOB_DAMAGE (1<<3)
#define TESLA_MOB_STUN (1<<4)
Any chance this could be reduced to a simpler test case, since the cause seems to be known? It would be helpful for fixing the compiler if I could see it in action in a small case.
I havent got the time to do so at the moment or know how to go about to setup such a test case.
#define X(v) v

#define ONE 1
#define TWO 2#define THREE 3
#define FOUR 4

var/thelist = X(list(
"foo" = list(
"one" = ONE,
"two" = TWO,
),
"bar" = list(
"three" = THREE,
"four" = FOUR,
)
))


16-line file, error supposedly on line 19.

Removing the X(...) around the list(...) corrects the error line number to 10.
#define X(v) v

var/thelist = X(list(
"one" = 1#
))


Five line file, compiler spits out
test.dme:6:error: bad number



edit: Actual error line + number of newlines in list in macro argument = reported error line;
i.e:

#define X(v) v

var/thelist = X(list( // one newline
"one" = 1, // two newlines
"two" = 2#, // three newlines, error is here on L5
"three" = 3, // four newlines
))


Error is really on line 5, there are 4 newlines in the list => the error should be reported on line 9.

test.dme:9:error: bad number


edit 2: this macro-argument stuff stacks, too; both:
#define Y(v) v
#define X(v) Y(v)

var/thelist = X(list( // one newline
"one" = 1, // two newlines
"two" = 2#, // three newlines, error is here
"three" = 3, // four newlines
))

and:
// dummy line for line numbers to match up
#define X(v) v

var/thelist = X(X(list( // one newline
"one" = 1, // two newlines
"two" = 2#, // three newlines, error is here
"three" = 3, // four newlines
)))

pass the list as an argument to two macros; the error is on line 6, there are 4 newlines, and the error is reported at line 14 in both cases. Removing one macro call changes it to report line 10, removing both to line 6.