11.3.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit e3f28126 authored by di68kap's avatar di68kap

- dhparser.py, dsl.py: bug fixes related to utf-8 encoding

parent 25aac7be
......@@ -80,7 +80,7 @@ from functools import partial
import os
import sys
sys.path.append('{dhparserdir}')
sys.path.append(r'{dhparserdir}')
try:
import regex as re
......@@ -315,7 +315,8 @@ def load_compiler_suite(compiler_suite: str) -> \
and returns it as a tuple (preprocessor, parser, ast, compiler).
Returns:
4-tuple (preprocessor function, parser class, ast transformer function, compiler class)
4-tuple (preprocessor function, parser class,
ast transformer function, compiler class)
"""
global RX_SECTION_MARKER
assert isinstance(compiler_suite, str)
......
......@@ -1885,5 +1885,3 @@ class Forward(Parser):
return True
return False
......@@ -110,6 +110,7 @@ class StringView(collections.abc.Sized):
return self.len
def __str__(self):
# PERFORMANCE WARNING: This creates a copy of the string-slice
if self.fullstring_flag: # optimization: avoid slicing/copying
return self.text
# since the slice is being copyied now, anyway, the copy might
......
......@@ -116,7 +116,7 @@ GRAMMAR_TEST_TEMPLATE = r'''#!/usr/bin/python3
import os
import sys
sys.path.append('{dhparserdir}')
sys.path.append(r'{dhparserdir}')
scriptpath = os.path.dirname(__file__)
......@@ -176,7 +176,7 @@ def create_project(path: str):
"""Create a file with `name` and write `content` to file."""
if not os.path.exists(name):
print('Creating file "%s".' % name)
with open(name, 'w') as f:
with open(name, 'w', encoding='utf-8') as f:
f.write(content)
else:
print('"%s" already exists! Not overwritten.' % name)
......
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