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...
Showing
with
8 additions
and
6 deletions.
-
+4
−3
core/word.py
-
+4
−3
osh/cmd_parse.py
|
|
@@ -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
|
|
|
|
|
|
|
|
|
@@ -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