Commit 99e401cc authored by eckhart's avatar eckhart

- test_dhparser.py: bugfix

parent c4a9089a
...@@ -59,7 +59,7 @@ class ArithmeticGrammar(Grammar): ...@@ -59,7 +59,7 @@ class ArithmeticGrammar(Grammar):
r"""Parser for an Arithmetic source file. r"""Parser for an Arithmetic source file.
""" """
expression = Forward() expression = Forward()
source_hash__ = "20c6ec451784ce19bed29a4f141c4363" source_hash__ = "b75119067b29e37cd0bfe66facbcad22"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -63,7 +63,7 @@ class ArithmeticRightRecursiveGrammar(Grammar): ...@@ -63,7 +63,7 @@ class ArithmeticRightRecursiveGrammar(Grammar):
sign = Forward() sign = Forward()
tail = Forward() tail = Forward()
term = Forward() term = Forward()
source_hash__ = "f1bf4bfc9852f779d0ffe210c1ccf0db" source_hash__ = "0c78c1f796133256eba3d3784356105a"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -60,7 +60,7 @@ class ArithmeticRightRecursiveGrammar(Grammar): ...@@ -60,7 +60,7 @@ class ArithmeticRightRecursiveGrammar(Grammar):
""" """
expression = Forward() expression = Forward()
term = Forward() term = Forward()
source_hash__ = "efea40aaf7475d6c8cbddd969e2d6b5b" source_hash__ = "d98f130442f0561e9217728aceb8eec3"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -59,7 +59,7 @@ class ArithmeticSimpleGrammar(Grammar): ...@@ -59,7 +59,7 @@ class ArithmeticSimpleGrammar(Grammar):
r"""Parser for an ArithmeticSimple source file. r"""Parser for an ArithmeticSimple source file.
""" """
expression = Forward() expression = Forward()
source_hash__ = "8f63d4fd3488afa0551c18f5d7d8fc19" source_hash__ = "e255247d005cd6cb213068881d76ffb4"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -57,7 +57,7 @@ class BibTeXGrammar(Grammar): ...@@ -57,7 +57,7 @@ class BibTeXGrammar(Grammar):
r"""Parser for a BibTeX source file. r"""Parser for a BibTeX source file.
""" """
text = Forward() text = Forward()
source_hash__ = "090e7cf86e9f66967d5f94a9d1c1d99e" source_hash__ = "8839d079e31b568a31f0ea4cbb175aa8"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -11,13 +11,7 @@ Match-test "simple" ...@@ -11,13 +11,7 @@ Match-test "simple"
{Edward N. Zalta} {Edward N. Zalta}
### AST ### AST
<content> (content (:Token "{") (text (CONTENT_STRING "Edward N. Zalta")) (:Token "}"))
<:Token>{</:Token>
<text>
<CONTENT_STRING>Edward N. Zalta</CONTENT_STRING>
</text>
<:Token>}</:Token>
</content>
Match-test "nested_braces" Match-test "nested_braces"
-------------------------- --------------------------
...@@ -26,18 +20,21 @@ Match-test "nested_braces" ...@@ -26,18 +20,21 @@ Match-test "nested_braces"
{\url{https://plato.stanford.edu/archives/fall2013/entries/thomas-kuhn/}} {\url{https://plato.stanford.edu/archives/fall2013/entries/thomas-kuhn/}}
### AST ### AST
<content> content
<:Token>{</:Token> :Token
<text> "{"
<CONTENT_STRING>\url</CONTENT_STRING> text
<:Token>{</:Token> CONTENT_STRING
<text> "\url"
<CONTENT_STRING>https://plato.stanford.edu/archives/fall2013/entries/thomas-kuhn/</CONTENT_STRING> :Token
</text> "{"
<:Token>}</:Token> text
</text> CONTENT_STRING
<:Token>}</:Token> "https://plato.stanford.edu/archives/fall2013/entries/thomas-kuhn/"
</content> :Token
"}"
:Token
"}"
Test of parser: "entry" Test of parser: "entry"
...@@ -77,121 +74,135 @@ Match test "entry" for parser "entry" failed: ...@@ -77,121 +74,135 @@ Match test "entry" for parser "entry" failed:
### AST ### AST
<ZOMBIE__> ZOMBIE__
<entry> entry
<:RegExp>@</:RegExp> :RegExp
<type> "@"
<WORD>Online</WORD> type
</type> WORD
<:Token>{</:Token> "Online"
<key> :Token
<NO_BLANK_STRING>wikipedia-duhem-quine</NO_BLANK_STRING> "{"
</key> key
<:Token>,</:Token> NO_BLANK_STRING
<:Whitespace> "wikipedia-duhem-quine"
:Token
","
</:Whitespace> :Whitespace
<field> ""
<WORD> " "
<:RegExp>editor</:RegExp> field
<:Whitespace> </:Whitespace> WORD
</WORD> :RegExp
</field> "editor"
<:Token>=</:Token> :Whitespace
<:Whitespace> </:Whitespace> " "
<content> :Token
<:Token>{</:Token> "="
<text> :Whitespace
<CONTENT_STRING>Wikipedia</CONTENT_STRING> " "
</text> content
<:Token>}</:Token> :Token
</content> "{"
<:Token>,</:Token> text
<:Whitespace> CONTENT_STRING
"Wikipedia"
:Token
</:Whitespace> "}"
<field> :Token
<WORD> ","
<:RegExp>title</:RegExp> :Whitespace
<:Whitespace> </:Whitespace> ""
</WORD> " "
</field> field
<:Token>=</:Token> WORD
<:Whitespace> </:Whitespace> :RegExp
<content> "title"
<:Token>{</:Token> :Whitespace
<text> " "
<CONTENT_STRING>Duhem-Quine thesis</CONTENT_STRING> :Token
</text> "="
<:Token>}</:Token> :Whitespace
</content> " "
<:Token>,</:Token> content
<:Whitespace> :Token
"{"
text
</:Whitespace> CONTENT_STRING
<field> "Duhem-Quine thesis"
<WORD> :Token
<:RegExp>year</:RegExp> "}"
<:Whitespace> </:Whitespace> :Token
</WORD> ","
</field> :Whitespace
<:Token>=</:Token> ""
<:Whitespace> </:Whitespace> " "
<content> field
<:Token>{</:Token> WORD
<text> :RegExp
<CONTENT_STRING>2017</CONTENT_STRING> "year"
</text> :Whitespace
<:Token>}</:Token> " "
</content> :Token
<:Token>,</:Token> "="
<:Whitespace> :Whitespace
" "
content
</:Whitespace> :Token
<field> "{"
<WORD> text
<:RegExp>date</:RegExp> CONTENT_STRING
<:Whitespace> </:Whitespace> "2017"
</WORD> :Token
</field> "}"
<:Token>=</:Token> :Token
<:Whitespace> </:Whitespace> ","
<content> :Whitespace
<:Token>{</:Token> ""
<text> " "
<CONTENT_STRING>2017-08-19</CONTENT_STRING> field
</text> WORD
<:Token>}</:Token> :RegExp
</content> "date"
<:Token>,</:Token> :Whitespace
<:Whitespace> " "
:Token
"="
</:Whitespace> :Whitespace
<field> " "
<WORD> content
<:RegExp>url</:RegExp> :Token
<:Whitespace> </:Whitespace> "{"
</WORD> text
</field> CONTENT_STRING
<:Token>=</:Token> "2017-08-19"
<:Whitespace> </:Whitespace> :Token
<plain_content> "}"
<COMMA_TERMINATED_STRING>{https://en.wikipedia.org/w/index.php?title=Duhem\</COMMA_TERMINATED_STRING> :Token
</plain_content> ","
<ZOMBIE__>%</ZOMBIE__> :Whitespace
</entry> ""
<ZOMBIE__> " "
E2\%80\%93Quine\_thesis\&amp;oldid=772834991}, field
WORD
</ZOMBIE__> :RegExp
<ZOMBIE__> "url"
organization = {Wikipedia} :Whitespace
" "
</ZOMBIE__> :Token
<ZOMBIE__>}</ZOMBIE__> "="
</ZOMBIE__> :Whitespace
\ No newline at end of file " "
plain_content
COMMA_TERMINATED_STRING
"{https://en.wikipedia.org/w/index.php?title=Duhem\"
ZOMBIE__ `(err "'}' ~ expected, »%E2\%80\%9...« found!"
"%"
ZOMBIE__
"E2\%80\%93Quine\_thesis\&oldid=772834991},"
""
ZOMBIE__
" organization = {Wikipedia}"
""
ZOMBIE__
"}"
\ No newline at end of file
...@@ -59,7 +59,7 @@ class EBNFGrammar(Grammar): ...@@ -59,7 +59,7 @@ class EBNFGrammar(Grammar):
r"""Parser for an EBNF source file. r"""Parser for an EBNF source file.
""" """
expression = Forward() expression = Forward()
source_hash__ = "9a341fad79f7e8eb46f1a657b553bec7" source_hash__ = "be91994c910201cdf0bd2da656c7cc01"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -57,7 +57,7 @@ class LaTeXGrammar(Grammar): ...@@ -57,7 +57,7 @@ class LaTeXGrammar(Grammar):
paragraph = Forward() paragraph = Forward()
tabular_config = Forward() tabular_config = Forward()
text_element = Forward() text_element = Forward()
source_hash__ = "8ec9110209a992e0cf91b283b220fa83" source_hash__ = "4e6ab6dede977be94d488bcc9990a5bb"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -58,7 +58,7 @@ def get_preprocessor() -> PreprocessorFunc: ...@@ -58,7 +58,7 @@ def get_preprocessor() -> PreprocessorFunc:
class LyrikGrammar(Grammar): class LyrikGrammar(Grammar):
r"""Parser for a Lyrik source file. r"""Parser for a Lyrik source file.
""" """
source_hash__ = "482df1ca1ff6088c06029775578eceed" source_hash__ = "06c4d5d864de1ee662251e1e50dbafa0"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -58,7 +58,7 @@ def get_preprocessor() -> PreprocessorFunc: ...@@ -58,7 +58,7 @@ def get_preprocessor() -> PreprocessorFunc:
class Lyrik_explicit_whitespaceGrammar(Grammar): class Lyrik_explicit_whitespaceGrammar(Grammar):
r"""Parser for a Lyrik_explicit_whitespace source file. r"""Parser for a Lyrik_explicit_whitespace source file.
""" """
source_hash__ = "5c2c8a19e31d7d731fac4a0187b44b32" source_hash__ = "10fbc58b65d0fd5a178572b3776456f0"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -66,7 +66,7 @@ class XMLGrammar(Grammar): ...@@ -66,7 +66,7 @@ class XMLGrammar(Grammar):
extSubsetDecl = Forward() extSubsetDecl = Forward()
ignoreSectContents = Forward() ignoreSectContents = Forward()
markupdecl = Forward() markupdecl = Forward()
source_hash__ = "6e104ce4a07a419fcafcfdf04f27a042" source_hash__ = "fabca55375f62d0a2f009cdfd76f0f77"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -60,7 +60,7 @@ class XMLSnippetGrammar(Grammar): ...@@ -60,7 +60,7 @@ class XMLSnippetGrammar(Grammar):
""" """
Name = Forward() Name = Forward()
element = Forward() element = Forward()
source_hash__ = "3cc68a13c706e7c74498f5ef6d49a715" source_hash__ = "54cd2aa8a44307a7c802ab2014a483eb"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -62,7 +62,7 @@ class jsonGrammar(Grammar): ...@@ -62,7 +62,7 @@ class jsonGrammar(Grammar):
""" """
element = Forward() element = Forward()
value = Forward() value = Forward()
source_hash__ = "abc885159d84633d94e82c75709c9684" source_hash__ = "ef3108350d5f28b0f32716ad3952316d"
static_analysis_pending__ = [True] static_analysis_pending__ = [True]
parser_initialization__ = ["upon instantiation"] parser_initialization__ = ["upon instantiation"]
resume_rules__ = {} resume_rules__ = {}
......
...@@ -31,7 +31,8 @@ sys.path.extend(['../', './']) ...@@ -31,7 +31,8 @@ sys.path.extend(['../', './'])
scriptdir = os.path.dirname(os.path.realpath(__file__)) scriptdir = os.path.dirname(os.path.realpath(__file__))
def system(s: str) -> int: def system(s: str) -> int:
return subprocess.call(s.split(' '), shell=True) # return os.system(s)
return subprocess.call(s, shell=True)
class TestDHParserCommandLineTool: class TestDHParserCommandLineTool:
def setup(self): def setup(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment