zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

shell_lexer.ex (825B)


      1 defmodule ExDoc.ShellLexer do
      2   # Makeup lexer for sh, bash, etc commands.
      3   # The only thing it does is making the `$ ` prompt not selectable.
      4   @moduledoc false
      5 
      6   @behaviour Makeup.Lexer
      7 
      8   @impl true
      9   def lex(text, _opts) do
     10     text
     11     |> String.split("\n")
     12     |> Enum.flat_map(fn
     13       "$ " <> rest ->
     14         [
     15           {:generic_prompt, %{selectable: false}, "$ "},
     16           {:text, %{}, rest <> "\n"}
     17         ]
     18 
     19       text ->
     20         [{:text, %{}, text <> "\n"}]
     21     end)
     22   end
     23 
     24   @impl true
     25   def match_groups(_arg0, _arg1) do
     26     raise "not implemented yet"
     27   end
     28 
     29   @impl true
     30   def postprocess(_arg0, _arg1) do
     31     raise "not implemented yet"
     32   end
     33 
     34   @impl true
     35   def root(_arg0) do
     36     raise "not implemented yet"
     37   end
     38 
     39   @impl true
     40   def root_element(_arg0) do
     41     raise "not implemented yet"
     42   end
     43 end