Big Chungus
Big Chungus
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
and while my c++ code would probably work on mostly any system, compiling it would be a pain
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
because I need cross platform support
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
yup, this is OOP hell
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
nope
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
not sure what that means
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
I'm interested to know what I should be using for Token tho
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
welp, I'm well out my depth here. I'll probably just use struct since it makes the most sense to me, even if it isn't the most performant
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
so then what should I do when I want a copy of an object?
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
right, so I should almost never use classes then I suppose
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
yes, I'm used to c++
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
c#
public class Token {
public SortedSet<int> types;
public List<Token> children;
public string text;
public TokenContext context;

public Token(SortedSet<int> types, List<Token> children, TokenContext ctx) {
this.types = types;
this.children = children;
this.text = ctx.source.GetText().Slice(ctx.start, ctx.end - ctx.start).ToString();
this.context = ctx;
}
...
}
c#
public class Token {
public SortedSet<int> types;
public List<Token> children;
public string text;
public TokenContext context;

public Token(SortedSet<int> types, List<Token> children, TokenContext ctx) {
this.types = types;
this.children = children;
this.text = ctx.source.GetText().Slice(ctx.start, ctx.end - ctx.start).ToString();
this.context = ctx;
}
...
}
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
c#
public class TokenContext {
public Source source;
public int start;
public int end;
public int line;
public int col;
public TokenContext(int start, int end, int line, int col, Source source) {
this.source = source;
this.start = start;
this.end = end;
this.line = line;
this.col = col;
}
}
c#
public class TokenContext {
public Source source;
public int start;
public int end;
public int line;
public int col;
public TokenContext(int start, int end, int line, int col, Source source) {
this.source = source;
this.start = start;
this.end = end;
this.line = line;
this.col = col;
}
}
39 replies
CC#
Created by Big Chungus on 2/20/2025 in #help
Object passed by reference unexpectedly
yes
39 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
odd
44 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
yes, but if you have the string "test string" and you tell it to start from index 4, patterns like ^\s will not be matched
44 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
yes, but in my testing, it doesn't consider this the beginning of the string, so I actually have to create a whole new string
44 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
I really hate C#'s regex
44 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
wait why is there isMatch() for ROS, but not Match()?
44 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
it's a really well made library
44 replies
CC#
Created by Big Chungus on 2/4/2025 in #help
Fast regex that takes in a span instead of a string
still a shame that no one has made a propper wrapper for re2 tho
44 replies