qwertie / ecsharp

Home of LoycCore, the LES language of Loyc trees, the Enhanced C# parser, the LeMP macro preprocessor, and the LLLPG parser generator.
http://ecsharp.net
Other
172 stars 25 forks source link

The error Semicolon': expected Colon for the specific code #126

Open dadhi opened 3 years ago

dadhi commented 3 years ago

Given the following code:

using System;

static class X
{
    internal static bool TryGetUsedInstance(this IResolverContext r, int serviceTypeHash, Type serviceType, out object instance)
    {
        instance = null;
        return r.CurrentScope? .TryGetUsedInstance(r, serviceTypeHash, serviceType, out instance) == true 
            || r.SingletonScope.TryGetUsedInstance(r, serviceTypeHash, serviceType, out instance);
    }
}

I've got the error:

LeMP macro compiler (2.8.3.0)
Test3.ecs(9,98): Error: 'Semicolon': expected Colon
Test3.ecs(9,98): Error: ';': Expected an expression: (parentheses), {braces}, identifier, literal, or $substitution. 

Btw: I've started to play with running LeMP for the https://github.com/dadhi/DryIoc/blob/v5-dev/src/DryIoc/Container.cs which is 14k of locs ;-) and for now, I've got only this error and #125 .

My biggest worry was the performance but for now, the LeMP output is almost instantaneous - which is a pleasant surprise! I will test it further when the mentioned problems are fixed.

qwertie commented 3 years ago

Ahh. I thought that ?. was a single operator (rather than a pair of separate tokens) so that's what the parser currently expects.

dadhi commented 3 years ago

I thought that ?. was a single operator

Now I get it, can live with this - will change the code on my side.