profezzorn / ProffieOS-StyleEditor

GNU General Public License v3.0
7 stars 5 forks source link

Should probably allow comma at end? #64

Open NoSloppy opened 1 year ago

NoSloppy commented 1 year ago

I think a majority of copy/paste from config files will include a trailing comma like >(),

This currently is allowed to be submitted and works, but throws an error "Expected identifier or number" It goes away of course once clicking the right side structured view and the StylePtr<>() gets stripped.

NoSloppy commented 1 year ago

hmm. not doing it now.

NoSloppy commented 1 year ago

Wait...yes it is.

NoSloppy commented 1 year ago

This change seems to work, not sure it doesn't break something else though?

identifier() {
    var ret = "";
    while (true) {
      var c = this.peek();
      if ((c >= 'a' && c <= 'z') ||
    (c >= 'A' && c <= 'Z') ||
    (c >= '0' && c <= '9') || c == '_' || c == ':' ||
    /* allow StylePtr<.....>(), ending that has a trailing comma */
    (c == ")" && this.peek2() == ",")) {
  ret += c;
  this.pos++;
      } else {
  return ret;
      }
    }
  }
NoSloppy commented 1 year ago

I can't make heads or tails of this. Sometimes it seems to work, sometimes not. Adding the line in the comment above seems to just produce the same "sometimes" results.