New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String Interpolation #52
Conversation
Sources/Parse/Lexer.swift
Outdated
case semicolon | ||
case newline | ||
case leftParen | ||
case rightParen | ||
case leftBrace | ||
case slashLeftParen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be removed now
@@ -130,12 +133,14 @@ enum TokenKind: Equatable { | |||
case .identifier(let value): return value | |||
case .unknown(let char): return char | |||
case .char(let value): return String(UnicodeScalar(value)) | |||
case .stringInterpolationLiteral(_): return "literal w/ interp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually implement this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant implement this is-is, since the current data structure doesn't distinguish between interpolated & non-interpolated parts of the string literal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't think this is even called. I wouldn't worry about it.
@@ -544,14 +576,6 @@ struct Lexer { | |||
advance(3) | |||
return Token(kind: .ellipsis, range: range(start: startLoc)) | |||
} | |||
if c == "[" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed since the c.isOperator
case should handle them
This is some fantastic work, and I am SO excited to merge this. |
stdlib/String.tr
Outdated
} else if value is UInt16 { | ||
fatalError("unimplemented") | ||
} else if value is UInt32 { | ||
fatalError("unimplemented") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know the snprintf stuff sucks to repeat, but could you implement these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I can. Can't wait until we have generics and can implement it just once!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
stdlib/String.tr
Outdated
fatalError("unimplemented") | ||
} else if value is Bool { | ||
if value as Bool { | ||
self._storage = ByteArray("true" as *Int8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does self = "true"
not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, does assigning to self
actually work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does -- it's just a store into the alloca
. I just tried it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -130,12 +133,14 @@ enum TokenKind: Equatable { | |||
case .identifier(let value): return value | |||
case .unknown(let char): return char | |||
case .char(let value): return String(UnicodeScalar(value)) | |||
case .stringInterpolationLiteral(_): return "literal w/ interp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly don't think this is even called. I wouldn't worry about it.
208fd6a
to
99811ba
Compare
99811ba is optional, it will have a major performance downside |
It certainly will, but I think that's actually fine. Constructing a temporary string isn't the end of the world. |
Failing due to the segfault @CodaFi wanted to look into |
I think the crashes you're seeing here are actually caused by this patch. If it were LLVM you'd see it in the frames. |
They're happening when disposing the module, I'm pretty sure |
It would go through LLVMDisposeModule like the others if that were true. |
It's being caught in the signal handler... |
@trill-ci please test |
305c4b8
to
c3a5dfb
Compare
@trill-ci please pass |
Uh...this should probably be reduced and filed on lira. |
I need to do reading tonight and go to bed and tbh I have no idea where to start with reduction |
Prevents segfaulting, somehow ¯\_(ツ)_/¯
This fixes a Swift runtime crash. Search me.
62e9e6c
to
c94a446
Compare
🎉 🎉 🎉 |
This is broken and I don't know why ¯_(ツ)_/¯