Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expl3 syntax regressions #150

Closed
Evpok opened this issue Sep 23, 2017 · 4 comments
Closed

expl3 syntax regressions #150

Evpok opened this issue Sep 23, 2017 · 4 comments

Comments

@Evpok
Copy link

Evpok commented Sep 23, 2017

I did not notice before because I hadn't used LaTeX3 syntax for a while, but it seems that there are some regressions. Most notably

  • The latex3-style parameter sigils (:N and consorts) are not highlighted as advertised in expl3 syntax highlighting #48 (comment)
  • Highlighting switches back to LaTeX2e within braces
  • Leading double underscores in commands are not supported
  • Commands with a single underscore in their names are not supported
\ExplSyntaxOn
    \tl_new:N\single_underscore
    \tl_new:N\__two_leading_underscores
    \tl_set:Nn\g_correctly_highlighted{\but_this_isnot}
    \tl_new:N\g_file_seq_name_tl
    \tl_gset:Nn\g_file_seq_name_tl{g_file_name_seq}
    \seq_gpush:cV{\tl_use:N\g_file_seq_name_tl}\l_tmpa_tl
\ExplSyntaxOff

screenshot_20170923_190020

Version infos:

  • language-latex: 1.1.1
$ atom-beta --version
Atom    : 1.21.0-beta1
Electron: 1.6.9
Chrome  : 56.0.2924.87
Node    : 7.4.0
@yudai-nkt
Copy link
Collaborator

Sorry for the slow response.

The latex3-style parameter sigils (:N and consorts) are not highlighted as advertised in #48 (comment)

It seems that argument specifications are correctly highlighted in your screenshot as well.

Highlighting switches back to LaTeX2e within braces

Yes, I know this problem although I haven't made a corresponding issue here. Please refer to yudai-nkt/language-tex#9.

Leading double underscores in commands are not supported

Leading double underscores mean that the command is a private expl3 function and therefore requires a following argument specification. So, \__two_leading_underscores is not highlighted on purpose while something like \__two_leading_underscores:Npm is highlighted.

Commands with a single underscore in their names are not supported

Commands with a single underscore mean that the command is an expl3 function and therefore requires a following argument specification.

All of the expl3 support is based on the naming convention documented in the section 3.2 of expl3.pdf. Please let me know if I have some misunderstandings about expl3.

@Evpok
Copy link
Author

Evpok commented Oct 20, 2017

The latex3-style parameter sigils (:N and consorts) are not highlighted as advertised in #48 (comment)

It seems that argument specifications are correctly highlighted in your screenshot as well.

They are of the same colour as the command name, whereas in #48 (comment) they are of a different one.

image

Leading double underscores mean that the command is a private expl3 function and therefore requires a following argument specification. So, __two_leading_underscores is not highlighted on purpose while something like __two_leading_underscores:Npm is highlighted.

I can live with that, I just noticed it while checking for other regressions, my initial issue being with commands with a single underscore.

Commands with a single underscore mean that the command is an expl3 function and therefore requires a following argument specification.

Commands (well, macros) with a single underscore are used for variable names, as in e.g. \g_ior_file_name_seq (from espl3 doc), or indeed \g_file_seq_name_tl

@yudai-nkt
Copy link
Collaborator

yudai-nkt commented Oct 20, 2017

They are of the same colour as the command name, whereas in #48 (comment) they are of a different one.

I think that is more of a problem of syntax theme you're using. What's scope for the argument specification? It should be support.function.type.expl3.latex.

Commands (well, macros) with a single underscore are used for variable names

I misunderstood you meant macros containing only one underscores by "single". \g_file_seq_name_tl is a valid expl3 variable and should be highlighted. The current regex seems to correctly parse the expl3 variables, but I'll investigate what breaks the functionality.

@yudai-nkt yudai-nkt added the bug label Oct 20, 2017
@Evpok
Copy link
Author

Evpok commented Oct 20, 2017

I think that is more of a problem of syntax theme you're using. What's scope for the argument specification? It should be support.function.type.expl3.latex.

Indeed it is, sorry for that, I tend to forget that base16 themes tend to be light on distinctions like this one.

I misunderstood you meant macros containing only one underscores by "single". \g_file_seq_name_tl is a valid expl3 variable and should be highlighted. The current regex seems to correctly parse the expl3 variables, but I'll investigate what breaks the functionality.

Actually, reading back my original message, that's what it meant and \single_underscore is indeed not a name that should be used according to expl3's guidelines. Still feels a bit odd that the syntax highlighter should enforce it this strictly, but OK.

Sorry for bothering you, I should have looked at my original example before answering. (I do have other issues with expl3 syntax in a cls file, but that's another issue)

@Evpok Evpok closed this as completed Oct 20, 2017
@yudai-nkt yudai-nkt removed the bug label Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants