Permalink
Browse files

Add explicit span IDs when creating ast.token().

The new generated ASDL code let us omit any constructor argument, and
then it would be None.  That should be fixed.
  • Loading branch information...
Andy Chu
Andy Chu committed Dec 22, 2017
1 parent 887fbef commit 823c11c5a3eb8571d22b142a50e7ee55d494ef26
Showing with 8 additions and 6 deletions.
  1. +4 −3 core/word.py
  2. +4 −3 osh/cmd_parse.py
View
@@ -311,9 +311,10 @@ def TildeDetect(word):
pre, post = val[:p], val[p:]
prefix += pre
tilde_part = ast.TildeSubPart(prefix)
# TODO: Need a span_id here. Or use different algorithm.
#print('SPLITTING %s p = %d' % (word.parts[i], p), file=sys.stderr)
remainder_part = ast.LiteralPart(ast.token(Id.Lit_Chars, post))
# NOTE: no span_id here. It would be nicer to use a different algorithm
# that didn't require this.
t = ast.token(Id.Lit_Chars, post, const.NO_INTEGER)
remainder_part = ast.LiteralPart(t)
found_slash = True
break
View
@@ -121,9 +121,10 @@ def _MaybeReadHereDocs(self):
h.body = word
h.was_filled = True
else:
# TODO: Add span_id to token
# Each line is a single span.
tokens = [ast.token(Id.Lit_Chars, line) for _, line in lines]
# Each line is a single span. TODO: Add span_id to token.
tokens = [
ast.token(Id.Lit_Chars, line, const.NO_INTEGER)
for _, line in lines]
parts = [ast.LiteralPart(t) for t in tokens]
h.body = ast.CompoundWord(parts)
h.was_filled = True

0 comments on commit 823c11c

Please sign in to comment.