Add IGNORECASE ability to Token Remapping.#1
Open
manux81 wants to merge 1 commit intobugengine:masterfrom
Open
Add IGNORECASE ability to Token Remapping.#1manux81 wants to merge 1 commit intobugengine:masterfrom
manux81 wants to merge 1 commit intobugengine:masterfrom
Conversation
With reference to: dabeaz#62 I've found a problem with tokens remapping in the eventuality of: reflags = re.IGNORECASE This change allows creating special cases ignoring capitalization in the eventuality of reflags = re.IGNORECASE assignment in Lexer class. Example: class MyLexer(sly.Lexer): reflags = re.IGNORECASE # Base ID rule ID = r'[a-zA-Z_][a-zA-Z0-9_]*' # Special cases ID['if'] = IF ID['else'] = ELSE ID['while'] = WHILE # Now if,If,IF,iF are handle as the same special cases
4f13918 to
ab00964
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
With reference to:
dabeaz#62
I've found a problem with tokens remapping in the eventuality of:
reflags = re.IGNORECASE
This change allows creating special cases ignoring capitalization in the eventuality of
reflags = re.IGNORECASE assignment in Lexer class.
Example:
class MyLexer(sly.Lexer):
reflags = re.IGNORECASE
# Base ID rule
ID = r'[a-zA-Z_][a-zA-Z0-9_]*'