SpacemanDMM icon indicating copy to clipboard operation
SpacemanDMM copied to clipboard

Can't parse library inclusions

Open Kaiochao opened this issue 5 years ago • 8 comments

#include<author/library/library.dme> in a .dm file gives

unexpected token Punct(Less), expecting Token::String(path)
path separated by '.', should be '/'
got '>', expected one of: '/', '[', contents, newline, identifier

Kaiochao avatar May 07 '19 11:05 Kaiochao

Was aware of this, but thanks for officially filing it

SpaceManiac avatar May 07 '19 21:05 SpaceManiac

Can't #include non-library .dme files either: unknown extension "dme"

Kaiochao avatar Jul 15 '19 14:07 Kaiochao

.dme files are treated just like .dm files as of 574f1f780eed39be19e7aeb5cd04066980458740.

Library inclusion requires more work due to the way the parser is structured.

SpaceManiac avatar Jul 16 '19 01:07 SpaceManiac

What's the problem with this currently?

Cyberboss avatar Apr 12 '20 03:04 Cyberboss

#include <a/b/c.dm> is tokenized as [Less, "a", Slash, "b", Slash, "c", Dot, "dm", Greater] and preprocessor chokes on it because it wants a single string literal

SpaceManiac avatar Apr 12 '20 07:04 SpaceManiac

Note that there are two prongs to this:

  1. Changing the way the lexer and preprocessor interact so that the preprocessor can see <a/b/c.dm> as a single unit rather than a token stream
  2. Determining BYOND install locations so that a <> include can actually be located and parsed

SpaceManiac avatar Apr 12 '20 19:04 SpaceManiac

Is there a workaround to this? I just ran into the same problem. The parser cannot continue and all evaluation gets skipped.

UltraJohn avatar Aug 30 '22 21:08 UltraJohn

The workaround is to copy-paste the libraries into your project's source tree instead of using BYOND's library system.

SpaceManiac avatar Aug 31 '22 00:08 SpaceManiac