-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Scopes tokenizer: new implementation #5628
base: master
Are you sure you want to change the base?
Conversation
@@ -2,5 +2,5 @@ | |||
const textTokens = new Set(["text", "rparen", "lparen"]); | |||
|
|||
exports.isTextToken = function(tokenType) { | |||
return textTokens.has(tokenType); | |||
return textTokens.has(tokenType.toString()); |
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.
is this needed?
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.
Without it simple_tokenizer is not working as expected
@@ -13,7 +13,7 @@ oop.inherits(FoldMode, BaseFoldMode); | |||
|
|||
|
|||
this.$getMode = function(state) { | |||
if (typeof state != "string") | |||
if (Array.isArray(state)) | |||
state = state[0]; | |||
for (var key in this.subModes) { |
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.
Should we add .syntax property to Scope to make this simpler?
src/mode/lua_highlight_rules.js
Outdated
onMatch2 : function(value, scope){ | ||
var parent = scope.get("bracketedComment" + (value.length - 2)) | ||
parent.meta = (value.length - 2); | ||
return parent.get(this.next).get("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.
Should use scope.get(this.next, value.length - 2).get("comment")
;
@@ -99,12 +99,16 @@ TextHighlightRules = function() { | |||
}; | |||
|
|||
var pushState = function(currentState, stack) { | |||
if (currentState != "start" || stack.length) | |||
stack.unshift(this.nextState, currentState); | |||
if (typeof currentState.get == "function") { |
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.
Can we keep only the scope variant here?
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.
We would need to make significant changes in normalizeRules
logic in that case
# Conflicts: # src/mode/lua_highlight_rules.js
92db310
to
c6141fa
Compare
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Pull Request Checklist:
ace.d.ts
) and its references: