-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor internal namespacing/module hierarchy to make more sense, be…
… easier to navigate
- Loading branch information
Showing
21 changed files
with
104 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
lib/parsers/dateformat/directive.ex → lib/format/datetime/directive.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
defmodule Timex.DateFormat.FormatError do | ||
defmodule Timex.Format.FormatError do | ||
@moduledoc """ | ||
Used for errors encountered during date formatting. | ||
""" | ||
alias Timex.DateFormat.FormatError | ||
alias Timex.Format.FormatError | ||
|
||
defexception message: "Invalid format!" | ||
|
||
def exception([message: message]) do | ||
%FormatError{message: message} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/parsers/dateformat/parser_state.ex → lib/parse/datetime/parser_state.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
defmodule Timex.Parsers.DateFormat.ParserState do | ||
defmodule Timex.Parse.DateTime.ParserState do | ||
@derive Access | ||
defstruct col: 0, # The current column number | ||
start_index: 0, # The last index of a starting token | ||
padding: 0, # The amount of padding for the current token | ||
pad_type: :zero, # The character to use for padding, :zero or :space | ||
token: "", # The current state of the parsed token | ||
tokens: [] # A keyword list of tokens | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
lib/parsers/dateformat/strftime.ex → lib/parse/datetime/parsers/strftime.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
defmodule Timex.Parsers.DateFormat.StrftimeParser do | ||
defmodule Timex.Parse.DateTime.Parsers.StrftimeParser do | ||
@moduledoc """ | ||
This module is responsible for parsing date strings using | ||
the strftime formatting syntax. | ||
See `Timex.DateFormat.Formatters.StrftimeFormatter` for more info. | ||
""" | ||
use Timex.Parsers.DateFormat.Parser | ||
use Timex.Parse.DateTime.Parser | ||
|
||
@doc """ | ||
The tokenizer used by this parser. | ||
""" | ||
defdelegate tokenize(format_string), to: Timex.Parsers.DateFormat.Tokenizers.Strftime | ||
defdelegate tokenize(format_string), to: Timex.Format.DateTime.Tokenizers.Strftime | ||
|
||
@doc """ | ||
Extracts the value for a given directive. | ||
""" | ||
defdelegate parse_directive(date_string, directive), to: Timex.Parsers.DateFormat.DefaultParser | ||
defdelegate parse_directive(date_string, directive), to: Timex.Parse.DateTime.Parsers.DefaultParser | ||
|
||
@doc """ | ||
Constructs a DateTime from the parsed tokens | ||
""" | ||
defdelegate apply_directives(tokens), to: Timex.Parsers.DateFormat.DefaultParser | ||
end | ||
defdelegate apply_directives(tokens), to: Timex.Parse.DateTime.Parsers.DefaultParser | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
defmodule Timex.Parsers.ParseError do | ||
defmodule Timex.Parse.ParseError do | ||
@moduledoc """ | ||
Used for errors encountered during date parsing. | ||
""" | ||
alias Timex.Parsers.ParseError | ||
alias Timex.Parse.ParseError | ||
|
||
defexception message: "Invalid input!" | ||
|
||
def exception(message) do | ||
%ParseError{message: message} | ||
end | ||
end | ||
end |
Oops, something went wrong.