Skip to content
This repository was archived by the owner on Dec 21, 2025. It is now read-only.
This repository was archived by the owner on Dec 21, 2025. It is now read-only.

ignore case sensitivity #62

@ker2x

Description

@ker2x

I'm trying to have my language case insensitive.

I'm doing this :

class FortyLexer(Lexer):
    """Main Lexer Class for FortyFor"""
    Lexer.reflags = Lexer.regex_module.IGNORECASE

    tokens = {
        ID, NUMBER, PLUS, MINUS, TIMES, DIVIDE, ASSIGN, LPAR, RPAR,
        IF, ELSE
    }

    ignore = ' \t'
    ignore_comment = r'\!.*'
    ignore_newline = r'\n+'

    ID      = r'[a-zA-Z_][a-zA-Z0-9_]*'
    ID[r'if'] = IF
    ID[r'else'] = ELSE
...

"else" is recognized as an ELSE token, but "ELSE" is still recognized as an "ID".
Am i doing it wrong ?

i also tried with " Lexer.reflags = Lexer.regex_module.RegexFlag.IGNORECASE"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions