Merge pull request #5 from idle-org/features/reguekes

Features/reguekes
This commit is contained in:
Vicky 2022-06-13 19:24:23 +02:00 committed by GitHub
commit a2ae3c5d0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 10 deletions

View File

@ -33,7 +33,7 @@ You can refer to the `example_userfiles` for an idea of what the parser expects
### V1.2 ### V1.2
- Check error messages and add a real debug level to parameters ☐ - Check error messages and add a real debug level to parameters ☐
- Functioning `blockquote` Token ☐ - Functioning `blockquote` Token ☐
- Remove old regex usage ☐ - Remove old regex usage ☑
### V1.3 ### V1.3
- Add advanced lookahead logic for `*` ☐ - Add advanced lookahead logic for `*` ☐

View File

@ -1,7 +1,5 @@
pyyaml==6.0 pyyaml==6.0
rich==12.0.1 rich==12.0.1
regex==2022.3.15
pyparse~=1.1.7 pyparse~=1.1.7
pyparsing[diagrams]~=3.0.7 pyparsing[diagrams]~=3.0.7
pytest==7.1.1 pytest==7.1.1

View File

@ -9,7 +9,6 @@
import os import os
import regex # future: remove regex
from io import StringIO from io import StringIO
from bootstraparse.modules import pathresolver as pr from bootstraparse.modules import pathresolver as pr
@ -179,10 +178,10 @@ class PreParser:
line_count = 0 line_count = 0
for line in self.readlines(): for line in self.readlines():
results = regex.match(_rgx_import_file, line) results = _rgx_import_file.searchString(line)
if results: if results:
for e in results.captures('file_name'): for e in results[0]:
import_list += [(e, line_count)] import_list += [(e.rstrip(), line_count)]
line_count += 1 line_count += 1
# converts relative paths to absolute and returns a table # converts relative paths to absolute and returns a table
self.saved_import_list = [(self.relative_path_resolver(p), l) for p, l in import_list] self.saved_import_list = [(self.relative_path_resolver(p), l) for p, l in import_list]

View File

@ -16,7 +16,6 @@ from collections import namedtuple
from bootstraparse.modules.error_mngr import MismatchedContainerError from bootstraparse.modules.error_mngr import MismatchedContainerError
from bootstraparse.modules import context_mngr as cm from bootstraparse.modules import context_mngr as cm
import pyparsing as pp import pyparsing as pp
import regex # future: remove regex
pps = pp.Suppress pps = pp.Suppress
@ -434,8 +433,7 @@ def readable_markup(list_of_tokens):
# Pre-parser expressions # Pre-parser expressions
rgx_import_file = regex.compile(r'::( ?\< ?(?P<file_name>[\w\-._/]+) ?\>[ \s]*)+') rgx_import_file = pps("::") + pp.OneOrMore(pps("<") + pp.SkipTo(">").set_name("file_name")("file_name") + pps(">"))
# Base elements # Base elements
quotes = pp.Word(r""""'""") quotes = pp.Word(r""""'""")