fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: better error message: for instead of foreach

better error message: for instead of foreach 17 Sep 2019 11:17 #10746

  • wriedmann's Avatar

  • wriedmann

  • Topic Author


  • Posts: 2232
  • Hello,

    one of my frequent errors when using the "foreach" statement is to write "for" instead of "foreach". i.e. to write
    for oItem as MyItem in oList
    next
    instead of
    foreach oItem as MyItem in oList
    next
    In this case the compiler gives a similar error message:
    error XS9002: Parser: unexpected input ....
    Would it be possible to specify it better?
    Thank you very much!
    Wolfgang
    P.S. I'm asking here before adding a ticket because I'm not sure if such a request is appropriate
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 15:05 #10748

  • FFF's Avatar

  • FFF


  • Posts: 929
  • Wolfgang,
    not what you asked, but are you aware of this in template.cfg in XIDE:
    ..
    fore,FOREACH \c AS IN \rNEXT\r
    forei,FOREACH IMPLIED \c IN \rNEXT\r
    ...

    I know, i use the shortcuts not enough, as i code too little to memorize them, but in this case it might be helpful.

    BTW, @Chris: i think i asked for this years ago ;), but the icing on the cake for this would be:
    fore <Tab>
    myItem <Tab>, Cursor jumps behind the "AS "
    myType <Tab>, Cursor jumps behind the "IN "
    myCollection <Tab>, Cursor jumps to next line

    I just think you and you baby could do this ;-)
    Regards
    Karl (X# 2.4a; Xide 1.25; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    Last edit: by FFF.

    better error message: for instead of foreach 17 Sep 2019 15:42 #10749

  • wriedmann's Avatar

  • wriedmann

  • Topic Author


  • Posts: 2232
  • Hi Karl,

    yes, I'm aware of it. My main problem is that I'm not able to remember all these templates - I'm using only very few of them.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 16:08 #10750

  • FFF's Avatar

  • FFF


  • Posts: 929
  • wriedmann wrote: Hi Karl,

    yes, I'm aware of it. My main problem is that I'm not able to remember all these templates

    B)
    So i'm not alone...
    But, as i wrote, the "multi tab" would enhance the usefullness a lot further...
    Regards
    Karl (X# 2.4a; Xide 1.25; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 16:26 #10751

  • wriedmann's Avatar

  • wriedmann

  • Topic Author


  • Posts: 2232
  • Hi Karl,

    maybe I will add a context menu entry to select a template to insert - that could help.

    Wolfgang
    P.S. did you knew I'm driving a "poor mans Tesla" now?
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 16:38 #10752

  • Chris's Avatar

  • Chris


  • Posts: 1891
  • Wolfgang - Yeah, agreed, there are several places where parser errors could become more straightforward. As time passes, more an dmore of them will be improved, it's just not of highest priority. Will log this particular one.

    Karl - Every single time I use the FOREACH template, this is exactly what I am also thinking, so it is not that I have forgotten about it :). It's just a lot of work to implement it and it will be useful in only 2-3 templates, but will finally do it in one rainy day!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 16:42 #10753

  • wriedmann's Avatar

  • wriedmann

  • Topic Author


  • Posts: 2232
  • Hi Chris,

    thank you very much!
    It is of course a lot of work to prodice useful error messages, but it will be very helpful for people starting with X#, I think.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 16:55 #10754

  • FFF's Avatar

  • FFF


  • Posts: 929
  • wriedmann wrote: P.S. did you knew I'm driving a "poor mans Tesla" now?

    A "3"? Congratulations! Meanwhile i'm at 62,5k km in < 18 months, still grinning everytime i see my car ;-)
    Regards
    Karl (X# 2.4a; Xide 1.25; W8.1/64 German)

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 17 Sep 2019 16:58 #10755

  • wriedmann's Avatar

  • wriedmann

  • Topic Author


  • Posts: 2232
  • Hi Karl,

    no, a Renault Zoe. The 3 is still off limits for me, but maybe in a few years <g>.
    10.000 km in about 4 months... and very happy with it.

    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Last edit: by wriedmann.

    better error message: for instead of foreach 17 Sep 2019 17:05 #10757

  • Chris's Avatar

  • Chris


  • Posts: 1891
  • Hi Wolfgang,

    The problem is not writing messages, this is the very easy part. The big task is not letting the parser handle those situations in a general way, but provide specialized error identifying and reporting for every single different case.

    Btw, congrats for your Zoe! (which means "life" in Greek)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 18 Sep 2019 06:07 #10761

  • wriedmann's Avatar

  • wriedmann

  • Topic Author


  • Posts: 2232
  • Hi Chris,

    I know that the providing of special messages is a bigger task, but IMHO it is very important because clear error messages are a big help during the development - and can be a real time saver.

    Wolfgang
    BTW: I like electric driving very much, specially in the mountains
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 18 Sep 2019 15:30 #10762

  • Chris's Avatar

  • Chris


  • Posts: 1891
  • Hi Wolfgang,

    I agree, very often generic parser errors make it very difficult to find what's the problem exactly. Problem is it's 100s of cases where it needs to be adjusted...
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 29 Sep 2019 06:15 #10943

  • ic2's Avatar

  • ic2


  • Posts: 672
  • Chris wrote: Wolfgang - It's just a lot of work to implement it and it will be useful in only 2-3 templates, but will finally do it in one rainy day!


    Note that there is no such thing as a "rainy day" in Greece :lol:

    Dick

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 29 Sep 2019 12:47 #10954

  • robert's Avatar

  • robert


  • Posts: 1692
  • Dick,

    I thought that too, but when I visited Chris In Lamia in October 2018 it was raining 'cats and dogs'....

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 29 Sep 2019 13:14 #10956

  • lumberjack's Avatar

  • lumberjack


  • Posts: 681
  • robert wrote: Dick,
    I thought that too, but when I visited Chris In Lamia in October 2018 it was raining 'cats and dogs'....

    Raining cats and dogs here at the moment... Parks board are on standby to open up lagoons in the area due to possible flood risk seeing we also on spring tide...
    ______________________
    Johan Nel
    George, South Africa

    Please Log in or Create an account to join the conversation.

    better error message: for instead of foreach 29 Sep 2019 16:53 #10957

  • Chris's Avatar

  • Chris


  • Posts: 1891
  • Yeap, we didn't use to have much rain, in fact had issues with available water 20 years ago. But now we are getting closer to a tropical climate, have 5-6 months of a lot of heat (it's end of September and we're still having temps over 30C), followed by 3 months that rains almost every single day where I live. Then, in the Winter we are now getting snow every year, which was also a rarity in the past.

    No, no, there's no climate change, it's a conspiracy! :)
    (sarcasm...)
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1