-
Notifications
You must be signed in to change notification settings - Fork 1.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
Edited Python language: Added 'self' keyword and 'class-name' #677
Conversation
@@ -8,9 +8,16 @@ Prism.languages.python= { | |||
pattern: /((^|\s)def[ \t]+)([a-zA-Z_][a-zA-Z0-9_]*(?=\())/g, | |||
lookbehind: true | |||
}, | |||
'keyword' : /\b(as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/, | |||
'keyword' : /\b(as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|self|try|while|with|yield)\b/, |
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.
Upon further review, it appears that self
is not a keyword (which is likely why it wasn't there in the first place...). I will correct this and commit an updated version only including the class-name
.
@@ -14,3 +14,10 @@ Prism.languages.python= { | |||
'operator' : /[-+]|<=?|>=?|!|={1,2}|&{1,2}|\|?\||\?|\*|\/|@|~|\^|%|\b(or|and|not)\b/, | |||
'punctuation' : /[{}[\];(),.:]/ | |||
}; | |||
|
|||
Prism.languages.insertBefore('python', 'keyword', { |
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 don't see the need for the insertBefore()
here. The class-name
pattern could go directly into before the keyword
key in the object above.
Thanks for contributing! Please take a look at my comment. |
Fixed! |
Edited Python language: Added 'class-name'
Added 'self' as keyword and added 'class-name' matching to Python language.