X-Sharp/XSharpPublic

Problems with UDC starting with a '@'

Opened this issue · 3 comments

Describe the bug
There are problems with UDC starting with a '@'

To Reproduce

#xtranslate @enum { <var1>[(<desc1,...>)] [,<varN>[(<descN,...>)]] };
    => ;
exported:;;
    class var <var1> readonly;
    [;class var <varN> readonly];;
    inline class method initClass();;
        local i := 0;;
        ::addValue(::<var1> := ::new(++i, <"var1">[, <desc1>]));
        [;::addValue(::<varN> := ::new(++i, <"varN">, <descN>, nil))];; // [, <descN>] - error XBT0513; без NIL - warning XBT0124
    return

#xtranslate @enum { <var1>[(<desc1,...>)] };
    => ;
exported:;;
    class var <var1> readonly;;
    inline class method initClass();;
        ::addValue(::<var1> := ::new(1, <"var1">[, <desc1>]));;
    return

class ExampleEnum from Enum
    @enum {CONST1("desc1"), CONST2("desc2")}
endclass

Expected behavior (XBase++ ppo)

class ExampleEnum from Enum
    exported:;class var CONST1 readonly;class var  CONST2 readonly;inline class method initClass();local i := 0;::addValue(::CONST1 := ::new(++i, "CONST1",  "desc1"));::addValue(:: CONST2 := ::new(++i, "CONST2",  "desc2", nil));return
endclass

Actual behavior (X# ppo)

class ExampleEnum from Enum
    @enum {CONST1("desc1"), CONST2("desc2")}
endclass

with compiler error XS9002: Parser: unexpected input '@'

Additional context
X# Compiler version 2.20.0.3 (public)
-dialect:xBase++
-codepage:866
-lb -enforceself -memvar -xpp1 -vo1 -vo3 -vo4 -vo5 -vo9 -vo10 -vo12 -vo13 -vo14 -vo15 -vo16 -vo17
-reference:XSharp.Core.dll
-reference:XSharp.RT.dll
-reference:XSharp.XPP.dll

Did this work before?

We have simplified the UDC for enums, so we didn't check it on earlier versions

The problem in the UDC is not in the @ character, but in the <desc1,...> markers inside the optional clauses.
If you change these to <desc1>, the example compiles.
Your test code does not need a list match marker there. Do you know if your real code uses the list marker?