You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the Raku lexer is confused by an object attribute of y or tr. In certain syntax, LexRaku interprets it as the y/// or tr/// operator, not the attribute of the object instance obj.
classPoint2D {
hasStr$!id='P2'; # private attr. with default valuehasNumeric$.x; # attr. with read-only accesorhasNumeric$.y; # same as above
}
# Initializing an object instance. Private attributes# cannot be initialized during object construction.my$p1= Point2D.new(x=>3, y =>4);
say"x: ", $p1.x; # invoking the read-only accessorsay"y: ", $p1.y; # same as above# An attribute with a read-only accesor cannot be modified# from outside the class. To do so, add the `is rw` trait # to make it read-write. For example: `has Numeric $.x is rw;`# this semicolon ends the y/// operation;say"ok";
(to maintain compatiblity with Perl, Raku still has y/// as an alias of the tr/// operator . I confirmed that .tr behaves identically to .y in the examples above)
The text was updated successfully, but these errors were encountered:
For say "y: ", $p1.y;, it is checking the next character ';' with IsValidRegOrQAdjacent which allows most punctuation including ; to be the delimiter and then switching to style SCE_RAKU_REGEX. So y;dol;wne; is a valid translation to the lexer.
Even space is valid to IsValidRegOrQAdjacent so y is treated as the start of a translation but is then stopped early inside ProcessValidRegQlangStart.
It is possible that the set of valid delimiters for y and tr operators is more constrained than for rx and IsValidRegOrQAdjacent or its caller should check that.
the Raku lexer is confused by an object attribute of
y
ortr
. In certain syntax, LexRaku interprets it as they///
ortr///
operator, not the attribute of the object instanceobj
.verified using: SciTE 5.4.3 Scintilla:5.4.3 Lexilla:5.3.1:
code to lex(from https://uzluisf.gitlab.io/raku-by-example/classes-and-objects):
(to maintain compatiblity with Perl, Raku still has
y///
as an alias of thetr///
operator . I confirmed that.tr
behaves identically to.y
in the examples above)The text was updated successfully, but these errors were encountered: