ReasonML: Unclosed "(" - reason

if(1<Array.length(Node.Process.argv)) {
Js.log("Too many arguments!");
}
The above 3-line ReasonML program does not compile:
Error: Unclosed "(" (opened line 1, column 2)
Tongue-in-cheek question: what is wrong? This is my pet peeve about ReasonML, because I counted parentheses and they do match.

I believe you need to insert a space after the <. As for the details of why this happens, I'm asking on Discord. I assume it has something to do with JSX.

Related

what does caret do in postgresql?

I'm playing hackthebox machine's and current one has a postgresql db in place. The query breaks with ' and appeas as follows:
ERROR: unterminated quoted string at or near "'" LINE 1: Select * from
cars where name ilike '%test'%' ^
I understand that % is being used to search within the query string for the characters provided but, What is ^ used for?
Bold highlights my test query
All my searches yielded resulst regarding regexes and caret signaling the start of the string. Plus other result about using cli or something like that.
Can anybody tell me what is it doing at the end of the query?
Your are looking for the use of the caret specifically within error messages.
If I run this query:
psql -c " Select * from cars where name ilike '%test'%'"
This is what I get, preserving line breaks and spaces:
ERROR: unterminated quoted string at or near "'"
LINE 1: Select * from cars where name ilike '%test'%'
^
The caret points to where on the previous line the error occurred. In this case, that is where the opening quote mark that never got closed was located.
If you are using a tool which malformats your error messages, you should consider changing to one that does not or otherwise figuring out how to fix it.

Literal identifier in back ticks in scala

As per the rule, "one or more of any character except a backquote, all enclosed in a pair of back-quotes", can be a valid identifier in scala. But the below one errors out.
scala> val `123` = "OneTwoThree"
<console>:5: error: ';' expected but double literal found.
lazy val $result = 123
^
<console>:9: error: ')' expected but double literal found.
"" + "123: String = " + _root_.scala.runtime.ScalaRunTime.replStringOf(123, 1000)
Am I missing something here ? Can someone please help. Thanks!
Gathering all the info in one answer so we can mark this question complete for the future visitors.
This is a known issue in the default Scala REPL. Follow the issue here
This currently only happens with numbers as per the ticket suggests. There likely is a sanitation issue.
This issue has been fixed in Ammomite that provides a 3rd party, open source REPL, with this commit. If you really need the REPL to support this feature, you can switch to Ammomite

autoComplete.js Unterminated group error when typing an opening parenthesis

I am trying to implement autoComplete.js on this site: http://bydaylight.com/testing/patent-defenses/
Some of the terms in our data have parenthesis like this:
112(1/a)
When I start typing in that exact string, I get an error after typing the opening parenthesis
Uncaught (in promise) SyntaxError: Invalid regular expression: /112(/: Unterminated group
autocomplete.js error screenshot
The data itself is just a simple array. Looks like this:
["100", "101", "112", "119", "120", "135", "273", "287", "295", "365", "102(e) ", "112(1/a)", "112(2/b)", "112(4/d)", "112(6/f) ", "271(a)", "271(b)", "271(c) ", "271(e) ", "271(f) ", "271(g)", "abatement", "ACQUIESCENCE", "admitted prior art", "Alice"]
Is there any special formatting I need to consider? Just looking for some guidance.
You're getting that error because of autoComplete.js matching method in strict mode is regex which conflicts with the brackets because it's considered as an invalid character and should be escaped inside regex pattern.
So you've two options for now to solve your issue:
Use loose mode instead of strict
Escape invalid characters before processing through query

When I run a file which is begin with "#!/usr/bin/perl -w", I get a error: "syntax error at line 153, near "=~ ?""

When I run a file which is begin with #!/usr/bin/perl -w, I get a error:
syntax error at line 153, near "=~ ?"
I try to add "#!/bin/bash", this error is not append, but I get another
error:
"line 34: syntax error near unexpected token `('"
line 153 in my file:
($output_volume =~ ?^([\S]+).mnc?) && ($base_name = $1) ||
die "sharpen_volume failed: output volume does not appear to be"
." a minc volume.\n";
line34 in my file:
use MNI::Startup qw(nocputimes);
$output_volume =~ ?^([\S]+).mnc?
This used to be valid perl and thus might appear in old code and instructional material.
From perlop:
In the past, the leading m in m?PATTERN? was optional, but omitting it would produce a deprecation warning. As of v5.22.0, omitting it produces a syntax error. If you encounter this construct in older code, you can just add m.
That is Perl code so the first error message is meaningful.
With delimiters other than // in the match operator you must have the explicit m for it, so
$output_volume =~ m?^([\S]+).mnc?
It is only with // delimiters that the m may be omitted; from Regex Quote-Like Operators (perlop)
If "/" is the delimiter then the initial m is optional.
See perlretut for a tutorial introduction to regex and perlre for reference.
Also note that the particular delimiters of ? trigger specific regex behavior in a special case. This is discussed by the end of the documentation section in perlop linked above.
You already have two answers that explain the problem.
? ... ? is no longer valid syntax for a match operator. You need m? ... ? instead.
Until Perl 5.22, your syntax generated a warning. Now it's a fatal error (which is what you are seeing). So I assume you're now running this on a more recent version of Perl.
There are, however, a few other points it is probably worth making.
You say you tried to investigate this by changing the first line of your file from #!/usr/bin/perl -w to #!/bin/bash. I'm not sure how you think this was going to help. This line defines the program that is used to run your code. As you have Perl code, you need to run it with Perl. Trying to run it with bash is very unlikely to be useful.
The m? ... ? (or, formerly, ? ... ?) syntax triggers an obscure and specialised behaviour. It seems to me that this behaviour isn't required in your case, so you can probably change it to the more usual / ... /.
Your regex contains an unescaped dot character. Given that you seem to be extracting the basename from a filename that has an extension, it seems likely that this should be escaped (using \.) so that it matches an actual dot (rather than any character).
If you are using this code to extract a file's basename, then using a regex probably isn't the best approach. Perhaps take a look at File::Basename instead.

Variable substitution of multiline list of strings in PostgreSQL

I'm trying to substitute the list in the following code:
kategori NOT IN ('Fors',
'Vattenfall',
'Markerad vinterled',
'Fångstarm till led',
'Ruskmarkering',
'Tält- och eldningsförbud, tidsbegränsat',
'Skidspår')
I found this question for the multiline part. However
SELECT ('Fors',
'Vattenfall',
'Markerad vinterled',
'Fångstarm till led',
'Ruskmarkering',
'Tält- och eldningsförbud, tidsbegränsat',
'Skidspår') exclude_fell \gset
gives
ERROR: column "fors" does not exist
LINE 1: SELECT (Fors,
^
, so I tried using triple quotes, dollar quotation and escape sequenses. Nothing has worked to satisfaction. This is true even if I use a single line variable and \set, so I must have misunderstood something about variable substitution. What is the best way of doing this?