CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...

Home Page:http://cdelord.fr/pp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some error location indication

cpkio opened this issue · comments

commented

Got this error

pp.exe: Unexpected end of file in .\nsi-tweaking.rst   
An argument of the macro "" may not be correctly delimited.

The input file is correct RST. Sadly, there's no indication of location error if there is any. I've checked my file a few times and still cannot find what's triggering the error.

Looks like you're working under Windows, there could be different factors at stake here, could you provide more info about how you invoke PP (via CMD or Bash, using a batch or Bash script, and if under CMD check which code page you're using via CHCP).

Under Win CMD you might want to ensure you're using UTF-8 encoding via CHCP 65001. Also, beware that some native CMD commands only support Unicode via UTF-16, which might cause problems in pandoc/PP scripts if used in pipes.

pp.exe: Unexpected end of file in .\nsi-tweaking.rst

this could be caused by a null character in the STDIN stream, which might be due to UTF-16/UCS-2 encoding in piped streams.

As a general rule, it's safer to work using the Bash (e.g. the one that ships with Git for Windows) when working with pandoc and PP, because it uses UTF-8 encoding by default, and it also provide many useful tools which are not available in the CMD.

commented

I'm invoking pp nsi-tweaking-v03.rst from PowerShell or CMD, no piping. I have 65001 enabled all over, since console emulator is my main working place. File is UTF-8 CRLF, which is compiled fine by pandoc to DOCX.

pp fails without a hint where to look, thats the problem.

Can you please share a minimal example that shows the problem?
The error message contains the name of the macro which parameter is not correctly delimited. But its name is empty, which is weird.

This may be a bug in the parser. e.g. with an invalid code block as a second argument, pp produces the same kind of error:

!def(f)(1:!1 2:!2)

!f(x)
``
y
```

I'll push a quick fix.

commented

I got it figured out by splitting the file in half. The 5th level header of my RST was underscored by ~, which is literate programming char in pp. The length of it is 49 chars. And it seems to ignore !literatemacrochars(?).