-
Notifications
You must be signed in to change notification settings - Fork 10
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
Operater optimization #26
base: master
Are you sure you want to change the base?
Conversation
also alias for Out (%)
@@ -278,8 +357,22 @@ contexts: | |||
- include: sequence | |||
- match: (?=[^\[]) | |||
pop: true | |||
- match: ((?:{{symbol}}`)*(\${{symbol}}))(?=\s*:?=) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule was here to add to the index global variable declarations
$GlobalValue = xxx;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this rule was not grammatical. System global varibles are defined by "built-in" variables. General varibles begin with "$" are not necessarily a "constant".
- include: expressions | ||
|
||
expressions: | ||
- include: declarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am no sure we should index all the localized functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "index" mean?
From my perspective, "declarations" have no grammatical difference with other expressions and should not be ruled out.
WolframLanguage.sublime-syntax
Outdated
@@ -90,14 +106,19 @@ contexts: | |||
pop: true | |||
|
|||
literals: | |||
- match: (?:\d+\.?|\.\d)\d*\`{0,2} | |||
# numbers, with base, scientific notation, precision or accuracy | |||
- match: ([0-9]+\^\^)?{{number}}(\`\`?({{number}})?)?(\*\^{{number}})? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first {{number}}
can contain letters to represent digits in bases higher than 10.
I was working on this syntax but we can do it here as well. This would be my proposal
- match: ([0-9]+\^\^)?{{number}}(\`\`?({{number}})?)?(\*\^{{number}})? | |
- match: |- | |
(?x) | |
(?:(\d+)(\^\^)) | |
((?:[$[:alnum:]]+\.?|\.[$[:alnum:]])[$[:alnum:]]*) | |
(?:(\`\`?)({{number}})?)? | |
(?:(\*\^)([+-]?\d+))? | |
captures: | |
1: constant.numeric.base.wolfram | |
2: keyword.operator.base.wolfram | |
3: constant.numeric.wolfram | |
4: keyword.operator.precision.wolfram | |
5: constant.numeric.precision.wolfram | |
6: keyword.operator.exponent.wolfram | |
7: constant.numeric.exponent.wolfram | |
- match: |- | |
(?x) | |
({{number}}) | |
(?:(\`\`?)({{number}})?)? | |
(?:(\*\^)([+-]?\d+))? | |
captures: | |
1: constant.numeric.wolfram | |
2: keyword.operator.precision.wolfram | |
3: constant.numeric.precision.wolfram | |
4: keyword.operator.exponent.wolfram | |
5: constant.numeric.exponent.wolfram |
I know it does not distinguish between precision and accuracy but I did not want to explode the pattern even more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And exponents can have a decimal point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
((?:[$[:alnum:]]+.?|.[$[:alnum:]])[$[:alnum:]]*)
What is $
for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't like the idea to treat ^^
and *^
as "operators". If they were operators, they should have precedence and expressions like 8 ^^ 10
should be right. But obviously not.
- match: ((?:System`)?{{built_in_numeric_constants}}) | ||
scope: constant.numeric.wolfram | ||
- match: ((?:System`)?{{built_in_constants}}) | ||
scope: constant.language.wolfram | ||
- match: ((?:System`)?{{built_in_options}}) | ||
scope: variable.function.wolfram | ||
scope: variable.parameter.wolfram |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is conceptually wrong but I think function
was there to have the same colouring for all System symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But built-in-constants are displayed as "constants".
Updates
11`
(*^^ constant.numeric *)
(* ^ constant.numeric.precision *)
11.`11
(*^^^ constant.numeric *)
(* ^^^ constant.numeric.precision *)
.11``
(*^^^ constant.numeric *)
(* ^^ constant.numeric.accuracy *)
11.11``
(*^^^^^ constant.numeric *)
(* ^^ constant.numeric.accuracy *)
11^^1a
(*^^^^ constant.numeric.base *)
(* ^^ constant.numeric *)
11.11*^-11
(*^^^^^ constant.numeric.wolfram *)
(* ^^^^^ constant.numeric.exponent *)
_.
(*^^ variable.parameter.default *)
var_head
(*^^^^^^^^ meta.parameter *)
(*^^^ variable.parameter *)
(* ^ variable.parameter.blank *)
(* ^^^^ variable.parameter.head *)
var__head : foo
(* ^ meta.pattern keyword.operator.Optional *)
var___head ? EvenQ
(* ^ meta.pattern keyword.operator.PatternTest *)
var: patt ? EvenQ : foo
(*^^^ variable.parameter *)
(* ^ keyword.operator.Pattern *)
(* ^^^^^^^^^^^^ meta.pattern *)
(* ^^^^ variable.other*)
(* ^ keyword.operator.PatternTest *)
(* ^^^^^ variable.function *)
(* ^ keyword.operator.Optional *)
(* ^^^ variable.other *)
|
Re 7 I would keep |
I did install it to start looking at things actually... first issue:
|
Another issue:
|
I tested the |
This is causing MAJOR performance detriments on my machine. I couldn't even open a file with 10k+ lines of code, but when I switched to the plugin on master it loaded instantly. |
Some of the changes are proposals and others are features.
declarations
intoexpressions
for supporting following condition:built_in_options
withvariable.parameter
. I know this is not that accurate, but much better thanvariable.function
. Any ideas for this scope are welcomed.&
withvariable.function
instead ofkeyword.operator
. I think this would be more appropriate.These functions are currently listed as variables. With further development of branch
new-build-system
, we can easily generate them within lines of code.