-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up edtf parser code (remove old test case comments)
- Loading branch information
Showing
2 changed files
with
3 additions
and
40 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
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,45 +1,8 @@ | ||
import os.path | ||
import pathlib | ||
|
||
from lark import Lark | ||
|
||
grammar_path = os.path.join(os.path.dirname(__file__), "edtf.lark") | ||
grammar_path = pathlib.Path(__file__).parent / "edtf.lark" | ||
|
||
with open(grammar_path) as grammar: | ||
edtf_parser = Lark(grammar.read(), start="edtf") | ||
|
||
|
||
# testcases = [ | ||
# "1984", | ||
# "1984-05", | ||
# "1984-12", | ||
# "1001-03-30", | ||
# "1000/2000", | ||
# "1000-01/2000-05-01", | ||
# # level 1 | ||
# "Y170000002", | ||
# "2001-21", # spring 2001 | ||
# # qualifiers | ||
# "1984?", | ||
# "2004-06~", | ||
# "2004-06-11%", | ||
# # unspecified digits from right | ||
# "201X", | ||
# "20XX", | ||
# "2004-XX", | ||
# "1985-04-XX", | ||
# "1985-XX-XX", | ||
# # open ended intervals | ||
# "1985-04-12/..", | ||
# "1985-04/..", | ||
# "../1985-04-12", | ||
# "/1985-04-12", | ||
# "1984-13", | ||
# ] | ||
|
||
# for testcase in testcases: | ||
# print(f"\n{testcase}") | ||
# tree = edtf_parser.parse(testcase) | ||
# print(tree.pretty()) | ||
|
||
|
||
# error_cases = ["1984-13", "Y1702"] |