HaxeCheckstyle / haxeparser

A Haxe parser for Haxe
61 stars 23 forks source link

"Parsing failed" with #error #29

Closed Gama11 closed 8 years ago

Gama11 commented 8 years ago

Discovered this when running haxe-checkstyle on the std lib. Seems like haxeparser simply doesn't know about #error.

C:\HaxeToolkit\haxe\std/Std.hx:1: character 0 : Error: Parsing failed: { msg => Custom(Please don't add haxe/std to your classpath, instead set HAXE_STD_PATH env var), pos => { file => C:\HaxeToolkit\haxe\std/Std.hx, max => 1177, min => 1171 } }
Stacktrace: 
Called from haxeparser/HaxeParser.hx line 131
Called from hxparse/Parser.hx line 36
Called from hxparse/ParserBuilderImpl.hx line 112
Called from haxeparser/HaxeParser.hx line 265
Called from Checker.hx line 115
Called from Checker.hx line 148
Simn commented 8 years ago

Did you try that with the development version? I'm pretty sure I have parsed the entire standard library with haxeparser.

Gama11 commented 8 years ago

The development version of what, Haxe? I'm currently on 3.2.0.

Simn commented 8 years ago

Of haxeparser

Gama11 commented 8 years ago

There doesn't really seem to be a development version right now, since master is up to date with the latest haxelib release? And haxe-checkstyle uses that version (3.2.0).

Simn commented 8 years ago

Oh, I didn't remember I actually made a haxelib release at some point.

This actually works as expected, if you check Std.hx you'll find that the message you're seeing is the one coming from the #error itself. Try defining "cross" via https://github.com/Simn/haxeparser/blob/master/src/haxeparser/HaxeParser.hx#L259.

Simn commented 8 years ago

P.S.: I just checked, haxeparser makes it through the entire std directory with the defines "cross", "scriptable" and "unsafe". See https://github.com/Simn/haxeparser/blob/master/test/TestStd.hx.

Simn commented 8 years ago

P.S.2: If you know how to we can add that to travis by the way. All it requires is adding this with the correct path to build.hxml:

-D haxe_std_path=C:\github\haxe\std