cannot used custom installed lexer
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 885
- PR merge metrics
- No merged PRs in 30d
Description
(Original issue 1468 created by lior_samuel on 2018-08-17T16:15:29.112642+00:00)
I created a simple lexer called domsaLex, and created a setup script to plug it into pygments.
the script runs without issues, and when I run
#!bash
pygmentize -L lexers
I can see my lexer in the list, but when I actually try to use it via
#!bash
pygmentize -l domsaLex
all I get is: Error: no lexer for alias 'domsaLex' found
below are my setup script and lexer class:
#!python
setup(
name="domsagxo",
packages=find_packages(),
entry_points="""
[pygments.lexers]
domsaLex = syntax_high_light.pygment_lexer:domsaLex
[pygments.styles]
domsagxoStyle = syntax_high_light.pygment_style:DomsagxoStyle
"""
)
# in syntax_high_light/pygment_lexer.py
class domsaLex(RegexLexer):
"""All your lexer code goes here!"""
name = "Domsagxo Keyword Lexer"
aliases = ['domsaLex']
filenames = ['*.domsa']
tokens = {
'root': [
# some definitions...
]
}
I am using the ubuntu subunit on windows 10.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the setup script's [pygments.lexers] entry point and syntax_high_light/pygment_lexer.py, then reproduce the reported behavior with pygmentize -L lexers and pygmentize -l domsaLex. Check why the installed lexer is listed but its alias is not resolved. Done means the custom domsaLex lexer can be selected successfully by alias.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100