-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adjust RepHint Parsing #214
Conversation
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.
Mostly looks good now!
aeneas/src/vst/Parser.v3
Outdated
def parsePacking(p: ParserState) -> VstPacking { | ||
if (p.curByte == '0') { | ||
p.eat1(); | ||
p.req1('b'); |
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.
We'll want to allow uppercase 'B' to be consistent with binary literals.
aeneas/src/vst/Parser.v3
Outdated
var chars = Vector<u8>.new(); | ||
while (q < p.input.length) { | ||
var c = p.input[q]; | ||
if (c == '0' || c == '1' || Char.isIdentStart(c)) chars.put(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.
Should we allow '?' here too?
aeneas/src/vst/Parser.v3
Outdated
} else if (Char.isIdentStart(p.curByte)) { | ||
var packingName = parseIdentVoid(p); | ||
var fields = parseList(0, p, '(', COMMA, ')', parseIdentVoid); | ||
return VstPacking.Params(packingName.name, fields.map(asToken)); |
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.
You can use VstIdent<void>.name
as a getter method here.
aeneas/src/vst/Parser.v3
Outdated
var result: VstRepHint; | ||
if (Strings.equal(name, "boxed")) result = VstRepHint.Boxed; | ||
else if (Strings.equal(name, "unboxed")) result = VstRepHint.Unboxed; | ||
else if (Strings.equal(name, "packing")) { |
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.
Packing is a keyword now; let's introduced KC_PACKING
to allow it (but not other keywords) here.
aeneas/src/vst/Vst.v3
Outdated
|
||
type VstPacking { | ||
case Bits(rep: string); | ||
case Params(packingName: Token, fields: VstList<Token>); |
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.
What about making the fields a VstList<Expr>
? That way we can accommodate VarExpr
and 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.
lgtm
Can you bump the version number and I'll merge this? |
No description provided.