Git Product home page Git Product logo

Comments (8)

adam-coster avatar adam-coster commented on June 8, 2024 1

Yeah, fair enough! I just pushed out v1.10.2 that includes the then keyword, so that should be resolved once it's available in VSCode.

from stitch.

adam-coster avatar adam-coster commented on June 8, 2024 1

Ah, yeah, that makes more sense. I tried a few experiments to see if I could get IIFE support working, but it would require some changes to the most recursive part of the parser and I couldn't make it work with a cursory try. Or, anyway, I couldn't make it work without causing other problems!

The parser logic is all here if you decide to try to figure it out yourself: https://github.com/bscotch/stitch/blob/develop/packages/parser/src/parser.ts

Definitely include test cases if you do!

from stitch.

adam-coster avatar adam-coster commented on June 8, 2024

I haven't seen then as a GML keyword and can't find it in the docs. Does your sample code mean the same thing as:

if(live_enabled){
  (function(){ // 1
    mt_gml_std_Date=new gml_std_haxe_class(-1,"gml_std_Date");
    // some more function definition
  );
}

?

In any event, that's a syntax we've never used and the Stitch Parser doesn't support. Do you have any doc references for this if() then syntax you're using?

from stitch.

stdc105 avatar stdc105 commented on June 8, 2024

Here's the documentation: Beta Manual

This is not a syntax we are actively using either. The only instance I found a then not in the comments or strings is this exact code sample.

About if your code is equivalent to the library code I provide, I think 99% that's the case. I am not entirely sure only because it seems like that function is only defined but not executed, and I have no idea why it would be there in the first place if it does nothing.

from stitch.

adam-coster avatar adam-coster commented on June 8, 2024

Yeah I was also wondering why it was defined but not executed. I might as well add the then as an optional keyword since it's in the spec, but in any case it's probably worth removing or rewriting that specific code sample if that doesn't break anything!

from stitch.

stdc105 avatar stdc105 commented on June 8, 2024

Haha, if that's our project code I'd be more confident to rewrite it, but GMLive builds a whole GML interpreter just to hot reload code, and I don't have the gut to touch it (at least not yet). Thank you for helping!

from stitch.

stdc105 avatar stdc105 commented on June 8, 2024

Welp, the then error is gone, but the error of a function inside a pair of parentheses is still there...

Also, I misread the library code -- the anonymous function will get executed at the end. There were too many parentheses, sorry about that! This is a new issue, Stitch doesn't understand "self-executing anonymous function" syntax, i.e. (function() { /* do something */ })(). It will report 2 errors, first on function (same as the second one in the issue, function unexpected), and second on the last closing parenthesis (Redundant input, expecting EOF but found: )).

from stitch.

stdc105 avatar stdc105 commented on June 8, 2024

Great, can't make any promise if I can make it work but I'll try this weekend!

from stitch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.