Skip to content

Commit

Permalink
fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Aluriak committed Nov 15, 2019
1 parent 5128f8c commit fe41075
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clyngor/answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def naive_parsing_of_answer_set(answer_set:str, *, discard_quotes:bool=False, pa
"""Yield (pred, args), naively parsed from given answer set encoded as clingo output string.
Some atoms may be missing. Some others may be poorly parsed."""
# print('NAIVE_PARSING_OF_ANSWER_SET:', answer_set, f'\t discard_quotes={discard_quotes}, parse_int={parse_int}, parse_args={parse_args}')
REG_ANSWER_SET = re.compile(r'([a-z][a-zA-Z0-9_]*|[0-9]+|"[^"]*")(\([^)]+\))?')
REG_ANSWER_SET = re.compile(r'([a-z_][a-zA-Z0-9_]*|[0-9]+|"[^"]*")(\([^)]+\))?')

for match in REG_ANSWER_SET.finditer(answer_set):
pred, args = match.groups()
Expand Down
2 changes: 1 addition & 1 deletion clyngor/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def visit_terms(self, node, children):

@staticmethod
def grammar():
def ident(): return ap.RegExMatch(r'[a-z][a-zA-Z0-9_]*')
def ident(): return ap.RegExMatch(r'[a-z_][a-zA-Z0-9_]*')
def number(): return ap.RegExMatch(r'-?[0-9]+')
def text(): return '"', ap.RegExMatch(r'((\\")|([^"]))*'), '"'
def litteral(): return [text, number]
Expand Down

0 comments on commit fe41075

Please sign in to comment.