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
177 stars 25 forks source link

operator true and operator false trigger syntax errors #62

Closed j4m3z0r closed 5 years ago

j4m3z0r commented 6 years ago

Classes using operator true or operator false trigger a syntax error in LeMP:

#ecs;

// Create a class with some properties
public class Class
{
    public static bool operator true(Class c) {
        return false;
    }
}

LeMP returns

  Syntax error in expression at 'operator'; possibly missing semicolon

Microsoft's docs on operator true and false are here

qwertie commented 6 years ago

Crap, I'd never needed those operators before, I guess I forgot about them when writing the parser. I guess I'll make it a priority.

j4m3z0r commented 6 years ago

Thanks David. FWIW I am currently working around it by using partial classes and putting those operators into a separate file not touched by LeMP (so I wouldn't call this a critical issue). But I'm moving more and more of my codebase across to LeMP, so it would be great to have this covered so as to minimize the number of these workarounds.

qwertie commented 6 years ago

I just committed support for operator true and false.

j4m3z0r commented 6 years ago

Awesome. Thanks David! I'll try it out later today.