Skip to content

Commit

Permalink
Convert bashsessions lexer to XML
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Dec 11, 2022
1 parent aecedef commit 45e3bfb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion _tools/pygments2chroma_xml.py
Expand Up @@ -82,7 +82,7 @@ def resolve_emitter(emitter):
name = args.__name__
if name.endswith('Lexer'):
name = name[:-5]
emitter = '<using state="%s"/>' % state
emitter = '<using lexer="%s"/>' % state
else:
raise ValueError('only support "using" with lexer classes, not %r' % args)
else:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/go
2 changes: 1 addition & 1 deletion bin/gofmt
26 changes: 0 additions & 26 deletions lexers/bashsession.go

This file was deleted.

25 changes: 25 additions & 0 deletions lexers/embedded/bashsession.xml
@@ -0,0 +1,25 @@
<lexer>
<config>
<name>BashSession</name>
<alias>bash-session</alias>
<alias>console</alias>
<alias>shell-session</alias>
<filename>*.sh-session</filename>
<mime_type>text/x-sh</mime_type>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="root">
<rule pattern="^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)">
<bygroups>
<token type="GenericPrompt"/>
<token type="Text"/>
<using lexer="bash"/>
</bygroups>
</rule>
<rule pattern="^.+\n?">
<token type="GenericOutput"/>
</rule>
</state>
</rules>
</lexer>

0 comments on commit 45e3bfb

Please sign in to comment.