Giter VIP home page Giter VIP logo

Comments (4)

davecramer avatar davecramer commented on August 10, 2024

@mlt I wonder if the PR that added the syntax checking broke this ?

from plr.

mlt avatar mlt commented on August 10, 2024

Somehow I feel like curly braces are missing. Does the second example run alright?

Line endings are sanitized in both cases: on validation and on running. I tried to bring this up on R-dev mailing list as in why for a parser not to ignore CRs... But those guys are harsh :(

from plr.

JamesInform avatar JamesInform commented on August 10, 2024

Yes, the second example run alright!

Curly braces doesn't fix it. The error seems to occur every time the "ELSE" is on a new line.

Btw. the function example is taken from the official PLR documentation:

http://www.joeconway.com/plr/doc/plr-funcs.html

from plr.

mlt avatar mlt commented on August 10, 2024

I confirm the issue with PG 11 on Windows. When validating, I try to parse just function body without function(args) {...} stuff. Hence, I presume, R tries to parse each line into its own SEXP and somehow it is not good on top level. This seems to be consistent with R REPL

> if (2)
+ 3
[1] 3
> else 4
Error: unexpected 'else' in "else"

My plan is to wrap function body in {...} for validation (basic syntax check) purposes only. I'm not sure there is any reason to generate accurate function definition at this point.

For quick workaround, one can create language without validator.

CREATE LANGUAGE plr
HANDLER plr_call_handler
INLINE plr_inline_handler;
-- VALIDATOR plr_validator;

I'll provide the patch.

from plr.

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.