I've never seen a Java compiler do this correctly (my 4120 compiler doesn't), but it's worth saying. We're abusing left and right for CUP Symbol. They're supposed to be the "left and right locations in the input stream to which that terminal or non-terminal came from" (which has some nice fun features), but we, like every compiler ever, uses line and column from JFlex. This isn't really a problem, but it makes me sad. https://www.cs.princeton.edu/~appel/modern/java/CUP/manual.html#label_part
|
Symbol op(int tokenId) { |
|
return new Symbol(tokenId, yyline + 1, yycolumn + 1); |
|
} |
public Symbol(int id, Symbol left, Symbol right)
I've never seen a Java compiler do this correctly (my 4120 compiler doesn't), but it's worth saying. We're abusing
leftandrightfor CUP Symbol. They're supposed to be the "left and right locations in the input stream to which that terminal or non-terminal came from" (which has some nice fun features), but we, like every compiler ever, uses line and column from JFlex. This isn't really a problem, but it makes me sad. https://www.cs.princeton.edu/~appel/modern/java/CUP/manual.html#label_partSCIF/src/SCIF.jflex
Lines 19 to 21 in 50dfc8d
public Symbol(int id, Symbol left, Symbol right)