Coder Social home page Coder Social logo

test runner prints invalid syntax about kataw HOT 7 CLOSED

kataw avatar kataw commented on June 18, 2024
test runner prints invalid syntax

from kataw.

Comments (7)

KFlash avatar KFlash commented on June 18, 2024

You can see it here:

printed_error

from kataw.

KFlash avatar KFlash commented on June 18, 2024

@aladdin-add This is a huge problem. Take this case fo\u0072 = x;. It get printed into for(; ; ). It's actually invalid syntax

from kataw.

aladdin-add avatar aladdin-add commented on June 18, 2024

in non-error-recovery mode, please do not ignore the errors silently! just throw the errors?

from kataw.

KFlash avatar KFlash commented on June 18, 2024

A printer shouldn't run in a error-recovery mode. Can you add a error handler in the test runner for this?

from kataw.

KFlash avatar KFlash commented on June 18, 2024

bar ? (, => {}) : baz; throws on null because the : token doesn't exist in the CST tree.

from kataw.

KFlash avatar KFlash commented on June 18, 2024

@aladdin-add this is how I do it locally. It will throw an error an never print the invalid syntax. Can you adopt this?

    const source = parse("bar ? (, => {}) : baz;",
      'root',
      Context.None,
      false,
      { allowTypes: true },
      function (a: any, b: any, c: any, d: any) {
        throw b + '(' + c + ', ' + d + ')';
      }
    );
    console.log(printSourceFile(source));

from kataw.

KFlash avatar KFlash commented on June 18, 2024

closing as fixed in the printer PR

from kataw.

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.