Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add more syntaxes to language Julia #16
Add more syntaxes to language Julia #16
Changes from all commits
aa46bde
d42b527
5f3ab57
ce3d7f9
ed99e87
2ae6d94
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@singularitti Also, if non-generator-like
for
requiresdo
or another token, you could change this to:This should now only match expressions like:
for ... do
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.
Hi, I am trying to use this pattern
"^\s*for"
(Afor
with only blank characters before it) to replace"for"
, but it does not seem to succeed. The below generator expressionis still treated as a
for
loop.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.
As an example, I only want the first
for
be matched.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'm not familiar with Julia. Why the
for
preceeded by @SoftScope shouldn't be matched? This might bring problems with the matchingend
for it.Check if this token works well enough for
for
:(?<=\\[[^\\]]*)for(?![^\\]]*\\]))
It uses negative lookahead and positive lookbehind to try and match those generators.
I don't know if it can handle nested or multiline generators.
Another option is adding
[
and]
as open and close tokens for an ignore block. This is not ideal, but would avoid ugly breakage for the rest of the fileThere 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.
Hi @polvalente, thank you for your reply. I am not an expert in regex, so I just wrote the simplest example. Yes, indeed, that will break the highlighting.
I cannot figure out a good regex to distinguish the
for
loops and generator expressions. Because Julia is so flexible that it allows a lot of ways to write afor
loop. The only difference between them just seems to befor
loops have anend
. I will list some test examples below. I hope you can figure out a working way to distinguish them. Thank you!Below are normal
for
loops so should be paired withend
s.Below are generator expressions and are not paired with
end
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.
Oh wow. I think there is a problem with how I implemented ignore blocks. I'll refactor it in the coming weekend.
Basically, I didn't think to support nesting. As such,
((x) for)
will be passed to the coloring function asfor)
(because the first closing paren will close the first open paren).Luckily, I already have an idea on how to solve it (by using stacks).
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.
#18
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.
Nevermind the weekend: #19
HAHA
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.
Cool! Cannot wait to have a try!
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 test now works: