Open batracos opened 6 years ago
How about replacing \b
with [\b$`]
? In any case, isn't this best fixed by updating the variable "symbol", currently defined as
symbol: '[$[:alpha:]]+[$[:alnum:]]*'
In which way would you update that? I can only think of a negative look-behind on defined symbols would be terribly expensive.
[\b$`]
would just move the backtick or the dollar to the other match but in this case we want Plus$Plus
to be a single scope.
@chere005, @Shigma, any idea?
Was this fixed, or did you still want some input?
I did not touch this because good patterns (that I was able to find) bring bad performance and vice versa.
I did not touch this because good patterns (that I was able to find) bring bad performance and vice versa.
I don't consider it a problem since the current syntax for wolfram is not complicated compared with other languages.
In my option, how about inserting a pattern (?![$`])
before the ending \b
?
We should also be aware that some system contexts share the same name with built-in functions, although this seems beyond the scope of this issue.
This is exactly what I am using locally. I never committed that because I am not super sure about it but given that we are already in two people coming up with the same solution I would go for it.
\b(?:AASTriangle|...)(?![$`])\b
Regarding the contexts: I don't think that Image
should be highlighted in Image`foo
.
I just tested (?![$`])
and it looks good to me, @Shigma can you please add this to your current PR?
I just tested
(?![$`])
and it looks good to me, @Shigma can you please add this to your current PR?
It has already been included in one of @batracos ' branches, see here.
Yeah sorry. I have been meaning to create a PR for that for some time. I'll do it today.
The current rules will match an expression like
as a system symbol (
Plus
) followed by a normal symbol ($Plus
).I have not looked into all the consequences but my current proposal is to replace the second
\b
in the regex expression by(?![$`[:alnum:]])
. This would also fix expressions like