Permalink
Browse files

Fix bug in previous commit: left_spid missing from DoubleQuotedPart.

Also: Re-enable translation errors in wild_report.py.

Parse errors and translation errors seem to match 0.6.pre2 now.  TODO:
do another run.
  • Loading branch information...
Andy Chu
Andy Chu committed Aug 25, 2018
1 parent 7a1947f commit 2bba5976557a4cb55aa94cfab367053a2eca512b
Showing with 20 additions and 15 deletions.
  1. +6 −1 osh/word_parse.py
  2. +12 −13 test/wild_report.py
  3. +2 −1 tools/osh2oil.py
View
@@ -638,11 +638,15 @@ def _ReadDoubleQuotedPart(self, eof_type=Id.Undefined_Tok, here_doc=False):
Also ${foo%%a b c} # treat this as double quoted. until you hit
"""
quoted_part = ast.DoubleQuotedPart()
left_spid = const.NO_INTEGER
left_spid = const.NO_INTEGER # gets set later
right_spid = const.NO_INTEGER # gets set later
if self.cur_token is not None: # None in here doc case
left_token = self.cur_token
left_spid = left_token.span_id
else:
left_token = None
done = False
while not done:
@@ -684,6 +688,7 @@ def _ReadDoubleQuotedPart(self, eof_type=Id.Undefined_Tok, here_doc=False):
if here_doc: # here docs will have an EOF in their token stream
done = True
else:
assert left_token is not None # See hacky condition above
p_die('Unexpected EOF reading double-quoted string that began here',
token=left_token)
View
@@ -233,11 +233,9 @@ def MakeHtmlGroup(title_str, body_str):
<td>
{.osh2oil_failed?}
<!-- <a class="fail" href="#stderr_osh2oil_{name}">FAIL</a> -->
FAIL
<a class="fail" href="#stderr_osh2oil_{name}">FAIL</a>
{.or}
<!-- <a class="ok" href="{name}__oil.txt">OK</a> -->
OK
<a class="ok" href="{name}__oil.txt">OK</a>
{.end}
</td>
<td class="name">
@@ -384,15 +382,16 @@ def UpdateNodes(node, path_parts, file_stats):
})
osh2oil_stderr = file_stats.pop('osh2oil_stderr')
# Concentrating on parsing failures for now.
#if osh2oil_stderr or file_stats['osh2oil_failed']:
# node.stderr.append({
# 'parsing': False,
# 'action': 'osh2oil',
# 'name': first,
# 'contents': osh2oil_stderr,
# })
# TODO: Could disable this with a flag to concentrate on parse errors.
# Or just show parse errors all in one file.
if 1:
if osh2oil_stderr or file_stats['osh2oil_failed']:
node.stderr.append({
'parsing': False,
'action': 'osh2oil',
'name': first,
'contents': osh2oil_stderr,
})
# Attach to this dir
node.files[first] = file_stats
View
@@ -928,8 +928,9 @@ def DoWordInCommand(self, node, local_symbols):
node.parts[0].tag == word_part_e.DoubleQuotedPart):
dq_part = node.parts[0]
# TODO: Double quoted part needs left and right IDs
left_spid, right_spid = dq_part.spids
# This is not set in the case of here docs? Why not?
#assert left_spid != const.NO_INTEGER, left_spid
assert right_spid != const.NO_INTEGER, right_spid
if len(dq_part.parts) == 1:

0 comments on commit 2bba597

Please sign in to comment.