Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't distuingish escaped and interpolation dollar signs #36

Closed
Gama11 opened this issue Sep 17, 2016 · 2 comments
Closed

Can't distuingish escaped and interpolation dollar signs #36

Gama11 opened this issue Sep 17, 2016 · 2 comments

Comments

@Gama11
Copy link
Member

Gama11 commented Sep 17, 2016

class Main {
    public static function main() {
        trace(new haxeparser.HaxeParser(byte.ByteData.ofBytes(sys.io.File.getBytes("File.hx")), "").parse());
    }
}

File.hx (escaped $):

class C {
    var j = "";
    var i = '$$j';
}

File.hx (interpolation $):

class C {
    var j = "";
    var i = '$j';
}

Both of these result in EConst(CString($j)) as the expression for i, which means you can't tell them apart. In haxeparser 3.2.0, the escaped $ would actually show as two dollar signs in the expression: EConst(CString($$j))

This causes some of the failures in HaxeCheckstyle/haxe-checkstyle#262.

@Gama11
Copy link
Member Author

Gama11 commented Sep 17, 2016

Related issue: HaxeFoundation/haxe#1852

Gama11 added a commit to HaxeCheckstyle/haxe-checkstyle that referenced this issue Sep 18, 2016
There's still some failing tests (see #262 and HaxeCheckstyle/haxeparser#36), but I think it's better to ignore those for now than to not test against latest Haxe and haxeparser at all.
@Simn
Copy link
Collaborator

Simn commented Oct 12, 2016

I'll go ahead and close this because it's consistent with how Haxe lexes it. I'm not saying that approach isn't shit, but for now I want to keep haxeparser as close to Haxe as possible.

@Simn Simn closed this as completed Oct 12, 2016
Gama11 referenced this issue in HaxeCheckstyle/haxe-checkstyle Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants