-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
potential fix for issue#4134 #4136
base: main
Are you sure you want to change the base?
Changes from all commits
1a545fa
168c421
29b7c24
cab894b
e510344
428e5f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,30 @@ export default function(hljs) { | |
/^\s*@?rem\b/, /$/, | ||
{ relevance: 10 } | ||
); | ||
|
||
// for matching comments starting with :: | ||
const COMMENT_2 = hljs.COMMENT( | ||
/^::.*$/, /$/, | ||
{ relevance: 10 } | ||
); | ||
const LABEL = { | ||
className: 'symbol', | ||
begin: '^\\s*[A-Za-z._?][A-Za-z0-9_$#@~.?]*(:|\\s+label)', | ||
begin: '^:[A-Za-z._?][A-Za-z0-9_$#@~.?]*', | ||
relevance: 0 | ||
}; | ||
|
||
const DISK_CHANGE = { | ||
className: 'symbol', | ||
begin: '^[A-Za-z]:\\?$', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be a literal regex, not a string. |
||
relevance: 0 | ||
}; | ||
|
||
const OUTPUT_REDIRECT = { | ||
className: 'symbol', | ||
begin: '[1-2]?[>]>{1}\s*[^&\s]+', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a markup test or two for this so I can understand what exactly you're trying to match. This looks a bit overly complex to me, but maybe I don't understand the goal. |
||
relevance: 0 | ||
}; | ||
|
||
const KEYWORDS = [ | ||
"if", | ||
"else", | ||
|
@@ -141,25 +160,39 @@ export default function(hljs) { | |
built_in: BUILT_INS | ||
}, | ||
contains: [ | ||
COMMENT, | ||
COMMENT_2, | ||
{ | ||
className: 'variable', | ||
begin: /%%[^ ]|%[^ ]+?%|![^ ]+?!/ | ||
}, | ||
{ | ||
className: 'function', | ||
begin: LABEL.begin, | ||
end: 'goto:eof', | ||
end: /\n/, | ||
contains: [ | ||
hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }), | ||
COMMENT | ||
COMMENT, | ||
COMMENT_2 | ||
] | ||
}, | ||
{ | ||
className: 'function', | ||
begin: DISK_CHANGE.begin, | ||
end: /\n/, | ||
contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }) ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please explain what this is attempting to do. Are you trying to highlight all path names? |
||
}, | ||
{ | ||
className: 'function', | ||
begin: OUTPUT_REDIRECT.begin, | ||
end: /\n/, | ||
contains: [ hljs.inherit(hljs.TITLE_MODE, { begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' }) ] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question, is this another attempt to highlight pathname? |
||
}, | ||
{ | ||
className: 'number', | ||
begin: '\\b\\d+', | ||
relevance: 0 | ||
}, | ||
COMMENT | ||
] | ||
}; | ||
} |
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 begin should start and the end should end, so I think you want:
start:
/^::/
end :
/$/
The end shouldn't be included in the begin.