Author Topic: Lexer treats two question-marks on a line as a string?  (Read 6227 times)

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Lexer treats two question-marks on a line as a string?
« on: October 24, 2006, 11:55:18 AM »
Hi, I've run into an interesting problem that I don't understand.  I have a lexer defined for a custom s-expression based language using Tools > Options > File Extension Setup....  The problem is that when I have two question-marks on a line, it treats everything between them as a string.

For instance, if I have

Code: [Select]
?foo <- (bar ?foo)
Then "foo <- (bar " is highlighted in the color of a string, and no parens in this "string" are used for matching (which is inconvenient).  I tried making the ? part of the identifier name (which it is), tried making it not part of the identifier name, and tried making it a punctuation character.  I also tried various random options under the other menus (e.g., turning on or off treating \' as a single quote and \" as a double quote when embedded in a string).

I'm running VS 11.0.2 on Win XP Pro SP 2.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2897
  • Hero Points: 153
Re: Lexer treats two question-marks on a line as a string?
« Reply #1 on: October 24, 2006, 12:00:32 PM »
Alex:

So it is treating what is between the two ?s as a string, but should not be?

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: Lexer treats two question-marks on a line as a string?
« Reply #2 on: October 24, 2006, 01:54:14 PM »
Yes, exactly.  It's basically acting like two question-marks on a line are quote characters.  (Also, if this matters, it seems to treat the word following the second quote as a keyword.)

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2897
  • Hero Points: 153
Re: Lexer treats two question-marks on a line as a string?
« Reply #3 on: October 24, 2006, 01:58:19 PM »
Can you send me the file?

alex

  • Community Member
  • Posts: 64
  • Hero Points: 6
Re: Lexer treats two question-marks on a line as a string?
« Reply #4 on: October 24, 2006, 02:05:21 PM »
Thank you!  That fixed it, in a roundabout way.  I was looking at my user.vlx file to see exactly what it had in it before I sent it to you, and I noticed that the style= line included the language I'd selected under the Language tab.  It was set to Perl.  I had originally thought that the language selected just governed the options that were grayed out below the list of languages, but when I saw it in the user.vlx file, I realized it might be relevant.

Set the language to "other", and now it's working right.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2897
  • Hero Points: 153
Re: Lexer treats two question-marks on a line as a string?
« Reply #5 on: October 24, 2006, 02:08:44 PM »
Ah, good.  Those options are very language specific.  In order to have everything exposed to the dialog they sort of have to be there, but it is very unlikely you would ever turn one on for a language other than the one specified unless they were extremely similar.  This is because they tend to control some very specific behaviors (like this one).