Hi, I’ve been trying to figure out Parser.y
with disambiguation of record access expression and operator expression in mind. Currently, record access syntax looks as follows
foo1 = bar.baz
foo2 = bar .baz
foo3 = bar . baz
foo4 = bar . baz
where all these expressions are parsed into ExprRecordAccessor
with varying values of tokTrailingComments = [ Space VAL ]
. I’d like to change the expr7
in Parser.y
such that
foo1
and foo2
mean record access, while foo3
and foo4
would be treated as operator expression.
Could I get some pointers as to how to do it? I believe that it could look something like this
{%^ \(SourceToken {tokAnn=(TokenAnn{ tokTrailingComments=a})}) -> <no idea about here> }
and that, at least as a first step, I’d need to rewrite expr7
and expr1
(I didn’t know about Happy
until today and have limited knowledge about lexing and parsing, so that might prove a bit challenging)