Skip to content

Commit

Permalink
Reduce regex of operators to just one regex
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamtigers authored and masatake committed Mar 7, 2019
1 parent 9b5fc37 commit 3afce0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 1 addition & 3 deletions optlib/elixir.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ extern parserDefinition* ElixirParser (void)
"i", NULL, NULL, false},
{"^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)(.[^\\|\\^/&<>~.=!*+-]+)", "\\2",
"a", NULL, NULL, false},
{"^[ \t]*def(p?)[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\\|\\^/&<>~.=!*+-]{1,3})[ \t]+[a-zA-Z0-9_!?!]", "\\3",
"o", NULL, NULL, false},
{"^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\\|\\^/&<>~.=!*+-]{1,3})[ \t]+[a-zA-Z0-9_!?!]", "\\3",
{"^[ \t]*def((p?)|macro(p?))[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\\|\\^/&<>~.=!*+-]{1,3})[ \t]+[a-zA-Z0-9_!?!]", "\\5",
"o", NULL, NULL, false},
{"^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\\.)*([A-Z][a-zA-Z0-9_?!]*)", "\\2",
"m", NULL, NULL, false},
Expand Down
6 changes: 1 addition & 5 deletions optlib/elixir.ctags
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@
--regex-Elixir=/^[ \t]*defguard(p?)[ \t]+(is_[a-zA-Z0-9_?!]+)/\2/g/
--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i/
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)(.[^\|\^\/&<>~.=!*+-]+)/\2/a/

# These are the operators (which can be defined with def(p) and defmacro(p))
--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\|\^\/&<>~.=!*+-]{1,3})[ \t]+[a-zA-Z0-9_!?!]/\3/o/
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\|\^\/&<>~.=!*+-]{1,3})[ \t]+[a-zA-Z0-9_!?!]/\3/o/

--regex-Elixir=/^[ \t]*def((p?)|macro(p?))[ \t]+([a-zA-Z0-9_?!]+)[ \t]+([\|\^\/&<>~.=!*+-]{1,3})[ \t]+[a-zA-Z0-9_!?!]/\5/o/
--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m/
--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p/
--regex-Elixir=/^[ \t]*Record\.defrecord(p?)[ \t(]+:([a-zA-Z0-9_]+)(\)?)/\2/r/
Expand Down

0 comments on commit 3afce0e

Please sign in to comment.