notepad4 icon indicating copy to clipboard operation
notepad4 copied to clipboard

Syntax highlighting for SAS

Open endo64 opened this issue 10 months ago • 6 comments

Any chance to integrate SAS lexer? https://github.com/StatTag/scintilla/blob/master/lexers/LexSAS.cxx

endo64 avatar Apr 23 '24 16:04 endo64

https://documentation.sas.com/doc/en/lrcon/9.4/part-1.htm https://documentation.sas.com/api/docsets/lrcon/9.4/content/lrcon.pdf

zufuliu avatar Apr 24 '24 10:04 zufuliu

Needs help to figure file extensions and keywords (and corresponding links) for SAS. Also here are questions for the lexer:

  1. the lexer treat // ... ; as comment but I can't find it in the document.
  2. the lexer use braces to fold code, however from samples in the document, Python like indentation seems is better.
  3. needs document for quoting rules, e.g. escape characters, variable highlighting inside quotes, whether string is multiple-line or not.

zufuliu avatar Apr 25 '24 10:04 zufuliu

I am not sure if pygments lexer here would help. There's another syntax rule can be found here

  1. the lexer treat // ... ; as comment but I can't find it in the document.

Yes, it is a comment. The comments rule is described here

  1. the lexer use braces to fold code, however from samples in the document, Python like indentation seems is better.

I think the Python like indentation is better.

  1. needs document for quoting rules, e.g. escape characters, variable highlighting inside quotes, whether string is multiple-line or not.

I don't think you need to think about variable highlighting inside a quote.

adayim avatar May 04 '24 16:05 adayim

Yes, it is a comment. The comments rule is described here

But it only says: Syntax *message; or /*message*/

No mention of C/C++ style //.

zufuliu avatar May 04 '24 22:05 zufuliu

Yes, you are right, // is not a comment. Sorry for the confusion. The comments need to start with /* or * and ends with ;. Comments can end with */ only if starts with /*.

adayim avatar May 05 '24 09:05 adayim

No, SAS doesn't support C style comments, supported formats are as below:

/********************
this is a comment block, cannot be nested,
can be multiline 
*********************/

*this is a line comment, should start with asterisk and end with a semicolon, cannot be multiline, cannot have a semicolon in between;

%* this is supported only in macros, between %macro and %mend

myvar = 42; *this is also supported, because it's a separate statement;

I saw the last one in an unofficial document, but I'm not sure if it is still supported, I'll test and let you know.

endo64 avatar May 05 '24 15:05 endo64

4f20795099b37acdf01515f276702de81af5dc13 added a simple lexer for SAS Viya 2024.06, please test latest builds from https://github.com/zufuliu/notepad4/actions

zufuliu avatar Jun 30 '24 02:06 zufuliu