question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

csx parsing problems

See original GitHub issue

I found a few problems with csx parsing:

  1. #load directive with next expression start with string
#nullable enable
#load "ScriptHelper.csx"

"Hello world".Dump();

Produce error: Could not find file '/Users/mark/Code/CSharpLab/ScriptHelper.csx"'.

Although it works:

#nullable enable
#load "ScriptHelper.csx"

;
"Hello world".Dump();
  1. using statement without parenthesis or a block on top level
using var connection = new SqliteConnection($"Data Source={dbPath}");

Produce errors: error CS0103: The name 'connection' does not exist in the current context error CS1002: ; expected

Although it works:

void Func()
{
  using var connection = new SqliteConnection($"Data Source={dbPath}");
}
  1. Reference to Microsoft.NET.Sdk.Web not work · Issue #716 · dotnet-script/dotnet-script

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
i-markcommented, May 22, 2023

I try to transform my LINQPad queries to dotnet-script. In LINQPad 1, 2 work without problems.

@i-mark LINQPad doesn’t use C# scripting like this tool so it’s not bound to the same restrictions. LINQPad turns your query/script into a whole C# program, somewhat like what I emulate in LINQPadless.

Ok, thx.

I run it with c# scripting and this code throw (1,11): error CS1002

var options = ScriptOptions.Default
		.AddReferences(typeof(Console).Assembly)
		.AddImports("System")
		.AddImports("System.IO");

//var statement = "using (var ms = new System.IO.MemoryStream()) {};";
var statement = "using var ms = new System.IO.MemoryStream();";
await CSharpScript.RunAsync(statement);
0reactions
atifazizcommented, May 22, 2023

I try to transform my LINQPad queries to dotnet-script. In LINQPad 1, 2 work without problems.

@i-mark LINQPad doesn’t use C# scripting like this tool so it’s not bound to the same restrictions. LINQPad turns your query/script into a whole C# program, somewhat like what I emulate in LINQPadless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Example: CSX-Lite
In LL(1) parsing, syntax errors are automatically detected as soon as the first illegal token is seen. How? When an illegal token is...
Read more >
what would you use to write a parser in 2021? : r/Compilers
LR parser generators will catch a lot of grammar issues for you automatically. Upvote 1
Read more >
Parsing absolutely anything in JavaScript using Earley algorithm
Ambiguity will present performance issues (multiple routes need to be analysed to complete parsing). It will also lead to hard to catch bugs...
Read more >
Rewriting the Ruby parser
But I'm no longer as optimistic. The main problem is that nearly all languages have syntax that cannot be easily formalized using declarative...
Read more >
A Beginner's Guide to Parsing in Rust | Depth-First
The problem is that the current Scanner API forces mutators and accessors to be applied in separate operations. Given a complex language with ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found