Commit 8d307fb7 authored by Eckhart Arnold's avatar Eckhart Arnold

- weitere

parent a4ffb225
This diff is collapsed.
...@@ -261,6 +261,8 @@ class Node(collections.abc.Sized): ...@@ -261,6 +261,8 @@ class Node(collections.abc.Sized):
# assert ((isinstance(result, tuple) and all(isinstance(child, Node) for child in result)) # assert ((isinstance(result, tuple) and all(isinstance(child, Node) for child in result))
# or isinstance(result, Node) # or isinstance(result, Node)
# or isinstance(result, str)), str(result) # or isinstance(result, str)), str(result)
# Possible optimization: Do not allow single nodes as argument:
# assert not isinstance(result, Node)
self._result = (result,) if isinstance(result, Node) else str(result) \ self._result = (result,) if isinstance(result, Node) else str(result) \
if isinstance(result, StringView) else result or '' # type: StrictResultType if isinstance(result, StringView) else result or '' # type: StrictResultType
self.children = cast(ChildrenType, self._result) \ self.children = cast(ChildrenType, self._result) \
......
...@@ -299,7 +299,7 @@ def error_messages(source_text, errors) -> List[str]: ...@@ -299,7 +299,7 @@ def error_messages(source_text, errors) -> List[str]:
def escape_re(s) -> str: def escape_re(s) -> str:
"""Returns `s` with all regular expression special characters escaped. """Returns `s` with all regular expression special characters escaped.
""" """
assert isinstance(s, str) # assert isinstance(s, str)
re_chars = r"\.^$*+?{}[]()#<>=|!" re_chars = r"\.^$*+?{}[]()#<>=|!"
for esc_ch in re_chars: for esc_ch in re_chars:
s = s.replace(esc_ch, '\\' + esc_ch) s = s.replace(esc_ch, '\\' + esc_ch)
......
#!/bin/sh #!/bin/sh
python3 setup.py sdist bdist python3 setup.py sdist bdist_wheel
[match:content]
simple : {Edward N. Zalta}
nested_braces : {\url{https://plato.stanford.edu/archives/fall2013/entries/thomas-kuhn/}}
...@@ -74,6 +74,7 @@ tabular_row = (multicolumn | tabular_cell) { "&" (multicolumn | tabular_ ...@@ -74,6 +74,7 @@ tabular_row = (multicolumn | tabular_cell) { "&" (multicolumn | tabular_
tabular_cell = { line_element //~ } tabular_cell = { line_element //~ }
tabular_config = "{" /[lcr|]+/~ §"}" tabular_config = "{" /[lcr|]+/~ §"}"
#### paragraphs and sequences of paragraphs #### #### paragraphs and sequences of paragraphs ####
block_of_paragraphs = "{" [sequence] §"}" block_of_paragraphs = "{" [sequence] §"}"
...@@ -82,6 +83,7 @@ paragraph = { !blockcmd text_element //~ }+ ...@@ -82,6 +83,7 @@ paragraph = { !blockcmd text_element //~ }+
text_element = line_element | LINEFEED text_element = line_element | LINEFEED
line_element = text | block | inline_environment | command line_element = text | block | inline_environment | command
#### inline enivronments #### #### inline enivronments ####
inline_environment = known_inline_env | generic_inline_env inline_environment = known_inline_env | generic_inline_env
...@@ -95,6 +97,7 @@ end_environment = /\\end{/ §::NAME §/}/ ...@@ -95,6 +97,7 @@ end_environment = /\\end{/ §::NAME §/}/
inline_math = /\$/ /[^$]*/ §/\$/ inline_math = /\$/ /[^$]*/ §/\$/
#### commands #### #### commands ####
command = known_command | text_command | generic_command command = known_command | text_command | generic_command
......
...@@ -123,6 +123,7 @@ class LaTeXGrammar(Grammar): ...@@ -123,6 +123,7 @@ class LaTeXGrammar(Grammar):
tabular_cell = { line_element //~ } tabular_cell = { line_element //~ }
tabular_config = "{" /[lcr|]+/~ §"}" tabular_config = "{" /[lcr|]+/~ §"}"
#### paragraphs and sequences of paragraphs #### #### paragraphs and sequences of paragraphs ####
block_of_paragraphs = "{" [sequence] §"}" block_of_paragraphs = "{" [sequence] §"}"
...@@ -131,6 +132,7 @@ class LaTeXGrammar(Grammar): ...@@ -131,6 +132,7 @@ class LaTeXGrammar(Grammar):
text_element = line_element | LINEFEED text_element = line_element | LINEFEED
line_element = text | block | inline_environment | command line_element = text | block | inline_environment | command
#### inline enivronments #### #### inline enivronments ####
inline_environment = known_inline_env | generic_inline_env inline_environment = known_inline_env | generic_inline_env
...@@ -144,6 +146,7 @@ class LaTeXGrammar(Grammar): ...@@ -144,6 +146,7 @@ class LaTeXGrammar(Grammar):
inline_math = /\$/ /[^$]*/ §/\$/ inline_math = /\$/ /[^$]*/ §/\$/
#### commands #### #### commands ####
command = known_command | text_command | generic_command command = known_command | text_command | generic_command
...@@ -220,7 +223,7 @@ class LaTeXGrammar(Grammar): ...@@ -220,7 +223,7 @@ class LaTeXGrammar(Grammar):
paragraph = Forward() paragraph = Forward()
tabular_config = Forward() tabular_config = Forward()
text_element = Forward() text_element = Forward()
source_hash__ = "ed181ac517b686f843e13d5783527fe3" source_hash__ = "57dd004091e87ff603b51f0a47857cf4"
parser_initialization__ = "upon instantiation" parser_initialization__ = "upon instantiation"
COMMENT__ = r'%.*' COMMENT__ = r'%.*'
WHITESPACE__ = r'[ \t]*(?:\n(?![ \t]*\n)[ \t]*)?' WHITESPACE__ = r'[ \t]*(?:\n(?![ \t]*\n)[ \t]*)?'
......
...@@ -12,8 +12,11 @@ ...@@ -12,8 +12,11 @@
4 : Paragraphs % may contain comments 4 : Paragraphs % may contain comments
like the comment above like the comment above
% or like this comment. % or like thist comment.
Comment lines do not break paragraphs. Comment lines do not break paragraphs.
% There can even be several
% comment lines
in sequence.
5 : Paragraphs may contain {\em emphasized} or {\bf bold} text. 5 : Paragraphs may contain {\em emphasized} or {\bf bold} text.
Most of these commands can have different forms as, for example: Most of these commands can have different forms as, for example:
...@@ -67,6 +70,7 @@ ...@@ -67,6 +70,7 @@
% and comments % and comments
% or sequences of comment lines
In the end such a sequence counts In the end such a sequence counts
......
[bdist] [bdist_wheel]
universal=1
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